Vladislav ,

In Belgium we have to deal with at least 2 languages Dutch and French who have also a lot non asci characters, we use extenifly Basic and some times hwe have to decode some text to UTF-8 who works and we decode the stream plese find below some code to encode a stream before insertion in a document

hope it helps

Greetz Fernand
oPipe = createUNOService ("com.sun.star.io.Pipe")
oTextOutputStream = createUNOService ("com.sun.star.io.TextOutputStream")
oTextOutputStream.setOutputStream(oPipe)
oTextOutputStream.setEncoding("UTF-8")  '"Windows-1252")

szone = "some tekst with &é"''((§§§èèè!! non asci character
'print szone
oTextOutputStream.writeString(szone)
' at current viewcursor positiong
 InsertViaStream(opipe)

sub InsertViaStream(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
Hello,
As I can see, there is a lot of people who are using BASIC for macros. And
I too.
Problem is next: does anybody developing Basic?
Problem 1: for all who want to deal with characters outside of English
language we have big problem, for example, with print function. I can not
export Cyrillic characters.
Problem 2: This is an office suit. Problem is when I want export some data
in a brand new .xml document. I can not create this xml document without
meta files in zipped file.
If I look on OO forum, there are majority of users who deal with Basic. If
this is reality, what is problem for little polishing for Basic?

Regards,
Wlada



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

Reply via email to