I want to write an excel file (2007) with the codeplex excelpackage but it is taking a lot of time to write the excel file. I didn't find any method that it could accept a datasource.
the piece of my code:
var newFile = new FileInfo(GlobalVariables.Compare2007Path);
using (var excelpackage = new ExcelPackage(newFile))
{
var myWorkbook = excelpackage.Workbook;
myWorkbook.Worksheets.Add("sheetname");
var xlWorkSheet = xlWorkBook.Worksheets["sheetname"];
//loop the data and fill the columns
var rowCount = 2;
foreach (var compare in objCompare)
{
xlWorkSheet.Cell(rowCount, 1).Value = compare.adserverIdSite.ToString();
xlWorkSheet.Cell(rowCount, 2).Value = compare.site;
xlWorkSheet.Cell(rowCount, 3).Value = compare.adserverIdZone.ToString();
xlWorkSheet.Cell(rowCount, 4).Value = compare.zone;
xlWorkSheet.Cell(rowCount, 5).Value = compare.position;
xlWorkSheet.Cell(rowCount, 6).Value = compare.weekday;
xlWorkSheet.Cell(rowCount, 7).Value = compare.oldimps.ToString();
xlWorkSheet.Cell(rowCount, 8).Value = compare.olduu.ToString();
xlWorkSheet.Cell(rowCount, 9).Value = compare.oldimpsuu.ToString();
xlWorkSheet.Cell(rowCount, 10).Value = compare.newimps.ToString();
xlWorkSheet.Cell(rowCount, 11).Value = compare.newuu.ToString();
xlWorkSheet.Cell(rowCount, 12).Value = compare.newimpsuu.ToString();
xlWorkSheet.Cell(rowCount, 13).Value = compare.diffimps.ToString();
xlWorkSheet.Cell(rowCount, 14).Value = compare.diffimpsperc.ToString();
rowCount++;
}
excelpackage.Save();
}
Or are there other options besides excelpackage.