/// <summary> /// 从Excel表格导入。 /// </summary> /// <param name="binding"></param> /// <param name="fileName"></param> public static void Import(System.Windows.Forms.IWin32Window parent, MyGridViewBinding binding, string fileName) { Commons.NotNull(binding, "binding"); Commons.NotBlank(fileName, "path"); // 此处固定导入所有的可见列。 var importedColumns = binding.Columns.Cast <MyGridColumn>() .Where(col => col.Visible) .ToList(); using (var dlg = new ImportExcelDlg(binding, importedColumns, fileName)) { dlg.DoImport += ImportFromExcel; dlg.ShowDialog(parent); } }
public ImportExcelEventArgs(ImportExcelDlg dialog, System.ComponentModel.DoWorkEventArgs we) { this.dialog = Commons.NotNull(dialog, "dialog"); this.we = Commons.NotNull(we, "we"); }