Hi,
I have a grid where a user can hide/show columns using the FieldChooser (using the ShowColumnChooser). I now want to export to excel the visible columns. In order to do this I have implemented the following event handler:
private void ultraGridExcelExporter1_CellExporting(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.CellExportingEventArgs e)
if (e.GridColumn.Hidden == true) e.Cancel = true;
e.Cancel = true;
}
This doesnt seem to work and exports all columns including the hidden ones. What is the correct solution? What property does the Field chooser change to make the grid columns visible and invisible?
Using version 5.3....
Thanks in advance
My best guess is that you are modifying the export layout somehow to make the columns visible. Maybe you are creating a new layout somewhere? Or using BeginExport and modifying the layout passed in?
Or this could be a bug, but that seems pretty unlikely, since someone would have noticed it by now. Are you using an old version of the grid?
Mike,
Unfortunately thats exactly what I am saying. Do you any idea what might be wrong?
Regards
You should not have to do anything to prevent hidden columns from exporting. This should happen automatically. You are saying that you have hidden columns in your grid and that when you export to Excel, the hidden columns are being exporting? If that's the case, something is wrong.
Hi
I too have managed to implement this in another grid where I haven't enabled the field chooser and manually set the hidden property of the column. Then the CellExporting eventhandler seems to work fine. The problem seems to when you use the field chooser and that why I would like to find what property it sets to hide/show the column.
Thanks
I've implemented exporting the grid (as seen on screen, hidden bands and columns not exported) using:
ultraGridExcelExporter1.Export(uGrid, exportFileName);
this appears to have been around since 5.1...though i've only used it since 7.
if you look to http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=10038 (article for export WITH hidden columns)
'Use the UltraGridExcelExporter’s Export method to export the WinGrid. Handle the BeginExport event of the UltraGridExcelExporter and unhide ny columns you want. Save the sheet to a local directory on the machine.'