We use theme colors in style definitions to change text and border colors dynamically. When a new theme color is set, the text color is correctly updated but the border color remains the same.
In the following example, title_border_accent1_color.docx defines the style “Heading 1”. This style applies the Accent1 theme color to the text and to a bottom border.
Accent1 is set to blue.
When the document is opened and Accent1 is set to yellow, the text color becomes yellow but the border color remains blue :
@Test
public void theme_color_not_applied_on_border() throws Exception {
com.aspose.words.Document doc = new com.aspose.words.Document("heading1_border_accent1_color.docx");
doc.getTheme().getColors().setAccent1(Color.YELLOW);
doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat().getBorders().getBottom().getColor(); // KO : != Color.YELLOW
}
Actually I simplified my original problem but it probably doesn’t show enough about what is wrong.
We need to generate .doc files for our customers. If you save the document in .doc format in the example above, you will notice the text is yellow and the border is blue.
Here is the code (we run Aspose version 18.11) :
@Test
public void theme_color_not_applied_on_border() throws Exception {
com.aspose.words.Document doc = new com.aspose.words.Document("heading1_border_accent1_color.docx");
doc.getTheme().getColors().setAccent1(Color.YELLOW);
doc.save("export.docx"); // OK : text and border colors are yellow as required
doc.save("export.doc"); // KO : border color is still blue whereas it should be yellow
}
So I think there may be a bug in the way colors are applied to borders in .doc files.
Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17840. You will be notified via this forum thread once this issue is resolved.