private void button4_Click(object sender, EventArgs e) { Grid_View grid_View = new Grid_View(dataGridView1); var people = grid_View.Export_data(); for (int i = 1; i < people.Count + 1; i++) { string path = path_to_certificates + String.Format(@"\Certificate{0}.docx", i); Word_file.Create_certificate(path, people[i - 1]); } }
private void Select_Excel_Click(object sender, EventArgs e) { OpenFileDialog OPF = new OpenFileDialog(); OPF.Filter = "Файлы с расширением xls|*.xls|Файлы с расширением xlsx|*.xlsx|Файлы с макросом xlsm|*.xlsm"; if (OPF.ShowDialog() == DialogResult.OK) { Excel_file excel = new Excel_file(OPF.FileName); List <Person> people = excel.Load_sheet(); Grid_View grid_View = new Grid_View(dataGridView1); grid_View.Import_data(people); } }