private void button5_Click(object sender, EventArgs e) { saveFileDialog1.ShowDialog(); KURS.allDataSet kursDataSet = new KURS.allDataSet(); KURS.allDataSetTableAdapters.TovarTableAdapter TovarTableAdapter = new KURS.allDataSetTableAdapters.TovarTableAdapter(); TovarTableAdapter.Fill(kursDataSet.Tovar); TextDocument textdocument = new TextDocument(); textdocument.New(); Paragraph headerText1 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); headerText1.TextContent.Add(new SimpleText(textdocument, "firma kosmetics")); textdocument.Content.Add(headerText1); Paragraph headerText2 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); headerText2.TextContent.Add(new SimpleText(textdocument, "Ulyanovsk, Russian Federation")); textdocument.Content.Add(headerText2); Paragraph headerText3 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); headerText3.TextContent.Add(new SimpleText(textdocument, "Кому: " + listBox1.Text)); textdocument.Content.Add(headerText3); var d = from price in kursDataSet.Tovar.AsEnumerable() where price.kolvo == 0 select price; Paragraph maintext = ParagraphBuilder.CreateStandardTextParagraph(textdocument); maintext.TextContent.Add(new SimpleText(textdocument, "ID--name--srok--price" + Environment.NewLine)); textdocument.Content.Add(maintext); foreach (var obj in d) { Paragraph maintext2 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); maintext2.TextContent.Add(new SimpleText(textdocument, obj.id.ToString() + "--" + obj.name.ToString() + "--" + obj.srok.ToString() + "--" + obj.price.ToString() + Environment.NewLine)); textdocument.Content.Add(maintext2); } Paragraph footerText = ParagraphBuilder.CreateStandardTextParagraph(textdocument); footerText.TextContent.Add(new SimpleText(textdocument, "Подпись продавца:_____________")); textdocument.Content.Add(footerText); textdocument.SaveTo(saveFileDialog1.FileName); }
private void button5_Click(object sender, EventArgs e) { saveFileDialog1.ShowDialog(); KURS.allDataSet kursDataSet = new KURS.allDataSet(); KURS.allDataSetTableAdapters.TovarTableAdapter TovarTableAdapter = new KURS.allDataSetTableAdapters.TovarTableAdapter(); TovarTableAdapter.Fill(kursDataSet.Tovar); TextDocument textdocument = new TextDocument(); textdocument.New(); Paragraph headerText1 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); headerText1.TextContent.Add(new SimpleText(textdocument, "firma kosmetics")); textdocument.Content.Add(headerText1); Paragraph headerText2 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); headerText2.TextContent.Add(new SimpleText(textdocument, "Ulyanovsk, Russian Federation")); textdocument.Content.Add(headerText2); Paragraph headerText3 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); headerText3.TextContent.Add(new SimpleText(textdocument, "Кому: " + listBox1.Text)); textdocument.Content.Add(headerText3); var d = from price in kursDataSet.Tovar.AsEnumerable() where price.kolvo == 0 select price; Paragraph maintext = ParagraphBuilder.CreateStandardTextParagraph(textdocument); maintext.TextContent.Add(new SimpleText(textdocument, "ID--name--srok--price"+Environment.NewLine)); textdocument.Content.Add(maintext); foreach (var obj in d) { Paragraph maintext2 = ParagraphBuilder.CreateStandardTextParagraph(textdocument); maintext2.TextContent.Add(new SimpleText(textdocument, obj.id.ToString() + "--" + obj.name.ToString() + "--" + obj.srok.ToString() + "--" + obj.price.ToString() + Environment.NewLine)); textdocument.Content.Add(maintext2); } Paragraph footerText = ParagraphBuilder.CreateStandardTextParagraph(textdocument); footerText.TextContent.Add(new SimpleText(textdocument, "Подпись продавца:_____________")); textdocument.Content.Add(footerText); textdocument.SaveTo(saveFileDialog1.FileName); }