Load files into Writer only?

Jens Tröger jens.troeger at light-speed.de
Thu Feb 26 08:36:18 PST 2015


Hi,

Is there a way to load Writer supported documents only, and dismiss
(fail) on others?  For example, I connect to an office server like so

  local = uno.getComponentContext()                                       
  resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local)
  context = resolver.resolve("uno:pipe,name=foopipe;urp;StarOffice.ComponentContext")
  desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)

Now I'd like to 

  desktop.loadComponentFromURL()

and if that file is e.g. and image that Writer can not open, then fail.
Same for any other file which is not a Writer supported file.  I've
looked at this call

  http://www.openoffice.org/api/docs/common/ref/com/sun/star/lang/XMultiComponentFactory.html#createInstanceWithArgumentsAndContext

but can't figure out if that's the right way to go.  Or should I check
if the file is of a certain type before I pass it on to office?  In that
case though, I might reject some funky format which Writer supports,
just because I didn't know about it.

Thanks!
Jens

-- 
Jens Tröger
http://savage.light-speed.de/


More information about the LibreOffice mailing list