Using pyUNO to output the binary code of a document

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
evgenit
Posts: 1
Joined: Wed Jan 07, 2009 5:41 pm

Using pyUNO to output the binary code of a document

Post by evgenit »

Hello everybody,

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

Code: Select all

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

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

var = self.OOo_doc.magical_call()
print var
Post Reply