將DevExpress GridView中的數據原樣導出到Excel中

SaveFileDialog fileDialog = new SaveFileDialog();
            fileDialog.Title = "導出Excel";
            fileDialog.Filter = "Excel文件(*.xls)|*.xls";
            DialogResult dialogResult = fileDialog.ShowDialog(this);
            if (dialogResult == DialogResult.OK)
            {
                DevExpress.XtraPrinting.XlsExportOptions options = new 
DevExpress.XtraPrinting.XlsExportOptions();
                gridControl1.ExportToXls(fileDialog.FileName);
                DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示",         
                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
相關文章
相關標籤/搜索