/// <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); } }
public ExportExcelEventArgs(ExportExcelDlg dialog, System.ComponentModel.DoWorkEventArgs we) { this.dialog = Commons.NotNull(dialog, "dialog"); this.we = Commons.NotNull(we, "we"); }