Load document from stdin instead of an URL

The Application Programming Interface and the OASIS Open Document Format

Load document from stdin instead of an URL

Postby _savage » Thu Jan 01, 2015 3:05 pm

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?
Mac 10.14 using LO 6.2.5.2, Gentoo Linux using LO 6.2.4.2.0 headless.
_savage
 
Posts: 168
Joined: Sun Apr 21, 2013 12:55 am

Re: Load document from stdin instead of an URL

Postby RoryOF » Thu Jan 01, 2015 3:11 pm

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.
Apache OpenOffice 4.1.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29269
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Load document from stdin instead of an URL

Postby _savage » Thu Jan 01, 2015 3:20 pm

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"
Mac 10.14 using LO 6.2.5.2, Gentoo Linux using LO 6.2.4.2.0 headless.
_savage
 
Posts: 168
Joined: Sun Apr 21, 2013 12:55 am

Re: Load document from stdin instead of an URL

Postby _savage » Sat Oct 17, 2015 4:26 pm

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.
Mac 10.14 using LO 6.2.5.2, Gentoo Linux using LO 6.2.4.2.0 headless.
_savage
 
Posts: 168
Joined: Sun Apr 21, 2013 12:55 am


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest