0

Currently I'm working with ExcelLibrary.dll The problem with ExcelLibrary is that it makes corrupt excel files if data is less or excel size is less than 6kB. So I am switching to EPPlus dll. Currently my code is:

        DataSet dsNewDataSet = new DataSet();
        string tempTbl = "SELECT * FROM EngineersDetail ORDER BY 3,1";
        SqlCommand commandOpen = new SqlCommand(tempTbl, conSql);
        SqlDataAdapter adpUpdRow = new SqlDataAdapter();
        adpUpdRow.SelectCommand = commandOpen;
        adpUpdRow.Fill(dsNewDataSet , "table");

        //Create Excel worksheet from the data sets
        ExcelLibrary.DataSetHelper.CreateWorkbook("C:/Engineer-wise Performance Report/Engineer-wise Performance Report.xls", dsNewDataSet );

This is a sample code. It selects data from the table EngineersDetail and fill in the DataSet dsNewDataSet, which then dumps data into an excel file. I later retrieve this excel file generated to send as an attachment in a mail.

Now I want to shift this code completely to EPPlus library code.

Sameep Baxi
  • 111
  • 1
  • 4
  • 17
  • If you want to stay with ExcelLibrary, there is an easy way to prevent corruption of small files: http://stackoverflow.com/questions/8107610/cant-open-excel-file-generated-with-excellibrary -- sometimes it's easier to fix the problems you've got than to run out and find yourself a bunch of new ones. – Shannon Holsinger Sep 06 '16 at 08:35
  • you can ref this http://www.codeproject.com/Articles/680421/Create-Read-Edit-Advance-Excel-Report-in – kcwu Sep 06 '16 at 08:38

0 Answers0