devexpress multiple gridview export to excel in Single File winforms

22 Apr

After two much searching of this solution to export multiple gridview data to single Excel file with separate Sheet of Excel.

Then i find this solution which resolve my problem. this is 100% tested and use in my project . after that i share with you in both language c# and


 Solution :: Vb.Net

Imports DevExpress.XtraPrinting
Imports DevExpress.XtraPrintingLinks


Public Sub MultiFileExportToExcel()

Using saveDialog = New SaveFileDialog()
saveDialog.Filter = “Excel (.xlsx)|*.xlsx”
If saveDialog.ShowDialog() = DialogResult.OK Then
Dim printingSystem = New PrintingSystemBase()
Dim compositeLink = New CompositeLinkBase()
compositeLink.PrintingSystemBase = printingSystem

Dim link1 = New PrintableComponentLinkBase()
link1.Component = grid1
Dim link2 = New PrintableComponentLinkBase()
link2.Component = grid2


Dim options = New XlsxExportOptions()
options.ExportMode = XlsxExportMode.SingleFilePageByPage

compositeLink.ExportToXlsx(saveDialog.FileName, options)
End If
End Using
End Sub


Solution ::  C#

using DevExpress.XtraPrinting
using DevExpress.XtraPrintingLinks

public void exportToExcel()
using (var saveDialog = new SaveFileDialog())
saveDialog.Filter = “Excel (.xlsx)|*.xlsx”;
if (saveDialog.ShowDialog() == DialogResult.OK)
var printingSystem = new PrintingSystemBase();
var compositeLink = new CompositeLinkBase();
compositeLink.PrintingSystemBase = printingSystem;

var link1 = new PrintableComponentLinkBase();
link1.Component = grid1;
var link2 = new PrintableComponentLinkBase();
link2.Component = grid2;


var options = new XlsxExportOptions();
options.ExportMode = XlsxExportMode.SingleFilePageByPage;

compositeLink.ExportToXlsx(saveDialog.FileName, options);


Reference url;

Leave a comment

Posted by on April 22, 2015 in Vb.Net, WinForm


Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: