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

Save the results of the command to a package

Apr 28, 2012 at 10:02 AM

Hi, how can I save the results of the command to a package?


 SqlDataAdapter da = new SqlDataAdapter(command);
                DataSet ds = new DataSet();

                FileInfo newFile = new FileInfo(@"C:\Test.xlsx");

                OfficeOpenXml.ExcelPackage package = new ExcelPackage(newFile);

                ExcelWorksheet ws = package.Workbook.Worksheets.Add("Content");

May 2, 2012 at 6:17 PM


Use the ws.Cells["A1"].LoadFromDataTable method (to start loading in cell A1), using the datatable in your dataset.