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


Test your coffee against the basic IDE and a help window, one might not support close if my memory 
is correct.

On Feb 25, 2015 7:16 PM, =?ISO-8859-1?Q?Jens_Tr=F6ger?= <jens.troeger@light-speed.de> wrote:

Thanks Michael.  Looking at 13. in this FAQ 

  http://www.openoffice.org/udk/python/python-bridge.html#faq 

it seems that queryInterface() is not needed.  Thus, I'm using the 
following code now 

    document.close(True) 
    document.dispose() 

and that seems to work too. 
Jens 


On Wed, Feb 25, 2015 at 09:18:38PM +0100, Michael Stahl wrote: 
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. 

-- 
Jens Tröger 
http://savage.light-speed.de/ 
_______________________________________________ 
LibreOffice mailing list 
LibreOffice@lists.freedesktop.org 
http://lists.freedesktop.org/mailman/listinfo/libreoffice 

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.