Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Excel Export - Dataset tables to multiple worksheets
posted

I would like to export multiple tables from a dataset to Excel directly without the use of the WebGrid.  But if that's not possible, I would like to know how to export multiple worksheets to a single workbook.  I cannot find an example of either, and this is very surprising.  I can't imagine I'm the first to want to do this.  Any help would be greatfully appreciated!!!

 Ed

  • 44743
    posted

    There is no automatic way to export a tables from a dataset to Excel. You can export mulitple worksheets to a single workbook is you have mulitple grids:

    Workbook workbook = new Workbook();

    Worksheet sheet1 = workbook.Worksheets.Add("Sheet1");

    this.ultraGridExcelExporter1.Export(this.ultraGrid1, sheet1);

    Worksheet sheet2 = workbook.Worksheets.Add("Sheet2");

    this.ultraGridExcelExporter1.Export(this.ultraGrid2, sheet2);

    // ...

    workbook.Save("C:\\grids.xls");