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

Reply via email to