DEV-gridview导出Excel
SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Title = "请选择文件存放路径"; saveFile.Filter = "Excel文档(*.xls)|*.xls|Excel文档(*.xlsx)|*.xlsx"; saveFile.FileName = "AX"+DateTime.Now.ToString("yyyyMMddHhmmss"); if (saveFile.ShowDialog() == DialogResult.OK) { DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions(); options.TextExportMode = DevExpress.XtraPrinting.TextExportMode.Text; options.SheetName = ""; gridView1.OptionsPrint.AutoWidth = false; gridView1.OptionsPrint.AllowCancelPrintExport = false; gridView1.AppearancePrint.Row.Font = new System.Drawing.Font("宋体", 9); gridView1.ExportToXls(saveFile.FileName, options); }