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

Free Support Forum - aspose.com

Cannot clear document's font

Hi
I'm trying to сlear the document (original doc) using a foreach loop on every cell, paragraph and run, because the ClearFormatting function clears everything I need.
The question is how to get rid of red fragments in the attached document (after the loop doc)?
My foreach loop (same for the paragraphs and runs):
Aspose.Words.Document doc = new Aspose.Words.Document(bin.ContentFilePath);
doc.AcceptAllRevisions();
foreach(Cell cell in doc.GetChildNodes(NodeType.Cell, true))
{
//	cell.CellFormat.Shading.ClearFormatting();
	cell.CellFormat.Shading.BackgroundPatternColor = System.Drawing.Color.White;
	Console.WriteLine(cell.CellFormat.Shading.BackgroundPatternColor.R.ToString() + " " + cell.CellFormat.Shading.BackgroundPatternColor.G.ToString() + " " + cell.CellFormat.Shading.BackgroundPatternColor.B.ToString());
}

Thanks!
Hi there,

Thanks for your inquiry. Please use following code example to get the desired output. Hope this helps you.

If you still face problem, please share your expected output document. We will then provide you more information about your query along with code.

Document doc = new Document(MyDir + "Original+doc.docx");

doc.AcceptAllRevisions();

foreach (Cell cell in doc.GetChildNodes(NodeType.Cell, true))

{

cell.CellFormat.Shading.BackgroundPatternColor = Color.Empty;

}

doc.Save(MyDir + "17.5.docx");