Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


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/

Context


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.