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


On Sun, Mar 15, 2015 at 07:36:15PM +0100, Piet van Oostrum wrote:
document = desktop.loadComponentFromURL("file:///path/to/document.odt", "_blank", 0, ())
if document.supportsService('com.sun.star.text.TextDocument'):
   ...

You can also specify in the loadComponentFromUrl call thet you want Writer documents preferably, 
but this doesn't prevent LO to open other types also that it recognizes:

from com.sun.star.beans import PropertyValue
prop = PropertyValue('FilterName', 0, 'writer', 0)
document = desktop.loadComponentFromURL("file:///path/to/document.odt", "_blank", 0, (prop,))

It only means that LO will treat it as a Writer document if it can't inder the type from the file 
itself.

Thanks Piet!  There is no way that I can use

  # Create an empty Writer document.
  document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, ())
  document.load( (propVal,) )

and pass a document into the load() method?  That wouldn't constrain
myself to Writer?

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.