Using pyUNO to output the binary code of a document

The Application Programming Interface and the OASIS Open Document Format

Using pyUNO to output the binary code of a document

Postby evgenit » Thu Jan 08, 2009 3:30 am

Hello everybody,

I am using PyUNO to create a MS word document, like this:

Code: Select all   Expand viewCollapse view
self.desktop = self.smgr.createInstanceWithContext( "com.sun.star.frame.Desktop", self.remoteContext)

self.OOo_doc = self.desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () )


Then, after populating the document with information, I can save it to a file by calling

Code: Select all   Expand viewCollapse view
self.OOo_doc.storeToURL(url, args)


However, I don't actually need a file, I need the contents of the file. I could store to a temporary file and read that file back in as binary, but this is ugly. Is there a way to get at the binary code of the document, and say output it to screen? Something like this:

Code: Select all   Expand viewCollapse view
var = self.OOo_doc.magical_call()
print var
evgenit
 
Posts: 1
Joined: Wed Jan 07, 2009 5:41 pm

Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 2 guests