Free Support Forum - aspose.com

Can a an entire row be deleted if it has null values?

Hi,

I am looking at a scenario where there are mutliple rows in a table which are obtained as a result of multiple elements in the datasource. But, in a row, the all the values are blank or null. Is there a possibility for this row with null values to be deleted programmatically? Is there a method like deleteRow() which can do this?

Thanks in Advance!

Regards
Pavithra V S

Hi

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

Thanks for your inquiry. You can remove any node from the document. There is method Node.Remove(), which removes the node. For example see the following code:

// Open document.

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

// Get some row (in this case I get row,where some bookmark is located).

Node row = doc.Range.Bookmarks["mybk"].BookmarkStart.GetAncestor(NodeType.Row);

// Remove row.

if (row != null)

row.Remove();

// Save ouput document.

doc.Save(@"Test001\out.doc");

Hope this helps.

Best regards.