I want to clear texture for all my document
I tried to use BackGroundColor and TextBackGroundColor for TextRange but only ranges with text are ok, everything else stays with grey.
In word document, we used : wdTexture10Percent, wdTexture30Percent
Thanks
My code :
- Code: Select all
public static void RemoveTexture(this Document docBlobRtf)
{
docBlobRtf.Background.Type = BackgroundType.Gradient;
docBlobRtf.Background.Gradient.Color1 = Color.White;
docBlobRtf.Background.Gradient.Color2 = Color.White;
docBlobRtf.Background.Color = Color.White;
foreach (Section section in docBlobRtf.Sections)
{
foreach (Paragraph para in section.Paragraphs)
{
for (int i = 0; i < para.ChildObjects.Count; i++)
{
if (para.ChildObjects[i].DocumentObjectType == DocumentObjectType.TextRange)
{
(para.ChildObjects[i] as TextRange).CharacterFormat.TextBackgroundColor = Color.White;
(para.ChildObjects[i] as TextRange).CharacterFormat.HighlightColor = Color.White;
}
}
para.Format.BackColor = Color.White;
}
}
}