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
180
Excel Exporter not exporting
posted

Hi,

I want to export data from multile tables to the same workbook. But this is from a console application i.e. the grid is not on a form. The export does not work even if the tables have rows. The file has only the empty worksheets.

UltraGrid grid = new UltraGrid();

UltraGridExcelExporter excelExport = new UltraGridExcelExporter();

Report.Init();

 

DataSet dataSet = new DataSet();

//....adding 4 tables to the dataset and filling in with data

 

Workbook wb = new Workbook();Worksheet ws = wb.Worksheets.Add("Entitlements");

grid.DataSource = dataSet.Tables[0];

excelExport.Export(grid, ws);

grid.DataSource = dataSet.Tables[1];

ws = wb.Worksheets.Add(
"Resource Groups");

excelExport.Export(grid, ws);

grid.DataSource = dataSet.Tables[2];

ws = wb.Worksheets.Add(
"Action Groups");

excelExport.Export(grid, ws);

wb.Save(ConfigurationManager.AppSettings["E3_REPORT_FILE"]);

Parents
  • 37774
    Verified Answer
    posted

    While I am not familiar with the ExcelExport functionality as much, I'm guessing that your issue is that the grid doesn't have any rows even before you try to export it.  Since the grid is not on a form, it doesn't have a binding context available to it to acquire the various data through the BindingManager, so try assigning a new BindingContext object to the grid after you create it.

    -Matt

Reply Children
No Data