城里的
乡下鱼

将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);
            }

  

posted on 2017-08-31 16:47  城里的乡下鱼  阅读(1422)  评论(0编辑  收藏  举报