Hello Madhur,

sorry, forgot the link

On Friday 19 March 2010, 08:32, Madhur Kashyap wrote:
> I can't seem to find a way to embed arbitrary file(s) into calc spreadsheet.
>
> > you need to use the embed API, cf.
> > 
> > http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.ht
> 
> I did notice this module earlier but it is complicated for me to grasp.

basically, you get the document root storage:
http://api.openoffice.org/docs/common/ref/com/sun/star/document/XStorageBasedDocument.html#getDocumentStorage

and then you have a storage to work with

> Do you know some examples which I can refer to?

http://arielch.fedorapeople.org/docs/embed_content.zip

unzip the folder. It has a text document and a C source file with 2 binaries. 
These 3 files will be embedded inside a new Writer document, stored in folder 
in $HOME, and then extracted in the same folder.

> Thanks for the help. I thought it is important from my part to describe the
> word "content". I have few text and binary executable files which I would
> like to keep embedded in the document.

a simple text file is also a binary file, so you use the same procedure - the 
same media type in the example (this would be different if you want to embed an 
xml file for example)

Notice that I don't see a way to execute the extracted binary executable files 
if you don't change the file modes once extracted (when the file is embedded, 
that attribute is lost).

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to