Having truoble trying to grab a run property using run.getRunPr()

I’m using Aspose.words version 3.3 and I have word document that has highlighted text and I’m trying to grab the run property. I’m having trouble trying to grab it with this method.
run.getRunPr()
Can someone show me how to use this method or another way to grab the propery the xml of the word document is below.

<w:r w:rsidRPr="006C2375">
	<w:rPr>
		<w:highlight w:val="red"/>
	</w:rPr>
	<w:t>which</w:t>
</w:r>

Hi

Thanks for your inquiry. In your case, you should use Font.HightlightColor:
https://reference.aspose.com/words/java/com.aspose.words/font/#setHighlightColor-java.awt.Color

Hope this helps.

Best regards,

AndreyN,
I want to use Font.HighlightColor to grab the color but is there a way to only grab the color if it’s highlighted.

Hi

Thanks for your inquiry. I think in this case you can try using the following code:

if (!run.getFont().getHighlightColor().equals(new Color(0, 0, 0, 0)))
    System.out.println(run.getFont().getHighlightColor());

Best regards,

AndreyN,

if I create a java color object from Font.getColor() method and that color object contains these values
java.awt.Color[r = 255, g = 0, b = 0]

Can you tell me which Color method I would use to get all those values an can you show me a code example.
thanks

Hi

Thanks for your inquiry. In this case, you can try using the following piece of code:

System.out.printf("R=%d \nG=%d \nB=%d \nA=%d \n",
    color.getRed(),
    color.getGreen(),
    color.getBlue(),
    color.getAlpha())

Please feel free to ask if you have any further queries.
Best regards,