Re: [api-dev] read odt from database
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? TIA rfjones - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
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: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
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: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
i forgot to fill the oTextOutputStream.with the content of a Dbases record oTextOutputStream.writeString(oRowset.Columns(nc).String 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 thenoInsertCursor = oVC.TextFrame.createTextCursorByRange(oVC,false) elseif wat = Doc then oInsertCursor = oVC.text.createTextCursorByRange(oVC,false) endif oInsertCursor.InsertDocumentFromURL( , oProps()) opipe.flush opipe.closeinputostorage.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: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
Hi Fernand, seems I have to stand corrected, never tried the pipe stuff before. Am 10.03.2010 12:33, schrieb Fernand Vanrie: i forgot to fill the oTextOutputStream.with the content of a Dbases record oTextOutputStream.writeString(oRowset.Columns(nc).String Peter , Not so sure I use a technic i learned years aho from the Famous Danny B. we all miss him :( Regards Peter - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
Not so sure I use a technic i learned years aho from the Famous Danny B. we all miss him :( +1 - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
Peter, Drew, Just wondering: can we directly store parts of a Writterdoc ( text + underlyingOOformating) --without the html workaround-- into a database and instert it back with the original OOformating ? Peter , ps: We must raise a Statue for Danny ! 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 thenoInsertCursor = oVC.TextFrame.createTextCursorByRange(oVC,false) elseif wat = Doc then oInsertCursor = oVC.text.createTextCursorByRange(oVC,false) endif oInsertCursor.InsertDocumentFromURL( , oProps()) opipe.flush opipe.closeinputostorage.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: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] read odt from database
Hi Fernand, Fernand Vanrie schrieb: Peter, Drew, Just wondering: can we directly store parts of a Writterdoc ( text + underlyingOOformating) --without the html workaround-- into a database and instert it back with the original OOformating ? Storing of course yes (in Basic too): Select the part, use XTransferable to copy it in an tmp-file and send it to the database with .setBinaryStream(). The stream you can get with the SimpleFileAccess service. Backwards you can try your pipe example with getBinaryStream(). And let us know, if you succeed... Regards Peter - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org