I just checked OOME 4, and I think that I have a glaring omission in
that I do not test or document the behavior of using write or print with
special characters. Sadly, I do not know the answer off hand, but, I
expect that you are seeing that they are not properly supported.
Can you try using Simple File Access instead and let me know if that
works?
There is an example her:
http://www.pitonyak.org/oo.php
http://www.pitonyak.org/OOME_4_0.odt
I include the example here, but, you should be able to see what you
need to do. Also note that the ODT documents contains the macros and you
can run the test program while reading the document if you eneable
macros when you load the document.
This is the example macro:
Sub ExampleSimpleFileAccess
Dim oSFA ' SimpleFileAccess service.
Dim sFileName$ ' Name of file to open.
Dim oStream ' Stream returned from SimpleFileAccess.
Dim oTextStream ' TextStream service.
Dim sStrings ' Strings to test write / read.
Dim sInput$ ' The string that is read.
Dim s$ ' Accumulate result to print.
Dim i% ' Index variable.
sStrings = Array("One", "UTF:Āā", "1@3")
' File to use.
sFileName = CurDir() & "/delme.out"
' Create the SimpleFileAccess service.
oSFA = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
'Create the Specialized stream.
oTextStream = CreateUnoService("com.sun.star.io.TextOutputStream")
'If the file already exists, delete it.
If oSFA.exists(sFileName) Then
oSFA.kill(sFileName)
End If
' Open the file for writing.
oStream = oSFA.openFileWrite(sFileName)
' Attach the simple stream to the text stream.
' The text stream will use the simple stream.
oTextStream.setOutputStream(oStream)
' Write the strings.
For i = LBound(sStrings) To UBound(sStrings)
oTextStream.writeString(sStrings(i) & CHR$(10))
Next
' Close the stream.
oTextStream.closeOutput()
oTextStream = CreateUnoService("com.sun.star.io.TextInputStream")
oStream = oSFA.openFileRead(sFileName)
oTextStream.setInputStream(oStream)
For i = LBound(sStrings) To UBound(sStrings)
sInput = oTextStream.readLine()
s = s & CStr(i)
' If the EOF is reached then the new line delimiters are
' not removed. I consider this a bug.
If oTextStream.isEOF() Then
If Right(sInput, 1) = CHR$(10) Then
sInput = Left(sInput, Len(sInput) - 1)
End If
End If
' Verify that the read string is the same as the written string.
If sInput <> sStrings(i) Then
s = s & " : BAD "
Else
s = s & " : OK "
End If
s = s & "(" & sStrings(i) & ")"
s = s & "(" & sInput & ")" & CHR$(10)
Next
oTextStream.closeInput()
MsgBox s
End Sub
Let me know if this works, I believe that it will. I hope that it will.
On 2018-08-30 6:06, Cédric Giraud wrote:
With the macro, *open *and *print *commands.
Le jeu. 30 août 2018 à 05:22, Andrew Pitonyak <andrew@pitonyak.org>
a
écrit :
How do you open the file and write the text?
Sent from BlueMail <http://www.bluemail.me/r?b=13569>
On Aug 29, 2018, at 5:35 PM, Cegir <cmapoubellemail@gmail.com>
wrote:
Hi, thanks for your help
I'm on Windows 10, and my keyboard is AZERTY. As French, the system
is
probably not UTF-8 by default.
I just copy/paste hangul from another .ods file.
I tried with 2 text editors and the .json reader from Firefox.
It seems the problem is the macro creates an ANSI file by default,
and not a
UTF-8 version. I have no idea how to change it.
If I create an UTF-8 file before running the macro, the macro
recreates it
in ANSI.
--
Sent from:
http://document-foundation-mail-archive.969070.n3.nabble.com/Users-f1639498.html
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.