Page 1 of 1

Load document from stdin instead of an URL

PostPosted: Thu Jan 01, 2015 3:05 pm
by _savage
In order to load a document by a script into an office instance, I currently use the loadComponentFromURL() from the XComponentLoader interface. However, this accepts only a URL as parameter.

Is there a way to read a document directly from stdin? Or: can I pipe data into office?

Re: Load document from stdin instead of an URL

PostPosted: Thu Jan 01, 2015 3:11 pm
by RoryOF
There is discussion on this at
http://unix.stackexchange.com/questions/91088/is-it-possible-to-feed-open-office-via-stdin

Other searches suggest the best way (=simplest) may be to make a file of the data and then to open that automatically in OpenOffice.

Re: Load document from stdin instead of an URL

PostPosted: Thu Jan 01, 2015 3:20 pm
by _savage
Hmpf. Looks like files only...

I wonder if I could pass a local /dev/stdin as a URL. No, can't:
Code: Select all   Expand viewCollapse view
Unsupported URL <file:///dev/stdin>: "type detection failed"

Re: Load document from stdin instead of an URL

PostPosted: Sat Oct 17, 2015 4:26 pm
by _savage
I came across this thread today which uses a byte array of the file and converts it to an input stream that's then loaded. Looks to me like an appropriate solution? Only problem is that I can't quite figure out how the ByteArrayXInputStreamAdapter is accessible with Python UNO, or if this is something I'd have to implement and provide myself.