I'm using Spire.doc v8.1.10
Loading A.docx
Get first table T in A.docx
T has 3 columns, 3 rows
first row : cells col:0 to col:2 are horizontally merged
I split cell (col:1,row:2) in 3 new cells
First row should (as in Word) span 5 columns in DOCX and PDF formats.
3 new cells should (as in Word) have same width in DOCX format.
surprisingly, they are in PDF format
All is correct if I split cell(col:2,row:2)
See attachment
- Code: Select all
public void DoBugSplitCell()
{
Document document = new Document("A.docx");
Table tbl = GetTables(document)[0];
tbl.Rows[2].Cells[1].SplitCell(3, 1);
document.SaveToFile("A1.docx", FileFormat.Docx);
Process.Start("A1.docx");
ToPdfParameterList toPdfParameterList = new ToPdfParameterList { UsePSCoversion = true };
document.SaveToFile("A1.pdf", FileFormat.PDF);
Process.Start("A1.pdf");
}
private List<Table> GetTables(Document document)
{
List<Table> result = new List<Table>();
foreach (Section section in document.Sections)
{
foreach (var item in section.Body.ChildObjects)
{
if (item is Table)
{
result.Add(item as Table);
}
}
}
return result;
}