I have an appication in which I fill the LibreOffice text document using bookmarks and then save them as PDF (C#, .NET 4.0, VS 2010). I am facing the problem that when I fill the document first time then everything works fine but when I close the document using API and open new document and try to fill ( Automatically using Uno API) then Uno API process won't get response from LibreOffice.
Uno Libreoffice Python
Install the plugin in the usual way, and you should be able to use the Mammoth.docx converter when adding a post. If you can’t see the meta box, make sure that it’s selected by taking a look at the “Screen Options” for adding a post. 'C:Program FilesLibreOfficeprogrampython.exe' import uno If instead you are using an installation of Python on Windows that was not shipped with LibreOffice, then getting it to work with UNO is much more difficult, and I would not recommend it unless you enjoy hacking. Now, here is all the code. UNO API of LibreOffice easy and understandable - Nice Office Access java libreoffice uno-api Java LGPL-2.1 14 23 11 0 Updated Jan 17, 2021.
Mean second time LibreOffice process won't response on writng bookmarks and my application process wait for the response of LibreOffice. This results in hang in my application, as my process wait indefinitely response from Uno API (and may be Uno API wait for response from running LibreOffice process).
Uno/libreoffice Object Model
Can someone tell what could be the reason or how to resolve this problem.
Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-08-25 01:56:32.233102
can you provide the specific commands you issue to close the document. It might be worthwhile to exit the LibreOffice process entirely, using the equivalent of
StarDekstop.terminate. See API here.
.terminate() exit the LibreOffice process from memory completly. I am closing the Writer document using .close(true) and then load the new document using loadComponentFromURL(). But on second time it load the document but when I try to read bookmarks or try to get Range of bookmarks then process hang.
your experience is similar to mine on
Base. I assume you are on headless, so I'm not sure of cross-applicability of troubleshooting steps: 1) upgrade to current LO Fresh 2) see if there are intermediate objects to close-- for me
Form objects, for you maybe a
DrawPage? not sure 3) write
Wait 100 equivalents at various points in your code to troubleshoot race conditions 4) make sure LO objects really are initializing correctly on second open-- LO 5.0 Win I need a strategic
Second time LibreOffice started correctly but when I try to access the position of bookmarks or try to write some content based on position of bookmark then the Uno API hang. But this only happened second time. I thought it might be some problem in my program and therefore I changed the LibreOffice with OpenOffice and there was no such problem. It mean that it is some bug in LibreOffice.
Well, it means that some recent enhancement in LO has resulted in unexpected functionality in your case. OO is not under real active development as I understand it, so using OO is like using an antique version of LO.
Mammoth is designed to convert .docx documents, such as those created by Microsoft Word, and convert them to HTML. Mammoth aims to produce simple and clean HTML by using semantic information in the document, and ignoring other details. For instance, Mammoth converts any paragraph with the style
h1 elements, rather than attempting to exactly copy the styling (font, text size, colour, etc.) of the heading. This allows you to paste from Word documents without the usual mess.
There’s a large mismatch between the structure used by .docx and the structure of HTML, meaning that the conversion is unlikely to be perfect for more complicated documents. Mammoth works best if you only use styles to semantically mark up your document.
The following features are currently supported:
Tables. The formatting of the table itself, such as borders, is currently ignored, but the formatting of the text is treated the same as in the rest of the document.
Footnotes and endnotes.
Bold, italics, superscript and subscript.
Text boxes. The contents of the text box are treated as a separate paragraph that appears after the paragraph containing the text box.
Embedded style maps
By default, Mammoth maps some common .docx styles to HTML elements. For instance, a paragraph with the style name
Heading 1 is converted to a
h1 element. If you have a document with your own custom styles, you can use an embedded style map to tell Mammoth how those styles should be mapped. For instance, you could convert paragraphs with the style named
h1 elements with
class='warning' with the style mapping:
An online tool can be used to embed style maps into an existing document. Details of how to write style maps can be found on the mammoth.js documentation.
If you’d like to say thanks, feel free to make a donation through Ko-fi.
If you use Mammoth as part of your business, please consider supporting the ongoing maintenance of Mammoth by making a weekly donation through Liberapay.
Install the plugin in the usual way, and you should be able to use the Mammoth .docx converter when adding a post. If you can’t see the meta box, make sure that it’s selected by taking a look at the “Screen Options” for adding a post.