Michael Stahl wrote:
actually now i tried it out and the crash was pretty trivially fixed
with commit d360477d8740f29e2c2bc5f7bbd667df7cd26ee9
This is great! It works!
So now I have one more way to process a document "headless". And now no weird window will be
created.
Code for reading a document:
------------------------------------------------------------------------
textdoc = ServiceManager.createInstance("com.sun.star.text.TextDocument")
loadURL = systemPathToFileUrl(realpath("test.odt"))
inProps = (PropertyValue("URL", -1, loadURL, 0), PropertyValue("FilterName", -1, "writer8", 0))
textdoc.load(inProps)
print(textdoc.Text.String)
textdoc.close(True)
------------------------------------------------------------------------
Code for writing a document:
------------------------------------------------------------------------
textdoc = ServiceManager.createInstance("com.sun.star.text.TextDocument")
textdoc.initNew()
textdoc.Text.String = "Hello World from initNew()"
saveURL = systemPathToFileUrl(realpath("test.odt"))
outProps = PropertyValue("Overwrite", -1, True, 0), # 1-tuple
textdoc.storeAsURL(saveURL, outProps)
textdoc.close(True)
------------------------------------------------------------------------
Even with a non-headless LO start (but with --nologo --nodefault) no window is created.
--
Piet van Oostrum <piet@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
Context
- Re: How many degrees of headlessness do we need? (continued)
Popup dialogs (was How many degrees of headlessness do we need?) · Anthonys Lists
Re: How many degrees of headlessness do we need? · Piet van Oostrum
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.