Jens Tröger wrote: > 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 > That is what I would expect. However, I tried it, and when I open an Excell sheet (.xls) or a PNG, it gives an error message, but when I use a .ods file, it just hangs (presumably in the load). And it won't be killed by ctrl-C. This probably should be considered a bug.
When I then kill the LO process, the Python program gives this error message: SystemError: Couldn't instantiate python representation of structered UNO type com.sun.star.lang.DisposedException -- Piet van Oostrum <p...@vanoostrum.org> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice