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

Free Support Forum - aspose.com

Issue in ForegroundPatternColor

I am using following code


This is not working.
Where as


This works properly.

So it is limitation or known bug that setForegroundPatternColor will not work?
I am using Aspose Words

Hi Amey,

Thanks for your inquiry. First, I would suggest you please upgrade to the latest version of Aspose.Words i.e. 13.4.0. You can download it from the following link:

Secondly, to test your scenario, please try run the following code snippet:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set paragraph borders
BorderCollection borders = builder.getParagraphFormat().getBorders();

// Set paragraph shading
Shading shading = builder.getParagraphFormat().getShading();

builder.write(“I’m a formatted paragraph with double border and nice shading.”);


I hope, this helps.

Best regards,
H Awais,
Thanks for your response.
I can not upgrade to latest version since i have license cost issues.
1:So can you confirm me if this is bug in older version & which have been fixed in 13.4.0?
2:Example which you have specified is adding ForegroundPattern in ParagraphFormat's shadings object where as i want it for cell.
3:Is it something like that we can not use same for cellformat or it is bug & any workaround for same available?
4:setBackgroundPatternColor perfectly works in cellformat's shading just setForegroundPatternColor is not working.

Hi Amey,

Thanks for the additional information and sorry for the confusion. Please use the following code instead to be able to specify the color that’s applied to the foreground of the Shading object.
Cell firstCell = table.getFirstRow().getFirstCell();
I hope, this helps.

Best regards,