Populate large data to Execl

  • Thread starter Thread starter Venkatzeus
  • Start date Start date
V

Venkatzeus

Guest
Hi.

I am trying to transfer multiple data tables ( 20 + data tables) to Excel. Each data table contains 10000 rows and 255 columns.

I have used the below code in Visual studio 2010 , C#, web based application.


XLWorkbook wb = new XLWorkbook();
DataSet ds = new DataSet();
string destpath = @"C:\test.xlsx";

try
{
ds = GetDatafromDatabase();

int TableCount = ds.Tables.Count;
for (int i = 0; i < TableCount; i++)
{
DataTable dt = ds.Tables;
wb.Worksheets.Add(dt);
dt.Dispose();
}
ds.Dispose();
wb.SaveAs(destpath);
}
catch (Exception ex)
{
throw ex;
}

Each data table should be added as separate sheet.


I am getting the Out of Memory exception. How to transfer data to Excel from C# Web application ?

Thanks

Continue reading...
 


Write your reply...
Back
Top