In Writer, I recorded a simple macro to insert an en dash so that I can assign that to a key combination (Alt-n). However, when I use it, it uses the font the text was in when I recorded it.
-
How can I strip out the font information, so that the macro inserts a generic en dash in whatever font is in use at the point of insertion?
-
The macro I recorded is below, but I’m sure there’s a simpler, better version. Any suggestions appreciated.
sub enDash
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 ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = “Symbols”
args1(0).Value = “–”dispatcher.executeDispatch(document, “.uno:InsertSymbol”, “”, 0, args1())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, “.uno:InsertSymbol”, “”, 0, Array())