Hello every body,
I'm trying to export a UltraWindGrid that has a Group in the top of the grid, but this group is not exported,
It's possible?
Exporting Groups and Levels to Excel is not currently supported. This is mainly because it's possible for columns in a group to overlap horizonally on different levels and there's really no way this can be done in Excel.
You can Submit a feature request to Infragistics.
It might be possible for you to insert the groups into the export using events like HeaderRowExporting. You could write out a row of group headers yourself and then add one to e.CurrentRowIndex so that the actual headers are exported under the group headers.
Here's my solution
static void _excelExporter_HeaderRowExporting(object sender, HeaderRowExportingEventArgs e) { if (e.Band.Groups.Count > 0) { var colIndex = e.CurrentColumnIndex; foreach (var gridGroup in e.Band.Groups) { var worksheetRow = e.CurrentWorksheet.Rows[e.CurrentRowIndex]; var visibleColumnCount = (from UltraGridColumn col in gridGroup.Columns.All where col.IsVisibleInLayout select col).Count(); var mergedRegion = worksheetRow.Worksheet.MergedCellsRegions.Add(e.CurrentRowIndex, colIndex, e.CurrentRowIndex, colIndex + visibleColumnCount -1); e.CurrentWorksheet.Rows[e.CurrentRowIndex].OutlineLevel = e.CurrentWorksheet.Rows[e.CurrentRowIndex - 1].OutlineLevel; e.CurrentWorksheet.Rows[e.CurrentRowIndex].Hidden = e.CurrentWorksheet.Rows[e.CurrentRowIndex - 1].Hidden; mergedRegion.Value = gridGroup.Header.Caption; var appData = new AppearanceData(); gridGroup.Header.ResolveAppearance(ref appData); mergedRegion.CellFormat.FillPattern = FillPatternStyle.Solid; mergedRegion.CellFormat.Font.Name = appData.FontData.Name; mergedRegion.CellFormat.Font.Bold = appData.FontData.Bold.ToExcelDefaultableBoolean(); mergedRegion.CellFormat.Font.Italic = appData.FontData.Italic.ToExcelDefaultableBoolean(); mergedRegion.CellFormat.Font.Height = (int)appData.FontData.SizeInPoints * 20; mergedRegion.CellFormat.Font.Color = appData.ForeColor; mergedRegion.CellFormat.FillPatternBackgroundColor = appData.BackColor; mergedRegion.CellFormat.FillPatternForegroundColor = appData.BackColor; // Alignment switch (appData.TextHAlign) { case HAlign.Center: mergedRegion.CellFormat.Alignment = HorizontalCellAlignment.Center; break; case HAlign.Left: mergedRegion.CellFormat.Alignment = HorizontalCellAlignment.Left; break; case HAlign.Right: mergedRegion.CellFormat.Alignment = HorizontalCellAlignment.Right; break; case HAlign.Default: mergedRegion.CellFormat.Alignment = HorizontalCellAlignment.Default; break; default: mergedRegion.CellFormat.Alignment = HorizontalCellAlignment.General; break; } colIndex += visibleColumnCount; } e.CurrentRowIndex++; } }