Hi,
How do we split a table cell so that it does affect a change in the widths of columns of the previous or next row cells
Thanks,
Ashish
Hi,
How do we split a table cell so that it does affect a change in the widths of columns of the previous or next row cells
Thanks,
Ashish
Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-16508 in our issue tracking system. You will be notified via this forum thread once this feature is available.
We apologize for your inconvenience.
Thanks for your patience. Following code example shows how to split a table’s cell into three cell. We have attached the input and output document for your kind reference. Docs.zip (18.2 KB). Hope this helps you.
Document doc = new Document(MyDir + "in.docx");
// Get cell we need to split (lets split first cell for 3 cells)
Row row1 = doc.FirstSection.Body.Tables[0].FirstRow;
Cell cell1 = row1.FirstCell;
// Create two new cells
Cell cell11 = new Cell(doc);
Cell cell12 = new Cell(doc);
// Set widht (it will be original cell width / 3)
double newCellWidth = cell1.CellFormat.Width / 3;
cell1.CellFormat.Width = newCellWidth;
cell11.CellFormat.Width = newCellWidth;
cell12.CellFormat.Width = newCellWidth;
// Insert new cells
row1.InsertAfter(cell11, cell1);
row1.InsertAfter(cell12, cell11);
doc.Save(MyDir + "out.docx");