Free Support Forum - aspose.com

Help?

I want to delete a row in word? but I don't know how to do it, deleterow()?


This message was posted using Page2Forum from RowFormat Property - Aspose.Words for .NET

Hi

Thanks for your inquiry. It is very easy; you should just find this table and row and call Remove method. Please note, each node has Remove method.

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.node.remove.html

For example, you can get table row, where bookmark is located and remove it. You can use the code like this:

// Open document.

Document doc = new Document("in.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

// Move DocumentBuilder cursor to the bookmark.

builder.MoveToBookmark("mybk");

// Get Row, where bookamrk is located.

Node row = builder.CurrentParagraph.GetAncestor(NodeType.Row);

// Remove row.

if (row != null)

row.Remove();

// Save output document.

doc.Save("out.doc");

Hope this helps.

Best regards,