Hi,
It seems the “.Clone” method, when used on a row inside a table, doesn’t copy the font formatting (bold, underlined, …) if the row contains no text. If the row contains formatted text the “.Clone” method will copy the text with its formatting intact, but if the row contains font formatting but no text the formatting will be lost. Is there a fast way to include the font formatting, which could differ for each cell inside the row, into the newly cloned row?
I’ll add a part of my code to clarify my question:
// Loop through rows
for (int i = 0; i <rows.Length; i++)
{
string row = rows[i];
// Split row into cells
string[] cells = row.Split(new char[]
{
'\
t'
});
Row NewRow = (Row) parentTable.LastRow.Clone(true);
for (int j = 0; j <cells.Length; j++)
{
run = new Run(doc, "This will be replaced in code");
if (j == (cells.Length - 1)) cells[j] = cells[j].Substring(0, cells[j].Length - 1);
run.Text = (string) cells[j];
parentTable.Rows[totalRows].Cells[j].Paragraphs[0].Runs.Add(run);
}
parentTable.Rows.Add(NewRow);
totalRows += 1;
}
parentTable.LastRow.Remove();
This code basicly fills a table with data.
Thanks in advance,
Aleix