How do I tear down soffice cleanly?

Michael Stahl mstahl at redhat.com
Wed Feb 25 12:18:38 PST 2015


On 24.02.2015 18:41, Jens Tröger wrote:
> Supporting documentation:
> 
>   http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/XCloseable.html
>   https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Closing_Documents
> 
> I've now used this code:
> 
>     if document.supportsService("com.sun.star.util.XCloseable") :        
>         document.close(True)                                             
>     office.document.dispose()                                                   
> 

dispose() needs to go into an "else" branch.

i don't think "supportsService" will work here - it is not a service but
an interface, usually you check that with queryInterface() but since
Python is "dynamically typed" i don't know off-hand what the most
idiomatic way to check for it would be.

but i would assume that all LO application document types implement
XCloseable.




More information about the LibreOffice mailing list