• Devexpress EXCEL导出


          #region EXCEL导出
    
            /// <summary>
            /// EXCEL导出
    /// </summary> /// <param name="saveFileName">文件名称</param> /// <param name="gridView">待导出的gridView数据</param> public void ExportToExcel(string saveFileName, DevExpress.XtraGrid.Views.Base.BaseView gridView) { try { SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.DefaultExt = "xls"; saveDialog.Filter = "导出Excel(*.xls)|*.xls"; saveDialog.FileName = saveFileName + DateTime.Now.ToString("yyyyMMddHHmmss"); if (saveDialog.ShowDialog() != DialogResult.OK) return; saveFileName = saveDialog.FileName; Cursor.Current = Cursors.WaitCursor; DevExpress.XtraExport.IExportXlsProvider provider = new DevExpress.XtraExport.ExportXlsProvider(saveFileName); this.FindForm().Refresh(); DevExpress.XtraGrid.Export.BaseExportLink link = gridView.CreateExportLink(provider); link.ExportAll = true; link.Progress += new DevExpress.XtraGrid.Export.ProgressEventHandler(Export_Progress);//进度条事件 link.ExportTo(true); provider.Dispose(); link.Progress -= new DevExpress.XtraGrid.Export.ProgressEventHandler(Export_Progress); Cursor.Current = Cursors.Default; MessageUtil.ShowTips("导出成功!"); } catch (Exception ex) {
             MessageUtil.ShowError("导出失败!"); } } /// <summary> /// 进度条事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Export_Progress(object sender, DevExpress.XtraGrid.Export.ProgressEventArgs e) { if (e.Phase == DevExpress.XtraGrid.Export.ExportPhase.Link) { // progressBarControl1.Position = e.Position; this.Update(); } } #endregion
  • 相关阅读:
    团队作业9——测试与发布(Beta版本)
    团队作业8 ----第二次项目冲刺(Beta阶段)博客汇总
    【Beta】 第七次Daily Scrum Meeting
    【Beta】 第六次Daily Scrum Meeting
    【Beta】 第五次Daily Scrum Meeting
    【Beta】 第四次Daily Scrum Meeting
    【Beta】 第三次Daily Scrum Meeting
    Flask-论坛开发-5-memcached缓存系统
    Flask-论坛开发-4-知识点补充
    Flask-论坛开发-3-数据库
  • 原文地址:https://www.cnblogs.com/xuzai/p/4723340.html
Copyright © 2020-2023  润新知