I have gridview in which I added some common group headers to group the columns logically. Depending on the context some of these logical groups have no data and therefore I hide them in the UI (IsVisible=false on DataLoaded event). On exporting the grid to Excel (.ExportToXlsx method) the Group Headers does not line up with the relevant columns. I put this down to the hidden columns so my solution was to first show all the columns (IsVisible=true), do the export and then hide the relevant empty columns again. However, now none of the group headers are exported.
I capture the ElementExportingToDocument event and can see a CommonColumnHeaderRow element being exported but no CommonColumnHeaderCell element or the like (next element is HeaderRow).