Andreas Schlüns wrote:
Andrew Douglas Pitonyak wrote:
Dim oProp(0) As New com.sun.star.beans.PropertyValue
oProp(0).Name = "InputStream" : oProp(0).Value = oStream
REM oProp(1).Name = "ReadOnly" : oProp(1).Value = True
REM oProp(2).Name = "FilterName" : oProp(2).Value = "writer8"
StarDesktop.LoadComponentFromUrl("private:stream", "_blank", 0, oProp())
When I try this, however, soffice locks up and I have to manually
kill soffice.
The closest that I could find to a solution is in Java, but it uses a
com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter
The speculation is that the XInputStream does not support XSeekable.
http://joott.cvs.sourceforge.net/joott/jooconverter2/src/net/sf/jooreports/openoffice/converter/OpenOfficeDocumentConverter.java?view=markup
An "InputStream" property of the MediaDescriptor has to support
XSeekable also. Otherwhise OOo cant deal with it.
But normaly that shouldn't produce a "locked" office instance.
The load request should fail.
But a locked office can be produced by the content you try to load.
Might be the used filter does not match to the type of content you
wish to load. You said that you tried to load a Base document ... but
you use a writer filter ("writer8"). That can produce trouble.
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.
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.
c) Try to load several other contents, to make sure that your problem
is not related to these.
This I have not tried; yet! I can, however, extract and save the files
to disk with no problem, but I know that I can not load the document
using the stream directly because I inspected the stream and it does not
support XSeekable. After I figure out how to create or obtain a stream
that supports XSeekable, then I will try other types of content.
Regards
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]