using DevExpress.XtraPrinting;
using DevExpress.Printing.ExportHelpers;
using DevExpress.Export;
private void simpleButton1_Click(object sender, EventArgs e) {
DevExpress.Export.ExportSettings.DefaultExportType = ExportType.DataAware;
XlsxExportOptionsEx options = new XlsxExportOptionsEx();
options.CustomizeSheetHeader += options_CustomizeSheetHeader;
string file = "grid-export.xlsx";
gridControl.ExportToXlsx(file, options);
System.Diagnostics.Process.Start(file);
}
void options_CustomizeSheetHeader(DevExpress.Export.ContextEventArgs e) {
CellObject row = new CellObject();
row.Value = "The document is exported from the IssueList database.";
XlFormattingObject rowFormatting = new XlFormattingObject();
rowFormatting.Font = new XlCellFont { Bold = true, Size = 14 };
rowFormatting.Alignment = new DevExpress.Export.Xl.XlCellAlignment { HorizontalAlignment = DevExpress.Export.Xl.XlHorizontalAlignment.Center, VerticalAlignment = DevExpress.Export.Xl.XlVerticalAlignment.Top };
row.Formatting = rowFormatting;
e.ExportContext.AddRow(new [] {row});
e.ExportContext.AddRow();
e.ExportContext.MergeCells(new DevExpress.Export.Xl.XlCellRange(new DevExpress.Export.Xl.XlCellPosition(0, 0), new DevExpress.Export.Xl.XlCellPosition(5, 1)));
}