private void exportAllTablesToolStripMenuItem_Click(object sender, EventArgs e) { DGVExcelWriter writer = new DGVExcelWriter(); Parallel.ForEach(forms, form => { List <DataGridView> grid_views = form.GetDGVs(); writer.ExportToExcel(grid_views, (form as Form).Name); }); SaveExcelFile(writer, (current_form as Form).MdiParent.Name + "_table.xlsx"); }
private void SaveExcelFile(DGVExcelWriter writer, string filename) { saveExcelDialog.FileName = filename; DialogResult dr = saveExcelDialog.ShowDialog(); if (dr == DialogResult.OK) { writer.SaveToExcel(saveExcelDialog.FileName); MessageBox.Show("Successfully exported table."); } else { return; } }
private void exportTablesToolStripMenuItem_Click(object sender, EventArgs e) { List <DataGridView> grid_views = current_form.GetDGVs(); if (grid_views == null) { MessageBox.Show("There is no table on this page to export. Please navigate to another page with the Results tab."); return; } DGVExcelWriter writer = new DGVExcelWriter(); writer.ExportToExcel(grid_views, (current_form as Form).Name); SaveExcelFile(writer, (current_form as Form).Name + "_table.xlsx"); }