Set the color to every cell

In Word document How to set the color to every cell depending upon the
some condition when convert to PDF format? Is that possible on Word
document? Or possible in document Builder??Please give example or Link
for that? It is very urgent requirement. Send mail to me if possible. I
have searched all these on net. but i could not get it.

In Word document How to set the color to every cell depending upon the some condition when convert to PDF format? Is that possible on Word document? Or possible in document Builder??Please give example or Link for that? It is very urgent requirement. Send mail to me if possible. I have searched all these on net. but i could not get it.

This message was posted using Email2Forum by George Clark.

Hi,

Thanks for your inquiry. Sure, you can change the text formatting (color, font size, background-color etc) of each cell by using the following code:

Document doc = new Document(@"C:\Temp\in.docx");
Table tab = doc.FirstSection.Body.Tables[0];
foreach (Row row in tab.Rows)
{
    foreach (Cell cell in row.Cells)
    {
        cell.CellFormat.Shading.BackgroundPatternColor = Color.Red;
        foreach (Run run in cell.GetChildNodes(NodeType.Run, true))
        {
            Aspose.Words.Font font = run.Font;
            font.Size = 20;
            font.Bold = true;
            font.Color = System.Drawing.Color.Green;
            font.Name = "Verdana";
        }
    }
}
doc.Save(@"C:\Temp\out.docx");

I hope, this helps.

Best regards,