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/
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to