Am Donnerstag, den 14.02.2008, 07:42 +0100 schrieb Ocke Janssen - Sun
Microsystems Inc.:
> 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.
It does, and it's more than I expected to get to make a start. :)
Can I assume that base will only care for documents and storages it
created itself and anything else will/should not disturb the normal
work?
Anyway, I'll play with it a little ...
Many thanks Ocke,
Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]