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

Free Support Forum - aspose.com

Problem adding rows to existing tables

Hi…I need to add rows to an existing table in a document but I’m getting compiler errors. What is the issue?

Code snippet:

Dim table As Table = CType(OFdoc.GetChild(NodeType.Table, 3, True), Table)

Dim row As Row = table.Rows(1)

row = CType(row.Clone(True), Row)


I’m getting a 'Value of type ‘Aspose.Words.Node’ cannot be converted to ‘System.Web.UI.WebControls.Table’ error on the first line as well as a ‘type row not defined’ errors on the second & third lines. Can you please help me? Thanks.

Hi Stephen,

Thanks for your inquiry. Your project uses Namespace ‘System.Web.UI.WebControls.Table’. Please import ‘Aspose.Words.Tables Namespace’ in your project.

You may use the following code to resolve this issue. Hope this helps you. Please let us know if you have any more queries.

Dim table As Aspose.Words.Tables.Table = CType(doc.GetChild(NodeType.Table, 3, True), Aspose.Words.Tables.Table)

Dim row As Aspose.Words.Tables.Row = table.Rows(1)

row = CType(row.Clone(True), Aspose.Words.Tables.Row)


Many thanks Tahir

Hi Stephen,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.