private void button2_Click(object sender, EventArgs e) { try { WordReportGenerator WR = new WordReportGenerator(); if (saveFileDialog1.ShowDialog() == DialogResult.OK || saveFileDialog1.FileName == "") { WR.PathToSave = saveFileDialog1.FileName + ".docx"; if (File.Exists("IZ.docx")) { WR.template = "IZ.docx"; string terrazm = (radioButton1.Checked) ? radioButton1.Text : (radioButton2.Checked) ? radioButton2.Text : (radioButton3.Checked) ? radioButton3.Text : (radioButton4.Checked) ? radioButton4.Text : (radioButton5.Checked) ? radioButton5.Text : ""; WR.Add("@terrazm", terrazm); string soed = (radioButton6.Checked) ? radioButton6.Text : (radioButton7.Checked) ? radioButton7.Text : (radioButton8.Checked) ? radioButton8.Text : ""; WR.Add("@soed", soed); string operazi = (radioButton9.Checked) ? radioButton9.Text : (radioButton10.Checked) ? radioButton10.Text : ""; WR.Add("@operazi", operazi); string dostyp = (radioButton11.Checked) ? radioButton11.Text : (radioButton12.Checked) ? radioButton12.Text : ""; WR.Add("@dostyp", dostyp); string baza = (radioButton13.Checked) ? radioButton13.Text : (radioButton14.Checked) ? radioButton14.Text : ""; WR.Add("@baza", baza); string yroven = (radioButton15.Checked) ? radioButton15.Text : (radioButton16.Checked) ? radioButton16.Text : (radioButton18.Checked) ? radioButton18.Text : ""; WR.Add("@yroven", yroven); string obem = (radioButton17.Checked) ? radioButton17.Text : (radioButton19.Checked) ? radioButton19.Text : (radioButton20.Checked) ? radioButton20.Text : ""; WR.Add("@obem", obem); WR.Add("@Yrzash", textBox1.Text); WR.Generate(); MessageBox.Show("Отчет успешно создан! Путь документа: " + WR.PathToSave, "Отчет"); } } else { MessageBox.Show("Вы не указали путь для отчета! Отчет не был создан", "Ошибка!!!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button4_Click(object sender, EventArgs e) { string res = ""; for (int i = 0; i < dataGridView1.RowCount - 1; i++) { res += dataGridView1.Rows[i].Cells[0].Value.ToString() + " " + dataGridView1.Rows[i].Cells[1].Value.ToString() + " " + dataGridView1.Rows[i].Cells[12].Value.ToString() + " " + dataGridView1.Rows[i].Cells[13].Value.ToString() + " " + dataGridView1.Rows[i].Cells[14].Value.ToString() + " " + dataGridView1.Rows[i].Cells[15].Value.ToString() + "\n"; } WordReportGenerator WRG = new WordReportGenerator(); if (saveFileDialog1.ShowDialog() == DialogResult.OK || saveFileDialog1.FileName == "") { WRG.PathToSave = saveFileDialog1.FileName + ".docx"; if (File.Exists("model.docx")) { WRG.template = "model.docx"; WRG.Add("@ressssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss", res); WRG.Generate(); MessageBox.Show("Отчет успешно создан! Путь документа: " + WRG.PathToSave, "Отчет"); } MessageBox.Show(res); } }
private void button2_Click(object sender, EventArgs e) { try { WordReportGenerator WR = new WordReportGenerator(); if (saveFileDialog1.ShowDialog() == DialogResult.OK || saveFileDialog1.FileName == "") { WR.PathToSave = saveFileDialog1.FileName + ".docx"; if (File.Exists("NewAct.docx")) { WR.template = "NewAct.docx"; string kategor = (radioButton1.Checked) ? radioButton1.Text : (radioButton2.Checked) ? radioButton2.Text : (radioButton3.Checked) ? radioButton3.Text : (radioButton4.Checked) ? radioButton4.Text : ""; WR.Add("@kategor", kategor); string obem = (radioButton5.Checked) ? radioButton5.Text : (radioButton6.Checked) ? radioButton6.Text : ""; WR.Add("@obem", obem); string tipsub = (radioButton7.Checked) ? radioButton7.Text : (radioButton8.Checked) ? radioButton8.Text : ""; WR.Add("@tipsub", tipsub); string seti = (radioButton9.Checked) ? radioButton9.Text : (radioButton10.Checked) ? radioButton10.Text : ""; WR.Add("@seti", seti); string structure = (radioButton11.Checked) ? radioButton11.Text : (radioButton12.Checked) ? radioButton12.Text : (radioButton13.Checked) ? radioButton13.Text : ""; WR.Add("@structure", structure); string rejobrabot = (radioButton14.Checked) ? radioButton14.Text : (radioButton15.Checked) ? radioButton15.Text : ""; WR.Add("@rejobrabot", rejobrabot); string dostyp = (radioButton16.Checked) ? radioButton16.Text : (radioButton17.Checked) ? radioButton17.Text : ""; WR.Add("@dostyp", dostyp); string mesto = (radioButton18.Checked) ? radioButton18.Text : (radioButton19.Checked) ? radioButton19.Text : ""; WR.Add("@mesto", mesto); string tipygr = (radioButton20.Checked) ? radioButton20.Text : (radioButton21.Checked) ? radioButton21.Text : (radioButton22.Checked) ? radioButton22.Text : ""; WR.Add("@tipygr", tipygr); WR.Add("@UrovenZash", textBox1.Text); string harakter = ""; if (checkBox1.Checked) { harakter = (harakter == "") ? checkBox1.Text : harakter += ", " + checkBox1.Text; } if (checkBox2.Checked) { harakter = (harakter == "") ? checkBox2.Text : harakter += ", " + checkBox2.Text; } if (checkBox3.Checked) { harakter = (harakter == "") ? checkBox3.Text : harakter += ", " + checkBox3.Text; } WR.Add("@harakter", harakter); WR.Generate(); MessageBox.Show("Отчет успешно создан! Путь документа: " + WR.PathToSave, "Отчет"); } } else { MessageBox.Show("Вы не указали путь для отчета! Отчет не был создан", "Ошибка!!!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }