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
1320
Exporting an UltraGrid with an UltraGridExcelExporter
posted

Hello Everybody!

In a project I have an UltraGrid with an UltraDataSource and an UltraGridExcelExporter.
The export of the whole grid is working fine with the UltraGridExcelExporter and I can see all UltraGrid rows and columns later in Excel.
I need to hide some columns during the exporting process, so that this columns are not exported to the excel sheet anymore.

I have tried two approaches:

1) With the ExportStarted event of the UltraGridExcelExporter control

ExportStarted( object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExportStartedEventArgs e )
Workbook hWorkbook = e.Workbook;
if( hWorkbook != null )
   {
   Worksheet hWorksheet = hWorkbook.WindowOptions.SelectedWorksheet;
   if( hWorksheet != null
     {
     hWorksheet.HideColumns( 0, null );
     }
   }

But does not suppress the column with the index 0 in the excel sheet.
It looks like that the Worksheet is only prepared and not filled in with any data at this event.

2) With the InitializeColumn event of the UltraGridExcelExporter control

InitializeColumn( object sender, Infragistics.Win.UltraWinGrid.ExcelExport.InitializeColumnEventArgs e )
UltraGridColumn hCol = e.Column;
if( hCol.Key == "Column0" )
  {
  hCol.Hidden = true;
  }

This does also not hide the column with index 0 in the excel sheet.
Has anybody an idea how a suppressing of one or more columns during the excel export can be achieved?
Thank you for any help!

Best regards
Frank