Skip to main content Skip to footer

How to Export Group Headers and Outlines to Excel in FlexGrid

When saving a grouped FlexGrid (including grids with multiple grouping levels) to an Excel file using SaveGrid, you may notice that only the underlying data rows are exported while the group header rows and outlines are missing. Combining standard options like FileFlags.IncludeFixedCells or FileFlags.AsDisplayed does not include these row grouping headers by default.


Solution

To preserve group headers and maintain the row outlines when exporting to Excel, you must include the FileFlags.Outline flag in your SaveGrid method call.

By combining FileFlags.Outline with FileFlags.IncludeFixedCells using a bitwise OR operator (|), the grid will export both the fixed column/row headers and the entire group hierarchy along with its collapsible outlines.

// Export FlexGrid data including column headers and group outline headers to Excel
flexGrid.SaveGrid(dlg.FileName, FileFormatEnum.Excel, FileFlags.IncludeFixedCells | FileFlags.Outline);