This project has moved. For the latest updates, please go here.

Taking a lot of time to create an Excel file with data

Nov 2, 2012 at 9:33 AM

Hi,

First of all, i like the features of Ep Plus and would like to implement in my project. For a test scenario i tried the following sample in a simple console application. It is taking a lot of time. Will it works like that or i am missing something. please help me

The below example will add 10,000 rows for 10 columns

CODE:

 using (ExcelPackage package = new ExcelPackage(newFile))           

{                                          // add a new worksheet to the empty workbook               

ExcelWorksheet ws1 = package.Workbook.Worksheets.Add("Inventory"); 

 char[] alphabets = "ABCDEFGHIJ".ToCharArray();               

foreach (char ch in alphabets)                {                   

for (int i = 1; i < 10000; i++)                    {                       

string cellName = ch + i.ToString();                       

ws1.Cells[cellName].Value = "Sample Text";                       

ws1.Cells[cellName].Style.Font.Bold = true;     

              }           

  }               

// save our new workbook and we are done!             

  package.Save();                             

 Console.ReadKey();            }

 

Output: it is taking 29-30 seconds for this example. 

Resources:

running sample in VSTS 2010, core i5 processor with 8 gb Ram and Windows 7 64-bit operating system