Free Support Forum - aspose.com

Handling > 65-536 Rows

I am currently evaluating various tools that would allow us to create Excel spreadsheets from within our ASP.NET application.

I’m trying to determine how I might handle a situation where I want to use ImportDataTable (or ImportFromDataReader) to import a DataTable (or SqlDataReader) where the source contains > 65,536 rows (the maximum that can be put into a worksheet).

I’ve created a test case and am trying to use the following form of the method:

public int ImportDataTable(
DataTable dataTable,
bool isFieldNameShown,
int firstRow,
byte firstColumn,
int maxRows,
int maxColumns
);

However, the following lines of code is giving me an ArgumentOutOfRangeException, but unfortunately isn’t telling me which argument is the problem.

int j = cells.ImportDataTable( dt, true, 1, 1, 10, 10 );

Any suggestions on the specific problem I’m having, and the more general question of handling DataTables with > 65,536 rows?

This exception is caused by the rows of data in your DataTable exceeding 65536. I will shape the ImportDataTable method when meeting DataTables with > 65536 rows.