We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Need to merge column data while Exporting Data from WinForms app to Excel

Hello Guys,

Here I need to know is there any way I can perform merging of cells during exporting Data from DataTable to Excel File.
I know how to export it but I want to get the results in very specific way.
Please check the following screen shot :

This is what my actual data looks like if i export it to excel using Syncfusion tools.

But what it want to do is as follow :

So as you can see I've merge those records manually but  I want to merge certain columns by the InvoiceID.
Is there any way we can do it pragramatically while exporting data to excel?

Thank You.

3 Replies

SS Sridhar Sukumar Syncfusion Team August 31, 2017 04:14 PM UTC

Hi Dhairya, 
Thank you for contacting Syncfusion support. 
Your requirement cannot be achieved while importing data table to Excel in XlsIO. However, you can achieve your requirement by workaround in XlsIO. We have shared you a simple sample which can be downloaded from the following link 
Sample link: 
Please let us know if you have any concern. 

DJ Dhairya Joshi September 5, 2017 04:17 AM UTC

Hello Sridhar Sukumar,

Sorry for late reply and the code did you gave me did worked, but there is a little bug in it.

If any invoice is have more then 3 items then it does not merge it.

For example if any invoice is having 4 items then 4th item will be displayed as new row rather then merging it with existing list.

Please check the following screen shot for better understanding, the code is same as you gave but id made DLL for same so that i can use it anywhere.

And following is the Windows Class Library Project code :

Please do let me know what i can change to make it correct and as always thank you so much for this help as well ! :)

SS Sridhar Sukumar Syncfusion Team September 6, 2017 12:20 PM UTC

Hi Dhairya,  
Thank you for updating us. 
We have modified the sample to achieve your requirement and the sample can be downloaded from the following link. 
Sample link:  
Please let us know if you have any concern.  

Live Chat Icon For mobile
Up arrow icon