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

Free Support Forum - aspose.com

Removing Cells in table and extend with of row?


I am able to remove cells of a row in a table, but in doing so, my row is cut off. Is there a way to define the width of a certain row after deleting cells of that row?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. You should just add width of removed cell to some other cell in the row. For example see the following code:

//Open document

Document doc = new Document(@"Test134\in.doc");

//Get table form the document

Table tab = doc.FirstSection.Body.Tables[0];

//Get row from the table (for example the second row)

Row row = tab.Rows[1];

//Get cell that we would like t remove (for example the third one)

Cell cell = row.Cells[2];

//We should add width of that cell to some other cell for example the last one

row.LastCell.CellFormat.Width += cell.CellFormat.Width;

//remove cell


//Save output document


Hope this helps.

Best regards.