public static WP.Run GenerateRunWithText(string content) { RunProperties runProperties = new RunProperties(); WP.RunFonts runFonts = new WP.RunFonts() { Ascii = "Cambria Math", HighAnsi = "Cambria Math" }; WP.Italic italic = new WP.Italic(); runProperties.Append(runFonts); runProperties.Append(italic); return(new WP.Run(runProperties, new WP.Text(content))); }
public void AddText(String text = "", uint fontSize = 12, bool bold = false, bool italic = false) { Wp.Run _r = new Wp.Run(); Wp.RunProperties _rp = new Wp.RunProperties(); Wp.RunFonts _rf = new Wp.RunFonts() { Ascii = "Calibri", HighAnsi = "Calibri", EastAsia = "Calibri", ComplexScript = "Calibri" }; Wp.FontSize _fs = new Wp.FontSize() { Val = fontSize.ToString() }; Wp.Languages _l = new Wp.Languages() { Bidi = "en-us" }; _rp.Append(_rf); _rp.Append(_fs); _rp.Append(_l); if (italic) { _rp.Append(new Wp.Italic()); } if (bold) { _rp.Append(new Wp.Bold()); } Wp.Text _t = new Wp.Text(); _t.Text = text; _r.Append(_rp); _r.Append(_t); this._Paragraph.Append(_r); }
public Wordprocessing.Body insertinform() { Wordprocessing.Body body = new Wordprocessing.Body(); //Параграф1 Wordprocessing.Paragraph paragraph1 = new Wordprocessing.Paragraph(); Wordprocessing.ParagraphProperties paragraphProperties1 = new Wordprocessing.ParagraphProperties(); Wordprocessing.SpacingBetweenLines spacingBetweenLines1 = new Wordprocessing.SpacingBetweenLines() { After = "0" }; Wordprocessing.Justification justification1 = new Wordprocessing.Justification() { Val = Wordprocessing.JustificationValues.Center }; paragraphProperties1.Append(spacingBetweenLines1); paragraphProperties1.Append(justification1); Wordprocessing.Run run1 = new Wordprocessing.Run(); Wordprocessing.RunProperties runProperties1 = new Wordprocessing.RunProperties(); Wordprocessing.RunFonts runFonts2 = new Wordprocessing.RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; Wordprocessing.Bold bold2 = new Wordprocessing.Bold(); Wordprocessing.FontSize fontSize2 = new Wordprocessing.FontSize() { Val = "24" }; runProperties1.Append(runFonts2); runProperties1.Append(bold2); runProperties1.Append(fontSize2); Wordprocessing.Text text1 = new Wordprocessing.Text(); text1.Text = "ФГБОУВПО \"ПЕРМСКИЙ ГОСУДАРСТВЕННЫЙ НАЦИОНАЛЬНЫЙ ИССЛЕДОВАТЕЛЬСКИЙ УНИВЕРСИТЕТ\""; run1.Append(runProperties1); run1.Append(text1); paragraph1.Append(paragraphProperties1); paragraph1.Append(run1); //Параграф2 Wordprocessing.Paragraph paragraph2 = new Wordprocessing.Paragraph(); Wordprocessing.ParagraphProperties paragraphProperties2 = new Wordprocessing.ParagraphProperties(); Wordprocessing.SpacingBetweenLines spacingBetweenLines2 = new Wordprocessing.SpacingBetweenLines() { After = "0" }; Wordprocessing.Justification justification2 = new Wordprocessing.Justification() { Val = Wordprocessing.JustificationValues.Center }; paragraphProperties2.Append(spacingBetweenLines2); paragraphProperties2.Append(justification2); Wordprocessing.Run run2 = new Wordprocessing.Run(); Wordprocessing.RunProperties runProperties2 = new Wordprocessing.RunProperties(); Wordprocessing.RunFonts runFonts4 = new Wordprocessing.RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; Wordprocessing.FontSize fontSize4 = new Wordprocessing.FontSize() { Val = "24" }; runProperties2.Append(runFonts4); runProperties2.Append(fontSize4); Wordprocessing.Text text2 = new Wordprocessing.Text(); text2.Text = "Механико-математический факультет "; run2.Append(runProperties2); run2.Append(text2); Wordprocessing.Run run3 = new Wordprocessing.Run(); Wordprocessing.RunProperties runProperties3 = new Wordprocessing.RunProperties(); Wordprocessing.RunFonts runFonts5 = new Wordprocessing.RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; Wordprocessing.FontSize fontSize5 = new Wordprocessing.FontSize() { Val = "24" }; runProperties3.Append(runFonts5); runProperties3.Append(fontSize5); Wordprocessing.Break break1 = new Wordprocessing.Break(); Wordprocessing.Text text3 = new Wordprocessing.Text(); text3.Text = "очная форма обучения"; run3.Append(runProperties3); run3.Append(break1); run3.Append(text3); paragraph2.Append(paragraphProperties2); paragraph2.Append(run2); paragraph2.Append(run3); //Параграф2 Wordprocessing.Paragraph paragraph3 = new Wordprocessing.Paragraph() { RsidParagraphAddition = "004D49E1", RsidParagraphProperties = "004D49E1", RsidRunAdditionDefault = "004D49E1" }; Wordprocessing.ParagraphProperties paragraphProperties3 = new Wordprocessing.ParagraphProperties(); Wordprocessing.SpacingBetweenLines spacingBetweenLines3 = new Wordprocessing.SpacingBetweenLines() { After = "0" }; Wordprocessing.Justification justification3 = new Wordprocessing.Justification() { Val = Wordprocessing.JustificationValues.Center }; paragraphProperties3.Append(spacingBetweenLines3); paragraphProperties3.Append(justification3); Wordprocessing.Run run4 = new Wordprocessing.Run(); Wordprocessing.RunProperties runProperties4 = new Wordprocessing.RunProperties(); Wordprocessing.RunFonts runFonts7 = new Wordprocessing.RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; Wordprocessing.Bold bold4 = new Wordprocessing.Bold(); runProperties4.Append(runFonts7); runProperties4.Append(bold4); Wordprocessing.Text text4 = new Wordprocessing.Text(); text4.Text = "ЭКЗАМЕНАЦИОННАЯ ВЕДОМОСТЬ"; run4.Append(runProperties4); run4.Append(text4); Wordprocessing.Run run5 = new Wordprocessing.Run(); Wordprocessing.Break break2 = new Wordprocessing.Break(); run5.Append(break2); paragraph3.Append(paragraphProperties3); paragraph3.Append(run4); paragraph3.Append(run5); body.Append(paragraph1); body.Append(paragraph2); body.Append(paragraph3); return body; }