How to Add Data another sheet and add data inside this sheet

How to Add Data another sheet and add data inside this sheet, using Aspose.cell in .net.

I have 70K rows using office 2003,
i want to keep 65 in one sheet and rest in another sheet, how we can do, pls share if you have any example.
Thanks
A-

Hi,


I think there is no automatic way to do that as you have to build your own logic and write your own code to accomplish your needs. For example if you have data in the table, you may use ImportDataRow method in a loop to individually import the records and when you would reach on some specific row, you may split the new record(s) into another sheet or so. I have created a simple sample code and you may refer to it so that you could write your own codes accordingly modifying my sample code accordingly. In the code, the first 65k rows are imported in the first sheet and the rest of the records are pasted into the second sheet as per your needs.

Sample code:

Workbook excel = new Workbook();
excel.Worksheets.Clear();
DataTable dt = new DataTable(“Products”);
dt.Columns.Add(“Col_ID”, typeof(Int32));
dt.Columns.Add(“Col_Name”, typeof(string));

for (int x = 0; x <= 70000; x++)
{
DataRow dr = dt.NewRow();
dr[“Col_ID”] = x;
dr[“Col_Name”] = “Data” + x.ToString();
dt.Rows.Add(dr);
}
int rownum = 0;
int i;
int row = 0;
int ct = 0;
Worksheet worksheet;

for (int cnt = 0; cnt <= 1; cnt++)
{
worksheet = excel.Worksheets[excel.Worksheets.Add()];
row = ct;
rownum = 0;
for (i = row; i <= row + 65000; i++)
{

if (i > 70000)
{
break;
}
else
{
worksheet.Cells.ImportDataRow(dt.Rows[i], rownum++, 0);
ct++;

}
}

}
excel.Save(“e:\test2\splitdatatest11.xls”);


Thank you.