Aspose.cells lastdata cell of a particular data row

Hi, i am using

wb.getWorksheets().get(0).getCells().getRows().get(9).getLastCell().getColumn()

This returns me the column which is only colored and even if it does not contain any data.

I want to get last data column no of a particular data row. What shall i call?

Thanks & Regards,

Rohan Naik

Hi,

Thanks for using Aspose.Cells for Java.

I have looked into your issue and I found that there should be a property Row.LastDataCell to fulfill your needs.

So I have logged a New Feature Request for your issue with the id: CELLSJAVA-40333

However, there is a workaround, if the Cell’s value type is Null, then you should note down its column. Suppose it is column N, then you should iterate back to column 0 and check Cell’s type is Null or not. Keep iterating till Cell’s value type is not found to be Null

Javas


if (row.isBlank() != false) {


int lastColumn = row.getLastCell().getColumn();


while (lastColumn > 0 && row.get(lastColumn).getType() == CellValueType.IS_NULL) {

lastColumn–;

}//while

}//if

Hi,

Please try the new API: Row.getLastDataCell() with the new fix.

Please download and try this fix: Aspose.Cells for Java v7.3.2.1 and let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-40333) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.