Load files into Writer only?
Jens Tröger
jens.troeger at light-speed.de
Wed Apr 1 04:01:20 PDT 2015
Hi,
As a follow-up to this thread, Piet (in a different thread: "Re: How
many degrees of headlessness do we need? [and LibreOffice crash]")
posted this snipped of code to open a Writer document only:
------------------------------------------------------------------------
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)
------------------------------------------------------------------------
While I couldn't use this due to a crash of createInstance(), it looks
to me as if this code would be an alternative to what we've discussed in
this thread. I assume that loading, say, a Calc or an image would fail
here?
Cheers,
Jens
--
Jens Tröger
http://savage.light-speed.de/
More information about the LibreOffice
mailing list