Hello,
I am receiving the error:
Unable to cast object of type ‘Aspose.Words.BookmarkStart’ to type ‘Aspose.Words.Tables.Cell’
when trying to see if a cell in a table contains text. I have the following code snippet to provide some context:
doc.UpdateFields()
Dim tables As Node() = doc.GetChildNodes(NodeType.Table, True).ToArray()
Dim table As Tables.Table = DirectCast(tables(0), Tables.Table)
Dim rowToRemove As New ArrayList()
For Each row As Tables.Row In table.Rows
Dim emptyrow As [Boolean] = True
For Each cell As Tables.Cell In row
If cell.GetText.Trim <> "" Then
emptyrow = False
End If
Next
If emptyrow = True Then
rowToRemove.Add(row)
End If
Next
For Each row As Tables.Row In rowToRemove
If row IsNot Nothing Then
row.Remove()
End If
Next
Any ideas why this may be happening? I am using Aspose.Words version 21.2 if that helps in any way.
Thanks,
Trevor