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

Free Support Forum - aspose.com

How to delete cell content?

Hi,
I don’t want to delete a cell, I just want to remove the content in a certain cell. I am not able to find the code to do that. Any help is very much appreciated!

Hi
Thanks for your inquiry. The code is pretty simple. Please see the following code:

// Open document
Document doc = new Document(@"Test144\in.doc");
// Get some table from the document, for example first one
Table tab = doc.FirstSection.Body.Tables[0];
// Get some row from the table
Row row = tab.Rows[1];
// Get some cell from the row
Cell cell = row.Cells[3];
// Remove all content from the cell
cell.ChildNodes.Clear();
// Save output document
doc.Save(@"Test144\out.doc");

Hope this helps.
Best regards.