Hello, theres,
I’m using aspose.cells (7.0.2). When I call Cells.ImportDataView to import more than 80000 records,
The output excel is xlsx format, but only 65535 rows in the sheet. What’s the problem ?
Any idea ?
Regards,
agichen
Version7.1.2 doesn’t work. Please Help
my sample code
using System;
using System.Data;
using Aspose.Cells;
namespace TestAspose
{
internal class Program
{
private static void Main(string[] args)
{
try
{
var workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add(“Test65535”);
var dv = new DataView();
DataSet ds = CreateDemoDataSet();
Cells cells1 = worksheet.Cells;
dv = ds.Tables[0].DefaultView;
worksheet.Cells.ImportDataView(dv, cells1[“A1”].Row, cells1[“A1”].Column, true);
workbook.Save(“MyExcel.xlsx”);
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
///
/// create a dataset contains 80000 integers
///
///
private static DataSet CreateDemoDataSet()
{
var ds = new DataSet();
DataTable dt = ds.Tables.Add();
//-- Add columns to the data table
dt.Columns.Add(“ID”, typeof (int));
//-- Add rows to the data table
for (int i = 0; i < 80000; i++)
dt.Rows.Add(i);
return ds;
}
}
}
Hi,
Please try creating the workbook object in Xlsx format using the following code and see if it works.
i.e
var workbook = new Workbook(FileFormatType.Xlsx);
Let us know if problem still occurs.
Dear Sir,
It doesn’t work. Any idea ?
Regards,
agichen
Hi,
I can see the issue as you have mentioned by using your sample code. It only fetches 65536 rows == XLS file format capacity, although I am saving to XLSX file format.
For your case and for the time being, please use ImportDataTable() method instead which is more powerful and efficient regarding performance. See the changed code below that works fine for your need.
Sample code:
.................
var workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add("Test65535");
var dt = new DataTable();
DataSet ds = CreateDemoDataSet();
Cells cells1 = worksheet.Cells;
dt = ds.Tables[0];
worksheet.Cells.ImportDataTable(dt,false, cells1["A1"].Row, cells1["A1"].Column, true);
workbook.Save("e:\\test2\\MyExcel_1.xlsx");
...............
private static DataSet CreateDemoDataSet()
{
var ds = new DataSet();
DataTable dt = ds.Tables.Add();
//-- Add columns to the data table
dt.Columns.Add("ID", typeof(int));
//-- Add rows to the data table
for (int i = 0; i < 80000; i++)
dt.Rows.Add(i);
return ds;
}
I have also logged a ticket for the issue regarding ImportDataView method with an id:
CELLSNET-40471. We will look into it soon.
Thank you.
Hi,.
We have fixed this issue. Please download and try this fix: Aspose.Cells for .NET v7.1.2.1
The issues you have found earlier (filed as CELLSNET-40471) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.