Hello Andrew,


Andreas Schlüns wrote:


<snip>


I store a Write document into a Base document. I am storing Binary date in a Base Document, which uses the internal database. I know how to use a macro to open the file, read the file into a byte array and store the document into the database. I also know how to get the data out of the Base document and store it back onto disk using a normal stream.

What I want to do, is to extract the Write document from the database (Base) and then open it for editing. I can store the Write document on disk and then load it from disk, but I am trying to skip that step. I obtain a stream as follows:

sSQL = "SELECT DATA FROM BINDATA WHERE NAME='" & sFileName & "'"
 oResult = oStatement.executeQuery(sSQL)
 If Not IsNull(oResult) Then
   oResult.next()
   oStream = oResult.getBinaryStream(1)
 End If

I can not use this stream to open the document because it does not support XSeekable. From Basic, I can obtain an array of bytes, but I do not know how to use that to open the document directly.

Solutions:

a) Let your stream provide the interface XSeekable.

In Java, I can use the com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter to convert a byte array to an appropriate stream, but this does not appear to be available in Basic.
Perhaps this is a problem that can not be solved directly using Basic.

It can be solved ... if you implement an UNO Service which accepts a Sequence< sal_Int8 > as IN parameter and returns an XSeekable/XInputStream as result. Such service can be used in Java, C++, Basic, Phyton etcpp.

Currently I do not know if such help service still exists .-)


b) Use another filter or dont specify any filter so loadComponentFromURL() can search for it's own one.

I have tried specifying, and not specifying, the filter.

Then it does not depend on your content. It seams realy a problem of your non-seekable stream. But I don not understand then why the office locked up. Normaly the call loadComponentFromURL() should return without loading this content.

May be you can provide some stacks (produced with an attached debugger), which shows us, where the office is hanging ?

Regards
Andreas

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

Reply via email to