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
1871
Issue exporting multiple grids.
posted

This is the logic I am using to create a workbook and then I save the workbook.

 

Infragistics.Excel.Workbook workBook = new Infragistics.Excel.Workbook();

 

ultraGridExcelExporter.Export(this.ultraGrid1, workBook.Worksheets.Add("Orders"));

ultraGridExcelExporter.Export(this.ultraGrid2, workBook.Worksheets.Add("POS Payment Totals"));

 

SaveFileDialog saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();

saveFileDialog1.DefaultExt = "xls";

 

saveFileDialog1.FileName = "Order Inquire Export on " + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Year;

 

saveFileDialog1.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";

saveFileDialog1.RestoreDirectory = true;

 

if (saveFileDialog1.ShowDialog() == DialogResult.OK)

{

workBook.Save(saveFileDialog1.FileName);

}

 

saveFileDialog1.Dispose();

saveFileDialog1 = null;

workBook.Worksheets.Clear();

 

The issue I an having is ultraGrid2 is in a dock manager and is set to auto hide. If the flyout comes out the grid is initialized and the export works great. However if I never open up the grid then nothing is ever exported to the worksheet.

Any suggestions on how I can make this work with or without showing the grid?

 

 

Parents Reply Children