您的位置:首页 > 其它

将dev gridControl表中原形数据导出到excel功能写法

2016-02-25 10:01 447 查看
不废话,直接上图上代码



   private void btnToXls_Click(object sender, EventArgs e)

        {

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

            }

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息