I'm trying to Export an UltraGrid which includes hidden rows, and I want the hidden grid rows to display on the Excel export. I'm using the Exporter_InitializeRow event as follows:
Infragistics.Win.UltraWinGrid.UltraGrid grid = (Infragistics.Win.UltraWinGrid.UltraGrid)e.Row.Band.Layout.Grid;
Infragistics.Win.UltraWinGrid.UltraGridRow onScreenRow = grid.GetRowFromPrintRow(e.Row);
if (onScreenRow.Hidden) { e.Row.Hidden = false; }
The hidden rows are not showing in Excel. I also tried to additionally select the e.Row What do I need to do?
Thanks,
Ron
Hi Ron,
Regarding hiding the rows (or rather, not hiding the rows in the exported Excel sheet), my guess is that the grid's InitializeRow event is firing for the rows and re-hiding them after you un-hid them in the InitializeRow event of the Exporter. So a much easier way to acheive what you want is to simply update your grid's InitiailzeRow handling to NOT hide the rows when exporting.
To determine whether the InitializeRow is firing for an export row or an on-screen row, you can do this:
e.Row.Band.Layout.IsExportLayout
Okay got it work with _ExportEnded code moved to the ExportEnding event.
I should mention that these are parent-child row that I want to expand in the spreadsheet. Thanks,
Okay, now that that is working I'm trying to get the Excel spreadsheet to expand all rows. I'm using Exporter_ExportEnded event and it's not working.
private void ultraGridExcelExporter1_ExportEnded(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExportEndedEventArgs e)
{
foreach (Infragistics.Documents.Excel.WorksheetRow row in e.CurrentWorksheet.Rows)
row.Hidden = false;
}