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

Free Support Forum - aspose.com

Feature Request: Limit rows imported to stay within the max number of rows allowed on an Excel worksheet

I would like to request a feature that will force WorkbookDesigner.setDatasource/process and/or Cells.importXYZ to not exceed the max. number of rows allowed on an Excel Worksheet. Obviously, the API would required the FileFormatType so Aspose.Cells could determine if the max is 65536 rows or 1048576 rows.

Right now I am "emulating" this kind of functinality using a custom AsposeDataTable and a wrapper class for java.sql.ResultSet that allows me to set a "stop" record number, but its not a clean work around.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

We have registered your required feature in our internal issue tracking system with issue id CELLSJAVA-13448. We will look into the feasibility of the feature and get back to you soon.

Thank you & Best Regards,


For Cells.importResultSet(...) methods, I think you can use:

int com.aspose.cells.Cells.importResultSet(ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown, String customDateFormatString, boolean convertStringToNumber)

to limit the number of rows to be imported.

To determine the maximum row count specified by FileFormatType, we will look into it later and try to provide a solution in later versions. Currently, we only limit the imported rows not to get exceeded to 1048576 rows by default. However, if you save the workbook as Excel97-2003 file format, we will not save those rows that are exceeded to 65536 into the file to make the generated xls file a valid file.

Thank you.

A similar setDatasource method should be added to WorkbookDesigner class. The existing setDatasource that has a "int cacheLimit" which isn't the same as "don't go past row # 65000".

For example, a worksheet will be populated by 3 large resultsets of unknown size, but probably 10,000 to 30,000 records each. So resultsets #1 and 2 will always fit on the spreadsheet. However, if the file is saved in the Excel 2003 format the data from resultset #3 will sometimes get cut off. This isn't desirable, because the data is lost and it presents an incorrect picture to the user. It would be preferrable to make sure WorkbookDesigner stopped at a specific row #. The programmer could have logic that would try to put the remaining ResultSet #3 data on a new worksheet.


We appreciate your ideas.

Well, we need to analyze your suggestion whether is it is feasible enough to be implemented or not. We will look into it and get back to you later.

Thank you.


Please try the attached version. We
now provide a new method to limit the imported records count:<o:p></o:p>

void com.aspose.cells.WorkbookDesigner.setDataSource(String dataSourceName, ResultSet rs, int cacheLimit, int recordLimit)

where the parameter "recordLimit" is to limit the records to be imported from ResultSet.

Hopefully, it will suit your need.

Thank you.

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

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