using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using DevExpress.XtraGrid.Views.BandedGrid; using DevExpress.XtraPrintingLinks; using DevExpress.XtraPrinting; private void Form1_Load(object sender, EventArgs e) { DataTable dt1 = new DataTable(); dt1.Columns.Add("a1"); dt1.Columns.Add("a2"); dt1.Columns.Add("a3"); dt1.Columns.Add("a4"); DataTable dt2 = dt1.Copy(); dt1.Rows.Add("A", "22222", "22222", "22222"); dt1.Rows.Add("B", "33333333333", "33333333333", "3"); dt1.Rows.Add("C", "12", "24", "3"); dt2.Rows.Add("AA", "1", "1", "3"); dt2.Rows.Add("AA", "222", "555", "3"); dt2.Rows.Add("BB", "12", "24", "3"); dt2.Rows.Add("BB", "13", "22222", "3"); gridControl1.DataSource = dt1; gridControl3.DataSource = dt2; } private void Btn_Excel_Click(object sender, EventArgs e) { CompositeLink complink = new CompositeLink(new PrintingSystem()); PrintableComponentLink link = new PrintableComponentLink(); link.Component = gridControl1; PrintableComponentLink link2 = new PrintableComponentLink(); link2.Component = gridControl3; complink.Links.Add(link); complink.Links.Add(link2); complink.CreatePageForEachLink(); complink.ExportToXlsx("file1.xlsx", new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFilePageByPage }); }