Hi,
I have an UltraGrid with multiple bands in virtual mode. There are a large number of rows. When we export grid data to Excel, we want to the parent rows expanded in Excel if the corresponding parent rows are expanded on the UltraGrid. I tried to use event RowExported but it did not work. Can someone give me some suggestions please?
Your help is greatly appreciated!
Best Regards,Shaolin
Hi Shaolin,
Expanding parent rows in Excel based on their state in UltraGrid is a complicated requirement. There's no single expanded property for the parent row like there is in the grid. You have to set the Hidden property on each individual Excel row that is exported and that includes the blank row that is used as a separator, the header, and all the child rows. So this would require a lot of tricky work and you'd have to make some big assumptions about the height of each row, etc.
The below sample is created based on certain assumptions and you can refer to it for implementing the required expanded row functionality. First assumption is that Grid has only 2 levels (parent and child). If you have a third level in your Grid, this code would end up expanding the level 3 rows under any expanded root-level row. Second assumption is that each grid row is only one Excel row in height and that headers are also one row high.
Please review the attached sample and let me know if I may be of further assistance.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
Hi Sahaja,
Thanks for your response!
I will try to solve this issue myself.
Best regards,Shaolin
You can refer to WinFormsApplication15 sample that I attached in my previous response to implement the required expanded row functionality. If your Grid setup is different from what I described above then please elaborate on the details of your Grid setup and I will look into it to see if the expanded row functionality can be implemented with that Grid setup.
Please let me know if you have any questions.
Thanks for asking!
You sample code offered little use and your assumptions are not practical. Your code only worked for two levels and only a single parent row was open. I already solved my issue.