I’ve run into a small issue while evaluating Aspose Words 13.7.0
when I set the paragraph BackgroundPatternColor property to transparent it is displayed as white in the document.
here is example code:
Aspose.Words.Document doc;
Aspose.Words.Body body;
doc = new Aspose.Words.Document();
doc.PageColor = System.Drawing.Color.FromArgb(200,200,200);
body = doc.FirstSection.Body;
Aspose.Words.Paragraph p = new Aspose.Words.Paragraph(doc);
p.ParagraphFormat.Shading.BackgroundPatternColor = System.Drawing.Color.FromArgb(0,255,255,255);
p.AppendChild(new Aspose.Words.Run(doc,“test paragraph 1”));
body.AppendChild§;
p = new Aspose.Words.Paragraph(doc);
p.ParagraphFormat.Shading.BackgroundPatternColor = System.Drawing.Color.FromArgb(0,0,0,0);
p.AppendChild(new Aspose.Words.Run(doc,“test paragraph 2”));
body.AppendChild§;
p = new Aspose.Words.Paragraph(doc);
p.ParagraphFormat.Shading.BackgroundPatternColor = System.Drawing.Color.Transparent;
p.AppendChild(new Aspose.Words.Run(doc, “test paragraph 3”));
body.AppendChild§;
doc.Save(“testBackColor.docx”, Aspose.Words.SaveFormat.Docx);
The first paragraph and the third paragraph are displayed with white backgrounds in the document but I believe should be completely transparent as the ‘A’ color property is 0 and in the case of the third paragraph uses the .Net transparent named color. In fact the transparency value seems to be ignored anytime the RGB components are > 0. I’m not trying to use any transparency, it’s only really a problem because the .Net named color for transparency (System.Drawing.Color.Transparent) is not mapping to transparent in the document. So I have to be very careful not to use it and document the code for future reference. I think you should revisit how you determine transparency.