Kohei Yoshida wrote:
> Hi Mathias,
>
> On 11/3/05, Kohei Yoshida <[EMAIL PROTECTED]> wrote:
>> On 11/3/05, Mathias Bauer <[EMAIL PROTECTED]> wrote:
>
>> > You can add a subfolder to the documents' package and (important!) add a
>> > MediaType to it (details can follow if you like this way). Then you can
>> > put any content you like into this subfolder (text or binary streams,
>> > other subfolders etc.). OOo then will preserve the complete subfolder on
>> > every saving of the document.
>
> Oh wait. Can this be done entirely via the API, or can this be done
> only by direct access to the file at file system level? I'd like to
> know more if it can be done via the API.
In OOo2.0 you can.
The following BASIC code inserts a folder with an empty stream into the
storage file of the current document:
storage = thiscomponent.getdocumentsubstorage("test", 7)
storage.setPropertyValue("MediaType","MySpecialMediaType")
stream = storage.openstreamelement("mystream",7)
storage.commit()
The "commit" call is important, without it no storage is added!
You must save the document afterwards to see it in the file.
The stream object implements css.io.XStream, so by calling
getInputStream() or getOutputStream() on it you get access to it and can
read from or write to the stream.
HTH,
Mathias
--
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]