>>>>HI
>>>>
>>>>I'm using aspose.cells to export some data to excel.
>>>>
>>>>The site uses excel2003 so I need to cater for more than 65000 rows being in the datatable.
>>>>
>>>>The datatable is created by a stored procedure.
>>>>
>>>>Any thoughts on my best option.
>>>>
>>>>Is there any way I can access parts of the datatable ?
>>>>
>>>>the Import is statement is
>>>>
>>>> myWorksheet.Cells.ImportDataTable(dtData, True, "A1")
>>>
>>>You mean you want to be sure of not attempting to import more the 65K rows ?
>>>I've not used aspose but it looks as if there are overloads to ImportDataTable() that lets you specify the number of rows. e.g:
>>>
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/aspose.cells.cells.importdatatable_overload_8.html>>
>>Hi Viv
>>
>>that allows me to restrict the number of rows imported but not set the start point in the datatable.
>>
>>Do you know off hand is it possible to read in part of a datatable. So I could set the start point in the data import and the number of rows I want
>
>I see there's a Cells.ImportDataRow() method but I'd imagine calling that repeatedly might be slow. You could, I suppose, create a temporary table to pass to the ImportDataTable(). Ugly but would work:
public DataTable GetPartTable(DataTable dt, int start, int rowCount)
> {
> int stop = start + rowCount;
> DataTable CloneTable = dt.Clone();
> for (int i = start ; i< stop ; i++)
> {
> CloneTable.ImportRow(dt.Rows[i]);
> }
> return CloneTable;
> }
Then:
DataTable tmp = GetPartTable(OriginalTable, 0, 65656);
(Needs some parameter checking.....)
Do you think using a DataReader be better ?