Hi David,
On 07.12.2010 12:24, David Roe wrote:
I have some Excel spreadsheets that contain files embedded as OLE packages
(Insert->Object-> From file). I want to retrieve the data for those files.
I've managed to use the API to retrieve the Shape object and get at the OLE
data but I don't fancy writing my own OLE reading code. Is there an API to
get at the data inside? I saw css.embed.OLESimpleStorage but I can't seem to
get anywhere with that. My code so far is (in Python):
# ... setting up of OOo ...
sheet = doc.Sheets.getByName('Sheet1')
draw_page = sheet.DrawPage
shape = draw_page.getByIndex(0)
# CLSID 00000000-0000-0000-0000-000000000000 is a file??
print 'CLSID:', shape.CLSID
obj = shape.EmbeddedObject
# Create a "storage" object to hold the data from our embedded
object
storage_factory =
service_manager.createInstance('com.sun.star.embed.StorageFactory')
storage = storage_factory.createInstance()
# Store the data into the "Something" entry of our storage object
obj.storeToEntry(storage, 'Something', (), ())
str_elem = storage.openStreamElement('Something', ElementModes.READ)
stream = str_elem.getInputStream()
sfa =
service_manager.createInstance('com.sun.star.ucb.SimpleFileAccess')
sfa.writeFile(file_url('test.txt'), stream)
Thanks,
David Roe
As you are asking here, this code obviously doesn't work. Can you tell
us where something goes wrong?
Regards,
Mathias
--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "nospamfor...@gmx.de".
I use it for the OOo lists and only rarely read other mails sent to it.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org