Hi everyone,
I am developing a LibreOffice extension with PyUno for LibreOffice writer. The extension should replace single words in the text with other words (without changing the formatting) and black out areas.
At the moment I iterate within the extension laboriously over the single paragraphs and text sections to pick out the single words. The words are then sent to a web service. The web service analyzes the words and returns the result to the extension. Then the extension replaces the words in the document.
Code already exists in the web service that can extract and replace words from an ODT file. Therefore, it would be good if the extension can use this code.
I need support with the following questions:
How do I get the current processing state of the file (preferably the XML structure) via the extension? It is imperative that unsaved changes are also taken into account.
How do I replace the complete content of the opened document (preferably replacement of the XML structure)?
Is there a possibility to get the XML structure of a selected area?
I have already succeeded in extracting the saved XML via the extension. Unfortunately, not saved changes are missing here. One could also save the results of web service in a file and then reopen it with LibreOffice. But it would be more user friendly if this is done in the same window.
Does anyone have any ideas how I can implement my plan?
Thanks a lot and best regards
Florian