Search code examples
excelmergegriddevexpress-windows-ui

Merge Cells in DevExpress VGridControl and Export to Excel


I want to do a simple merging of cells in a DevExpress VGridControl. The attached image shows exactly what I need. I have come across a lot of support tickets by DevExpress and all are redirected to just one link of Devexpress Sample E3019.

Firstly this is a very complex process, but even if I use this to merge cells in my VGridControl, the cells are not merged in the excel file when exported.

I had posted this question in the Devexpress Support Forum but did not get a positive reply on the same : https://www.devexpress.com/support/center/Question/Details/T392883

(Please do not confuse the VGridControl with GridControl - they are two different functionalities used for different purposes)

The below image exactly shows what I want to achieve

Merged cell view


Solution

  • I managed to get this functionality in place by first exporting the VGridControl to Excel and then reading the Excel file from C#. We can perform cell by cell operations and formatting using c# - refer the below link :

    http://csharp.net-informations.com/excel/csharp-format-excel.htm