We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Change Background Pattern Color for Font Shading of Character Style in Word DOCX Document | Java

Hello!

We have a custom character style called Change and we need to use Aspose.Words to change the background color.

In the Word UI, you do this in the character style on the Modify Style dialog: select Format > Border; the Borders and Shading dialog appears. On the Borders and Shading dialog, select Shading and set a color in the Fill field.

How might this be done in Aspose.Words for Java?

Thanks!

@jonathan.piasecki,

You can specify background pattern color for font shading object of a character style in Word DOCX document by using the following code of Aspose.Words for Java API.

Document doc = new Document("C:\\Temp\\Character Style.docx");

Style characterStyle = doc.getStyles().get("Change");
characterStyle.getFont().getShading().setBackgroundPatternColor(Color.YELLOW);

doc.save("C:\\temp\\awjava-21.8.docx");

Hello –

This worked. Thanks very much!

Thanks – Jonathan Piasecki

1 Like