After calling SetColumnTextState() with a new TextState that has a ForegroundColor set, I am noticing that table.Rows[RowIndex].Cells[ColIndex].DefaultCellTextState.ForegroundColor is always #000000. It seems that table.Rows[r].Cells[c].DefaultCellTextState.ForegroundColor is never updated unless the ForegroundColor property is explicitly set at the cell level. The following code shows this:
var doc = new Document();
var page = doc.Pages.Add();
//Instantiate a table object
var asposeTable = new Table {Broken = TableBroken.Vertical};
//Add the table in paragraphs collection of the desired section
page.Paragraphs.Add(asposeTable);
//Set with column widths of the table
asposeTable.ColumnWidths = "100";
//Add header Row
var headerRow = asposeTable.Rows.Add();
headerRow.Cells.Add("header 1").BackgroundColor = Color.LightCoral;
for (var rowCounter = 0; rowCounter <= 5; rowCounter++)
{
//Create rows in the table and then cells in the rows
var row1 = asposeTable.Rows.Add();
row1.Cells.Add("col " + rowCounter.ToString() + ", 1");
}
var newTextState = new TextState();
newTextState.ForegroundColor = Color.Aqua;
asposeTable.SetColumnTextState(0, newTextState);
Console.WriteLine("foreground color: " + asposeTable.Rows[0].Cells[0].DefaultCellTextState.ForegroundColor);
doc.Save("BrokenWideTableColSpans.pdf");
In this code, #000000 is always logged to the console for me, even though the actual PDF that is generated has Aqua text.
What is the recommended way to retrieve the true ForegroundColor of the DefaultCellTextState of a cell after SetColumnTextState() has been called? If there is no way to do so, could you please expose the true value of this property somehow?