Free Support Forum - aspose.com

DocumentBuilder.deleteRow fails on table number > 0

I'm trying to execute the following code:

Dim doc As Document = New Document("twoTables.doc")
Dim docBuilder As DocumentBuilder = New Aspose.Word.DocumentBuilder(doc)
docBuilder.DeleteRow(1, 0)


The file twoTables.doc [attached] consists of two tables separated by a page-breaking section break.

DocumentBuilder.DeleteRow works fine on the first table [index 0], but on the second table [index 1] I get the exception: "cannot find a table with the specified index".

Is the section break causing problems? If so is there a workaround to address tables in the document spread across sections? I need sections because headers vary.

Thanks.

-Charu

Charu Tevari
System Architect
Illustration Systems Development
John Han*** Life Insurance

Hi Charu,

Thank you for your interest in Aspose products.

You should move to the next section using DocumentBuilder.MoveToSection. Don’t forget that the index of the second table will then become 0.