We are upgrading Aspose.PDF for .NET version from v17.11.0 to v19.9.0 .
We have a table within the pdf that contains table cells with colspan property. On calling table class GetWidth method, It adds extra cells based on the colspan value of the cell. It is as expected. But When we update the text of the original cell it does not update/modifies the cell text in the entire colspan.
Code Sample:
static void testCellTextUpdate()
{
var pdfDoc = new Aspose.Pdf.Document();
var page = pdfDoc.Pages.Add();
page.SetPageSize(612, 792);
page.PageInfo.Margin = new MarginInfo(27, 27, 27, 27);
var table = new Aspose.Pdf.Table();
table.ColumnWidths = "45 45";
table.DefaultCellPadding = new Aspose.Pdf.MarginInfo(1.44, 1.44, 1.44, 1.44);
table.Border = new BorderInfo(BorderSide.All, 1, Color.Black);
var row = table.Rows.Add();
var cell = row.Cells.Add("This is a very long string that shouldn't fit inside of the cell, we don't want it to wrap");
cell.IsWordWrapped = false;
cell.ColSpan = 4;
row.Cells.Add("Another long string that is word wrapped"); // cell2
table.GetWidth();
var textCell = table.Rows[0].Cells[0].Paragraphs[0] as TextFragment;
textCell.Text = "updated text";
foreach (Row tableRow in table.Rows)
{
for (var i = 0; i < tableRow.Cells.Count; ++i)
{
var tableCell = row.Cells[i];
Console.WriteLine((tableCell.Paragraphs[0] as TextFragment).Text);
}
}
page.Paragraphs.Add(table);
pdfDoc.Save("CellTextUpdated.pdf");
}
CellTextUpdated_v17.11.0_output.pdf (30.8 KB)
CellTextUpdated_v19.9.0_output.pdf (36.3 KB)