This is a migrated thread and some comments may be shown as answers.

Export GridView CommonGroupHeaders

2 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Renier Pretorius asked on 10 Sep 2015, 10:05 AM

Hi,

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).

Any thoughts?

2 Answers, 1 is accepted

Sort by
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 10 Sep 2015, 10:25 AM

UPDATE:

I have moved showing all columns to before calling the FileDialog for the destination and now it works as expected. So it seems like a timing issue.

While this addresses my workaround, ideally I would like not to export the empty columns but be able to keep the headers lined up

0
Stefan
Telerik team
answered on 15 Sep 2015, 08:47 AM
Hi Renier,

I am glad that you managed to find a resolution to the question from your first post.

As to your second requirement, we have it already logged in our Bug tracking system. You can track its progress in the Feedback portal: Add support for disabling the export of a particular column.

Do not hesitate to contact us in case you have any other questions on our controls.

Best Regards,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
Stefan
Telerik team
Share this question
or