Ejemplo n.º 1
0
        /// <summary>
        /// 导出为Excel表格。
        /// </summary>
        /// <param name="binding"></param>
        /// <param name="fileName"></param>
        private static void Export(System.Windows.Forms.IWin32Window parent, MyGridViewBinding binding, string fileName)
        {
            Commons.NotNull(binding, "binding");
            Commons.NotBlank(fileName, "path");

            // 此处固定导出所有的可见列。
            var exportedColumns = binding.Columns.Cast <MyGridColumn>()
                                  .Where(col => col.Visible)
                                  .ToList();

            using (var dlg = new ExportExcelDlg(binding, exportedColumns, fileName)) {
                dlg.DoExport += ExportToExcel;
                dlg.ShowDialog(parent);
            }
        }
Ejemplo n.º 2
0
 public ExportExcelEventArgs(ExportExcelDlg dialog, System.ComponentModel.DoWorkEventArgs we)
 {
     this.dialog = Commons.NotNull(dialog, "dialog");
     this.we     = Commons.NotNull(we, "we");
 }