We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting row height after inserting a cell

Split.zip (78.2 KB)

attached is the code.
I am adding a row, splitting a cell, then deleting the original row.

before I do the split, I save the row’s row format, then attempt to reset the row height after adding the cell, but something seems to not be working correctly.
included : result1.docx - after I add a new row to a table.
result.docx - after I split the cell in the new row.
expected.docx - what I want to see.


Thanks for your inquiry. If the last child is not a paragraph, Cell.EnsureMinimum method creates and appends one empty paragraph.

In splitCell method, please do not add the new paragraph to table’s cell to get the desired output.

for (int i = 0; i < (int)NumColumns; i++)
    newCell = (Cell)aCell.Clone(true);//new Aspose.Words.Tables.Cell(AsposeCell.Document); // create a new cell 
    aRow.InsertAfter(newCell, aCell); // add it after the original cell
    //newCell.AppendChild(new Paragraph(aDoc));// No need to use this line
    newCell.CellFormat.Width = dTargetWidth;

thank you, seems to be working much better now