Display unicode from basic macro (Solved) [closed]
I have a macro (simplified version below-edited, thanks rautamiekka) to insert certain special characters into a writer document. The macro prompts for user input (an Ascii character) selects the required unicode character and inserts it in the document. Although it worked in the past, the in the latest version of LO (4.2.7) the prompt does not display the unicode characters properly. Any ideas why this is (not) happening?
sub InsertSpecial
rem insert a special character from a menu
DIM s$, s1$, s2$, oText As Object, oVCurs As Object
oText = ThisComponent.Text
oVCurs = ThisComponent.CurrentController.getViewCursor()
s = "A ∀ B ∵ T ∴" & Chr$(10)
s2 = InputBox(s,"Insert Special Character","A")
If s2 = "" Then Exit Sub
s1 = UCase(Left(s2,1))
Select Case s1
Case "A" : s1 = "∀"
Case "B" : s1 = "∵"
Case "T" : s1 = "∴"
End Select
oText.insertString(oVCurs, s1, False)
oText.insertString(oVCurs, Mid(s2, 2), False)
end sub
4.2.7 is latest Still version, but the very newest is 4.4.0 RC1, and if you don't count pre-releases, 4.3.3 is very newest, but 4.2.7 is definitely not newest.
As for your code, you have to add 4 spaces befeore each line, including empty lines, to have it considered a code.
Thanks Rautamiekka, I see that 4.3.3 is out. However, 4.2.7 is the latest version offered by Synaptic.
Yeah, cuz the Still branch equals stable. If you're running Ubuntu or Ubuntu-based, you can use https://launchpad.net/~libreoffice/+a... . Whether it'll work for Debian I can't say, and I have no clue about other distros/package systems.
Problem persists in 4.3.4.
In what way do you trigger (call) the sub?
Does the promp (input box) show up properly, except the special characters?
Did you try to debug the sub (setting breakpoints or inserting output statements)?
I cannot test with every version, but can confirm that the sub works fine under Win 8.1 in PortableLibreOffice V4.3.3.
Thanks, Lupp, that is interesting that it works in your set-up. The sub is called from a keyboard shortcut in Writer under Ubuntu 14.04. Everything works correctly except the display of special characters in the input box. They display correctly in the listing. Debugging reveals that the string 's' contains what it should contain. I'm not sure what else I can check.
It's a pity that I don't know enough about the handling of fonts by different types or layers of executables. This under Linux even more. But what you tell seems to point to the question: Has the basic code while being interpreted (executed) access to the font(s) containing the special characters and/or are the fonts used by basic correctly replaced if necessary?
What do you get in the Writer document if make your selection blind?
Yes, your question expresses my deductions, but more clearly. However, I do not know how to proceed, and I don't understand 'make your selection blind'. Help me with that, please.
No secret meanings. The input box is showing, I think, everything except the special characters (SCs). You will see an "A", e.g. as a hint that hitting the A-key will produce one of the SCs (which itself i not displayed). Hitting now that key actually is, what I called "blind selection". Is anything inserted into your text after hitting "A" (e.g.)?
LibreOffice is dedicated to be and to exclusively use free software, this including the fonts. So should be Ubuntu. The default font for Writer under windows is 'Liberation Serif', for Calc 'Liberation Sans'. Both these fonts do not contain the three special symbols of your example (U+2200, U+2235, U+2234). On my windows system there is active a replacement mechanism which is obviously working sufficiently: Look for an Ubuntu specialist to get advice best.