private void сохранитьКакToolStripMenuItem_Click(object sender, EventArgs e) { JsonDataBase.Save(); saveFileDialog1.Filter = "XLS files (*.xls, *.xlt)|*.xls;*.xlt|XLSX files (*.xlsx, *.xlsm, *.xltx, *.xltm)|*.xlsx;*.xlsm;*.xltx;*.xltm|ODS files (*.ods, *.ots)|*.ods;*.ots|CSV files (*.csv, *.tsv)|*.csv;*.tsv|HTML files (*.html, *.htm)|*.html;*.htm"; saveFileDialog1.FilterIndex = 2; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { var item = (DataGridView)Tables.SelectedTab.Controls[0]; JsonDataBase.SaveTemplate(ref item, saveFileDialog1.FileName); } }
private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < 4; i++) { var item = (DataGridView)Tables.TabPages[i].Controls[0]; JsonDataBase.SaveTemplate(ref item, $@"..\Template{i + 1}.xlsx"); } for (int i = 4; i < Tables.TabPages.Count; i++) { var item = (DataGridView)Tables.TabPages[i].Controls[0]; JsonDataBase.SaveTemplate(ref item, Tables.TabPages[i].Text); } JsonDataBase.Save(); }
private void ВыходToolStripMenuItem_Click(object sender, EventArgs e) { JsonDataBase.Save(); for (int i = 0; i < Tables.TabPages.Count; i++) { saveFileDialog1.Filter = "XLS files (*.xls, *.xlt)|*.xls;*.xlt|XLSX files (*.xlsx, *.xlsm, *.xltx, *.xltm)|*.xlsx;*.xlsm;*.xltx;*.xltm|ODS files (*.ods, *.ots)|*.ods;*.ots|CSV files (*.csv, *.tsv)|*.csv;*.tsv|HTML files (*.html, *.htm)|*.html;*.htm"; saveFileDialog1.FilterIndex = 2; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { var item = (DataGridView)Tables.TabPages[i].Controls[0]; JsonDataBase.SaveTemplate(ref item, saveFileDialog1.FileName); } } Environment.Exit(0); }