Hi,
I'm using Xamdatagrid (v9.2) and ExcelExporter (v9.2) to export the grid data to excel. I need to export some of the hidden columns in the grid to excel. I've tried the following two approches.
1. Set the ExportOptions.ExcludeRecordVisibility = true, before calling ExcelExporter.Export.
2. Handle the BeginExport event of the ExcelExporter, and set the visibility of the collapsed columns to Visible explicitly in the event handler.
e.g. e.DataPresenter.FieldLayouts[0].Fields[0].Visibility = Visibility.Visible;
Neither of the above worked, and only visible columns were exported in both cases.
Please advise how I can get hidden columns to be exported?
Thanks,
Tess
Hello,
We have shipped out a new service release where your issue is resolved. I'd be glad to find out if you had tested it out and if it had met your requirements.
You can download the Service Releases by logging to our web site and going to My IG \My Keys and Downloads.
Thank you for using Infragistics Components.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
After further research the behavior that you described has been logged with our developers in our tracking system, with an issue ID of 75274. I have also created a support ticket on your behalf with number CAS-65112-8WJQ0T in order to link the development issue to it so that you would be automatically updated when a Service Release containing your fix is available for download.
The reason that the first approach does not work is that the ExcludeRecordVisibility property determines if each record's Visibility setting from the UI XamDataGrid is used within the report not the Fields’ Visibility settings.
The DataPresenterExcelExporter’s BeginExport fires at the beginning of the exporting process but the XamDataPresenter’s has been initialized that is why setting the Visibility property of the Field does not apply.
What I can suggest is to set the Visibility property for the hidden Fields that you want to export before calling the Export method of the DataPresenterExcelExporter. By doing so, the Fields with changed Visibility will be exported to your MS Excel file like:
xamDataGrid1.FieldLayouts[0].Fields[2].Visibility =
System.Windows.Visibility.Visible;
exporter.Export(xamDataGrid1, "Book1.xls", WorkbookFormat.Excel97To2003);
xamDataGrid1.FieldLayouts[0].Fields[2].Visibility = System.Windows.Visibility.Collapsed;
If you require any further assistance on the matter please do not hesitate to ask.
Infragistics, Inc.