Border color not modified when changing Accent color

Hello,

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
}

theme_color_not_applied_on_border.zip (9.6 KB)

We are using Aspose 18.4.

Could you please fix this issue ?

Thanks a lot !

Alexis

@atapie,

Thanks for your inquiry. You are setting the color of theme. So, please get the color of theme as shown below.

com.aspose.words.Document doc = new com.aspose.words.Document(MyDir + "heading1_border_accent1_color.docx");
doc.getTheme().getColors().setAccent1(Color.YELLOW);
System.out.println(doc.getTheme().getColors().getAccent1());

If you want to get or set the border color of paragraph, please use ParagraphFormat.Borders as shown below.

doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat().getBorders().getBottom().setColor(Color.RED);
System.out.println(doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat().getBorders().getBottom().getColor());

Hello Tahir,

Thank you for your answer.

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.

Thank you,

Alexis

@atapie

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.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17840) have been fixed in this Aspose.Words for .NET 19.1 update and this Aspose.Words for Java 19.1 update.