How can I write a macro for OpenOffice writer, which get the words/characters that I selected with mouse an emphasis mark like dot over the words/characters?
I tried to record macro, but failed.
I hope someone here can help me
I am trying to write a macro for OpenOffice Writer and LibreOffice Writer. This macro will add a toolbar in Writer, similar to the Chinese punctuation toolbar in the Chinese version of MS Word. The buttons of the toolbar are Chinese punctuation marks. One of the button will be the emphasis mark used in simplified Chinese in China. The emphasis mark is a dot under the Chinese character that is emphasized when the text direction is horizontal, a dot on the right of the emphasized character when the text direction is vertical.
I do not know OpenOffice Basic or other languages used to write computer programs, but I know the macro recorder of the Writer can record some codes which can be used to write the macro I need. And I keep googling to find more information and learn to write the macro. For most of the punctuation marks, the codes are simple.
For example, to inset a stop mark, the codes are:
rem U+3002
sub cp01
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Text"
args1(0).Value = "。"
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
end sub
But the macro recorder of the LibreOffice 3.4 failed to record a workable macro for the emphasis mark. Actually the Writer closed unexpectedly as soon as I change the emphasis mark from "(Without)" to "Dot" in the Font Effects of the Character Dialog Box of the Writer. I was forced to download and install OpenOffice.org 3.3 and 3.4.
The macro recorder of the OpenOffice.org 3.3 also cannot record, but the one of the 3.4 did it. The macro is:
sub Test20120206_1
rem --------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem -------------------------------
dispatcher.executeDispatch(document, ".uno:EmphasisMark", "", 0, Array())
end sub
This macro do not work.
ñ? Or are you writing something where you need to designate emphasis on a syllable? – Raystafarian Feb 7 at 13:01