Hello Ocke,

Am Dienstag, den 19.02.2008, 12:02 +0100 schrieb Ocke Janssen:
> Hi Marc,
> 
> Marc Santhoff wrote:
> > Hi again,
> >
> > still more questions:
> >
> > If I have stored an alien file into the base file and retrieve the names
> > using
> >
> >    doc.getSubStoragesNames()
> >
> > this list does only contain the elements "FormDocuments" and
> > "ReportDocuments".
> >
> > Is this by design or a missing feature?
> >
> > The reason for this question is simple:
> > When creating a substorage with a given name, this name seems to be not
> > visible after creation. If one is happy with fixed substorage names,
> > there is no problem. For the purpose of embedding templates I could live
> > with it very well.
> >
> > Maybe I overlooked something ...
> >   
> It should return all names which are in the storage. Do you commit the 
> new sub storage you inserted?

Yes, of course. Look for yourself:

<code>
sub TestAlienStorage
        dim mData(0) as byte
        
        sAlienFile = "c:\autoexec.bat"
        sOpenDBDocument = "Spielwiese"
        
        oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
        datacount = oUcb.getSize(convertToUrl(sAlienFile))
        ReDim mData(datacount) as byte
        xIStream = oUcb.openFileRead(convertToUrl(sAlienFile))
        
        ' get the database file already opened
        doc = FindBaseComponent(sOpenDBDocument)

        ' create new folder
        xSubStorage = doc.getDocumentSubStorage("Area 51", _
                                        com.sun.star.embed.ElementModes.WRITE)
        xSubStorage.setPropertyValue("MediaType", "text/plain")
                
        ' create stream and write foreign file into it
        xOStream = xSubStorage.openStreamElement("File X42", _
                                        com.sun.star.embed.ElementModes.WRITE)
        cnt = xIStream.readSomeBytes(mData, datacount)
        if (cnt<>datacount) then msgbox "Error on writing file to substorage!"
        xOStream.writeBytes(mData)

        xOStream.closeOutput()
        xIStream.closeInput()
                
        xSubStorage.commit()
        xSubStorage.dispose()
end sub

</code>

Sounds like this wille need another issue. Or the space chars in the
name do harm to the names listing ...

Marc



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

Reply via email to