Peter ,

Not so sure I use a technic i learned years aho from the Famous Danny B.

oPipe = createUNOService ("com.sun.star.io.Pipe")
oTextOutputStream = createUNOService ("com.sun.star.io.TextOutputStream")
oTextOutputStream.setOutputStream(oPipe)
oTextOutputStream.setEncoding("ISO-8859-1")
InsertdocViaStream(opipe)

sub InsertdocViaStream(oInputStream as Any)
oStorageFac = createUnoService("com.sun.star.embed.StorageFactory")
oStorage    = oStorageFac.createInstance
oStream = oStorage.openStreamElement("ms777", com.sun.star.embed.ElementModes.WRITE)

'now pump the inputstream to the stream
oPump = createUNOService ("com.sun.star.io.Pump")
oPump.setInputStream(oInputStream)
oPump.setOutputStream(oStream)
oPump.start()

while oInputStream.available()>0
 wait(50)
wend
oStream.flush
oStream.closeOutput
oStream.dispose
'open the stream again, now for seekable reading
oStream = oStorage.openStreamElement("ms777", com.sun.star.embed.ElementModes.SEEKABLEREAD)
'dim oProps(1) as new com.sun.star.beans.PropertyValue
oProps(0).Name = "InputStream"
oProps(0).Value = ostream
oProps(1).Name = "FilterName"
oProps(1).VAlue = "HTML (StarWriter)"

Dim oInsertCursor As Object
   if wat = "Cell" then
   oInsertCursor = oVC.cell.createTextCursorByRange(oVC,false)
elseif wat = "Frame" then oInsertCursor = oVC.TextFrame.createTextCursorByRange(oVC,false)
   elseif wat = "Doc" then
   oInsertCursor = oVC.text.createTextCursorByRange(oVC,false)
   endif
    oInsertCursor.InsertDocumentFromURL("" , oProps())
opipe.flush opipe.closeinput ostorage.dispose ostream = nothing end sub


Hi,

Am 10.03.2010 11:16, schrieb Fernand Vanrie:
rf,

I think it depends on the complexity off the content, I use a technic,
where we store some simple formated text as "html" in a datbase and then
import this "thml" coded text in a exiting OO writerdoc. The OO html
import filterrebuild the text with his formating.
If wanted then is can post the code in Basic.
Fernand
is there a method to read/store an odt doc from a database
and import it into the current writer doc?

This cannot be done in Basic, because your class must implement XSeekable to load the doc as stream. Use XDocumentInsertable and the InputStream from your database, the url is private:stream.

Regards

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to