I have a grid that I'm trying to export to a PDF file. For the exported PDF I want to apply a different layout to the grid during export. To do this I planned on adding logic to the grid InitializeLayout that would check for the flag and apply the proper layout properties.
My question is when/how is the InitializedLayout event triggered here. I was expecting that the Export method or something after the BeginExport would trigger a new InitializeLayout but that does not appear to be the case.
My current code to do the export looks like ...
...do some stuff
Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter tableExporter = new Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter
();
tableExporter.BeginExport += new EventHandler<Infragistics.Win.UltraWinGrid.DocumentExport.BeginExportEventArgs>(tableExporter_BeginExport
);
tableExporter.CellExported += new EventHandler<Infragistics.Win.UltraWinGrid.DocumentExport.CellExportedEventArgs>(tableExporter_CellExported
tableExporter.EndExport += new EventHandler<Infragistics.Win.UltraWinGrid.DocumentExport.EndExportEventArgs>(tableExporter_EndExport
tableExporter.RowExporting += new EventHandler<Infragistics.Win.UltraWinGrid.DocumentExport.RowExportingEventArgs>(tableExporter_RowExporting
tableExporter.Export(reportGrid, report);
... clean up
I also have a BeginExport event handler that adds a standard header/footer and page numbers and then returns. Perhaps there is something I should be doing in the BeginExport handler to trigger what I need.
Thanks
Neil
You can make changes to the layout in the BeginExport event handler by using e.Layout.
Thanks for the repoly. Is there any way to cause the defined grid initializelayout event to fire without resetting the data source (set it to null and then back to the original or something).
My problem with trying to do things in the BeginExport is that I have a general event handler in a class that does standard export setup. The method is passed a grid and puts standard header/footer stuff on it and then does the export based on type (Excel, PDF, etc.). This method does not have any knowledge of the grid it is handling or the layout required. The InitializeLayout event in the win form that holds the grid knows all that stuff so want I need to be able to do is figure out how ti invoke (or really, have the grid refire) initializelayout so that the proper method in the form that owns the grid is called.
From your response, I am guessing that there is no way to do what I need here.