zoukankan      html  css  js  c++  java
  • mvvm Dev12.1 GridControl 导出

    此方法不适合12.1版本

    private void barExport_ItemClick(objectsender, DevExpress.XtraBars.ItemClickEventArgs e)

    {

        SaveFileDialog saveFileDialog =new SaveFileDialog();

        saveFileDialog.Title ="导出Excel";

        saveFileDialog.Filter ="Excel文件(*.xls)|*.xls";

        DialogResult dialogResult = saveFileDialog.ShowDialog(this);

        if(dialogResult == DialogResult.OK)

        {

            DevExpress.XtraPrinting.XlsExportOptions options =new DevExpress.XtraPrinting.XlsExportOptions();

            gridControl1.ExportToXls(saveFileDialog.FileName);

            DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!","提示", MessageBoxButtons.OK, MessageBoxIcon.Information);            }

    }

     

    12.1版本导出

     TableView dg = obj as TableView;
                if (dg != null)
                {
                    System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
                    saveFileDialog.DefaultExt = "*.xls";
                    saveFileDialog.AddExtension = true;
                    saveFileDialog.Filter = "Excel 文件|*.xls";
                    saveFileDialog.OverwritePrompt = true;
                    saveFileDialog.CheckPathExists = true;
                    if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFileDialog.FileName != null)
                    {
                        string fileName = saveFileDialog.FileName;//文件名字
                        DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions(DevExpress.XtraPrinting.TextExportMode.Value);
                        dg.ExportToXls(fileName, options);
                        MessageBox.Show("报表导出成功!", "系统提示");
                    }
                }

  • 相关阅读:
    Pandas DataFrame操作
    Pandas Series数据结构基本操作
    Locally weighted regression algorithm
    Python Numpy线性代数操作
    Python Numpy 矩阵级基本操作(2)
    分布式锁1 Java常用技术方案(转)
    设计模式
    设计模式
    设计模式
    Lock和synchronized比较详解(转)
  • 原文地址:https://www.cnblogs.com/swarb/p/9924307.html
Copyright © 2011-2022 走看看