The error shown is the following.
java.lang.IndexOutOfBoundsException: Index: 42, Size: 42
at java.util.ArrayList.rangeCheck(ArrayList.java:659)
at java.util.ArrayList.get(ArrayList.java:435)
at com.spire.doc.packages.sprlez.spr⇆╻(Unknown Source)
at com.spire.doc.collections.BookmarkCollection.get(Unknown Source)
at com.spire.doc.collections.CellCollection.spr┈┃—(Unknown Source)
at com.spire.doc.collections.CellCollection.removeAt(Unknown Source)
Below is the code I use to perform the cell deletion
- Code: Select all
Table table = this.getTableFromDocumentByName(tableName); // this line will get the table by table title
if(table != null) {
for(Object obj : table.getRows()) {
TableRow row = (TableRow) obj;
log.debug("count :: {}, index :: {}", row.getCells().getCount(), index);
row.getCells().removeAt(0);
}
}