Ask Your Question
0

macro, highlight color, clear code for writer

asked 2018-03-08 14:41:26 +0200

needsleep gravatar image

I have a macro to highlight in red whatever text I have selected. In the Edit Macros function, I did a copy / paste of this macro, and renamed it, clear_text_highlighting.

The macro highlighting in red shows this coding: after getting access to the document, dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "BackColor" args1(0).Value = 16724787

What is the color code (Value) I want to use to clear the text highlighting?

Thanks,

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-03-08 15:09:30 +0200

paul1149 gravatar image

Sometimes on basic functions you can get your answer, or some good clues, by Recording a macro that does what you are trying to do. I just did so, and found this. You have to have Macro Recording turned on in the Options.

sub clear_highlighting
  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 = "BackColor"
  args1(0).Value = -1

  dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args1())
end sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2018-03-08 14:41:26 +0200

Seen: 73 times

Last updated: Mar 08 '18