Marc Santhoff schrieb:
Hi,

is it possible do embed some foreign documents into an .odb-file? And
access them from BASIC?

I know from other lists that there is a way of having "alien" data in
ODF, I think I remember this would hold true for documents (in opposite
of tags in one standard document prt like "content.xml").

My goal would be to have some special template files for transferring
data to another application. These template files would be filled by a
script inside a base file and then sent to the other application
somehow.

These templates are to be created using a special third processor based
on external information not accesible to base, so base scripting or the
report generator are not the right tools.

Since versioning is an issue and the fact of having to transport only
one file makes life easier, this could be nice. :)
Below you'll find some C++ code to create a substorage in the database (odb) file. The getDocumentSubStorage is supported by the database document. The interface name is XDocumentSubStorageSupplier. All you have to do is to set the property "MediaType" at the newly created storage you get from the method. At the storage you can call things like openStreamElement... Please have a look at the API reference
com.sun.star.embed.XStorage, XStream
When you are finished with the storage you have to commit it to store you're changes. Reference< XStorage > xConfigStorage;

           // First try to open with READWRITE and then READ
xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READWRITE );
           if ( xConfigStorage.is() )
           {
rtl::OUString aUIConfigMediaType( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.xml.ui.configuration" ));
               rtl::OUString aMediaType;
Reference< XPropertySet > xPropSet( xConfigStorage, UNO_QUERY );
               Any a = xPropSet->getPropertyValue( INFO_MEDIATYPE );
if ( !( a >>= aMediaType ) || ( aMediaType.getLength() == 0 ))
               {
                   a <<= aUIConfigMediaType;
                   xPropSet->setPropertyValue( INFO_MEDIATYPE, a );
               }
           }
...... do some work ......
Reference<XTransactedObject> xTrans(xConfigStorage,UNO_QUERY);
   if ( xTrans.is() )
       xTrans->commit();

I hope this helps a little bit.
TIA,
Marc

- oj

--
Ocke Janssen                      Tel: +49 40 23646 661, x66661
Dipl. Inf(FH)                     Fax: +49 40 23646 550
Sun Microsystems Inc.
Nagelsweg 55                     mailto:[EMAIL PROTECTED]
D-20097 Hamburg                   http://www.sun.com/staroffice

Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to