Remove highlight color in Words for Java

Hi!


Is there a way to remove highlighting from document?

Using a DocumentVisitor, I’m trying to set highlighting color to something that will disable highlighting :

currentRun.getFont().setHighlightColor(Color.XXX);

I found in .NET something like Color.Empty, but not in Java.

Thanks for your help!


Hi Marc,


Thanks for your inquiry. We are in coordination with product team to get answer pertaining to your queries. Soon you will be updated with the required information.

Best regards,

Hi Marc,

Thanks for being patient. Java has not straight equivalent of Color.Empty. But, you can emulate it (inside Aspose.Words for Java) using java.awt.Color with all zeroes. For example, please see following code:

Document doc = new Document(getMyDir() + “in.docx”);

for (Run run : (Iterable<Run>) doc.getChildNodes(NodeType.RUN, true))

{

run.getFont().setHighlightColor(new java.awt.Color(0, true));

//run.getFont().setHighlightColor(new java.awt.Color(0, 0, 0, 0));

}


doc.save(getMyDir() + “15.5.0-awjava.docx”);

I hope, this helps.