public void WriteWebsiteHyperlink(Paragraph paragraph, string text, Uri uri, string relationshipId) { Hyperlink link = new Hyperlink() { Id = relationshipId }; Run run = new Run(); RunProperties runProperties = new RunProperties(); RunStyle runStyle = new RunStyle() { Val = "Hyperlink" }; runProperties.Append(runStyle); Text text1 = new Text() { Text = text }; run.Append(runProperties); run.Append(text1); link.Append(run); paragraph.Append(link); mainDocumentPart.AddHyperlinkRelationship(uri, true, relationshipId); }
public Hyperlink CreateHyperlink(string text, string anchorId, string style = null, int?size = null) { RunProperties rp = new RunProperties(); if (!string.IsNullOrEmpty(style)) { rp.Append( new RunStyle() { Val = style, }); } if (size != null) { rp.Append( new FontSize() { Val = new StringValue((2 * size).ToString()) }); } // Ensure a hyperlink info is recorded if needed for future use HyperlinkInfo hyperlinkInfo = this.FindOrAddInternalId(anchorId); Hyperlink hyperlink = new Hyperlink() { Anchor = anchorId }; hyperlink.Append(new ProofError() { Type = ProofingErrorValues.GrammarStart }); hyperlink.Append( new Run(rp, new Text(text))); return(hyperlink); }
/// <summary> /// Add a note to the FootNotes part and ensure it exists. /// </summary> /// <param name="description">The description of an acronym, abbreviation, some book references, ...</param> /// <returns>Returns the id of the footnote reference.</returns> protected int AddFootnoteReference(string description) { FootnotesPart fpart = mainPart.FootnotesPart; if (fpart == null) { fpart = mainPart.AddNewPart <FootnotesPart>(); } if (fpart.Footnotes == null) { // Insert a new Footnotes reference new Footnotes( new Footnote( new Paragraph( new ParagraphProperties { SpacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto } }, new Run( new SeparatorMark()) ) ) { Type = FootnoteEndnoteValues.Separator, Id = -1 }, new Footnote( new Paragraph( new ParagraphProperties { SpacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto } }, new Run( new ContinuationSeparatorMark()) ) ) { Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 }).Save(fpart); footnotesRef = 1; } else { // The footnotesRef Id is a required field and should be unique. You can assign yourself some hard-coded // value but that's absolutely not safe. We will loop through the existing Footnote // to retrieve the highest Id. foreach (var fn in fpart.Footnotes.Elements <Footnote>()) { if (fn.Id.HasValue && fn.Id > footnotesRef) { footnotesRef = (int)fn.Id.Value; } } footnotesRef++; } Run markerRun; Paragraph p; fpart.Footnotes.Append( new Footnote( p = new Paragraph( new ParagraphProperties { ParagraphStyleId = new ParagraphStyleId() { Val = htmlStyles.GetStyle("footnote text", StyleValues.Paragraph) } }, markerRun = new Run( new RunProperties { RunStyle = new RunStyle() { Val = htmlStyles.GetStyle("footnote reference", StyleValues.Character) } }, new FootnoteReferenceMark()), new Run( // Word insert automatically a space before the definition to separate the // reference number with its description new Text(" ") { Space = SpaceProcessingModeValues.Preserve }) ) ) { Id = footnotesRef }); // Description in footnote reference can be plain text or a web protocols/file share (like \\server01) Uri uriReference; Regex linkRegex = new Regex(@"^((https?|ftps?|mailto|file)://|[\\]{2})(?:[\w][\w.-]?)"); if (linkRegex.IsMatch(description) && Uri.TryCreate(description, UriKind.Absolute, out uriReference)) { HyperlinkRelationship extLink = fpart.AddHyperlinkRelationship(uriReference, true); var h = new Hyperlink( ) { History = true, Id = extLink.Id }; htmlStyles.EnsureKnownStyle(HtmlDocumentStyle.KnownStyles.Hyperlink); h.Append(new Run( new RunProperties { RunStyle = new RunStyle() { Val = htmlStyles.GetStyle("Hyperlink", StyleValues.Character) } }, new Text(description))); p.Append(h); } else { p.Append(new Run( new Text(description) { Space = SpaceProcessingModeValues.Preserve })); } if (!htmlStyles.DoesStyleExists("footnote reference")) { // Force the superscript style because if the footnote text style does not exists, // the rendering will be awful. markerRun.InsertInProperties(prop => prop.VerticalTextAlignment = new VerticalTextAlignment() { Val = VerticalPositionValues.Superscript }); } fpart.Footnotes.Save(); return(footnotesRef); }
/// <summary> /// Add a note to the FootNotes part and ensure it exists. /// </summary> /// <param name="description">The description of an acronym, abbreviation, some book references, ...</param> /// <returns>Returns the id of the footnote reference.</returns> private int AddFootnoteReference(string description) { FootnotesPart fpart = mainPart.FootnotesPart; if (fpart == null) { fpart = mainPart.AddNewPart <FootnotesPart>(); } if (fpart.Footnotes == null) { // Insert a new Footnotes reference new Footnotes( new Footnote( new Paragraph( new ParagraphProperties { SpacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto } }, new Run( new SeparatorMark()) ) ) { Type = FootnoteEndnoteValues.Separator, Id = -1 }, new Footnote( new Paragraph( new ParagraphProperties { SpacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto } }, new Run( new ContinuationSeparatorMark()) ) ) { Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 }).Save(fpart); footnotesRef = 1; } else { // The footnotesRef Id is a required field and should be unique. You can assign yourself some hard-coded // value but that's absolutely not safe. We will loop through the existing Footnote // to retrieve the highest Id. foreach (var fn in fpart.Footnotes.Elements <Footnote>()) { if (fn.Id.HasValue && fn.Id > footnotesRef) { footnotesRef = (int)fn.Id.Value; } } footnotesRef++; } Run markerRun; Paragraph p; fpart.Footnotes.Append( new Footnote( p = new Paragraph( new ParagraphProperties { ParagraphStyleId = new ParagraphStyleId() { Val = htmlStyles.GetStyle("FootnoteText", StyleValues.Paragraph) } }, markerRun = new Run( new RunProperties { RunStyle = new RunStyle() { Val = htmlStyles.GetStyle("FootnoteReference", StyleValues.Character) } }, new FootnoteReferenceMark()), new Run( // Word insert automatically a space before the definition to separate the // reference number with its description new Text(" ") { Space = SpaceProcessingModeValues.Preserve }) ) ) { Id = footnotesRef }); // Description in footnote reference can be plain text or a web protocols/file share (like \\server01) Uri uriReference; Regex linkRegex = new Regex(@"^((https?|ftps?|mailto|file)://|[\\]{2})(?:[\w][\w.-]?)"); if (linkRegex.IsMatch(description) && Uri.TryCreate(description, UriKind.Absolute, out uriReference)) { // when URI references a network server (ex: \\server01), System.IO.Packaging is not resolving the correct URI and this leads // to a bad-formed XML not recognized by Word. To enforce the "original URI", a fresh new instance must be created uriReference = new Uri(uriReference.AbsoluteUri, UriKind.Absolute); HyperlinkRelationship extLink = fpart.AddHyperlinkRelationship(uriReference, true); var h = new Hyperlink( ) { History = true, Id = extLink.Id }; h.Append(new Run( new RunProperties { RunStyle = new RunStyle() { Val = htmlStyles.GetStyle("Hyperlink", StyleValues.Character) } }, new Text(description))); p.Append(h); } else { p.Append(new Run( new Text(description) { Space = SpaceProcessingModeValues.Preserve })); } fpart.Footnotes.Save(); return(footnotesRef); }
private OpenXmlElement Process(XmlReader xmlReader, OpenXmlElement current) { Paragraph cPara = current as Paragraph; Run cRun = current as Run; Hyperlink cHyperlink = current as Hyperlink; Table cTable = current as Table; TableRow cTableRow = current as TableRow; TableCell cTableCell = current as TableCell; if (xmlReader.NodeType == XmlNodeType.Element) { // Do something for elements switch (xmlReader.Name) { case "p": if (cPara != null) { break; } Paragraph newParagraph = new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TemplateDescriptionStyle })); return(NewChild(current, newParagraph)); case "b": if (cPara != null) { Run newRun = new Run(); AddBoldToRun(newRun); return(NewChild(current, newRun)); } else if (cRun != null) { AddBoldToRun(cRun); return(cRun); } break; case "i": if (cPara != null) { Run newRun = new Run(); AddItalicsToRun(newRun); return(NewChild(current, newRun)); } else if (cRun != null) { AddItalicsToRun(cRun); return(cRun); } break; case "a": string hrefAttr = xmlReader.GetAttribute("href"); Hyperlink newHyperlink = new Hyperlink( new ProofError() { Type = ProofingErrorValues.GrammarStart }); if (!string.IsNullOrEmpty(hrefAttr)) { Template foundTemplate = null; if (hrefAttr.StartsWith("#") && hrefAttr.Length > 1) { foundTemplate = this.tdb.Templates.SingleOrDefault(y => y.Oid == hrefAttr.Substring(1)); } if (foundTemplate != null) { newHyperlink.Anchor = foundTemplate.Bookmark; newHyperlink.Append( DocHelper.CreateRun( string.Format("{0} ({1})", foundTemplate.Name, foundTemplate.Oid))); } else { try { HyperlinkRelationship rel = mainPart.AddHyperlinkRelationship(new Uri(hrefAttr), true); newHyperlink.History = true; newHyperlink.Id = rel.Id; } catch { } } } if (cPara != null) { return(NewChild(current, newHyperlink)); } break; case "ul": this.currentListLevel++; this.currentListStyle = "ListBullet"; if (current is Paragraph) { current = current.Parent; } break; case "ol": this.currentListLevel++; this.currentListStyle = "ListNumber"; if (current is Paragraph) { current = current.Parent; } break; case "li": Paragraph bulletPara = new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = this.currentListStyle })); return(NewChild(current, bulletPara)); case "table": Table newTable = new Table( new TableProperties(), new TableGrid()); return(NewChild(current, newTable)); case "thead": this.currentIsTableHeader = true; break; case "tr": if (cTable != null) { TableRow newTableRow = new TableRow(); if (this.currentIsTableHeader) { newTableRow.Append( new TableRowProperties( new CantSplit(), new TableHeader())); } return(NewChild(current, newTableRow)); } break; case "td": if (cTableRow != null) { TableCell newCell = new TableCell(); if (this.currentIsTableHeader) { newCell.Append( new TableCellProperties() { Shading = new Shading() { Val = new EnumValue <ShadingPatternValues>(ShadingPatternValues.Clear), Color = new StringValue("auto"), Fill = new StringValue("E6E6E6") } }); } // Cells' contents should be within a paragraph Paragraph newPara = new Paragraph(); newCell.AppendChild(newPara); current.Append(newCell); return(newPara); } break; case "span": if (cPara != null) { Run newRun = new Run(); return(NewChild(current, newRun)); } break; case "root": case "tbody": break; default: throw new Exception("Unsupported wiki syntax"); } } else if (xmlReader.NodeType == XmlNodeType.Text) { string text = xmlReader.Value .Replace(" ", " "); if (current is Paragraph || current is TableCell) { current.Append(DocHelper.CreateRun(text)); } else if (cHyperlink != null) { if (!(cHyperlink.LastChild is Run)) { cHyperlink.Append(DocHelper.CreateRun(text)); } } else if (cRun != null) { cRun.Append(new Text(text)); } } else if (xmlReader.NodeType == XmlNodeType.EndElement) { if (xmlReader.Name == "thead") { this.currentIsTableHeader = false; return(current); } else if (xmlReader.Name == "tbody") { return(current); } else if (xmlReader.Name == "td") { // Expect that we are in a paragraph within a table cell, and when TD ends, we need to return two levels higher if (cPara != null && cPara.Parent is TableCell) { return(current.Parent.Parent); } } else if (xmlReader.Name == "a") { // Make sure all runs within a hyperlink have the correct style foreach (var cChildRun in current.ChildElements.OfType <Run>()) { cChildRun.RunProperties.RunStyle = new RunStyle() { Val = Properties.Settings.Default.LinkStyle }; } } else if (xmlReader.Name == "ul") { this.currentListLevel--; } if (current.Parent == null) { return(current); } return(current.Parent); } return(current); }
public static OpenXmlElement Generate(Link link) { OpenXmlElement container = new Run(); bool hasBookmark = false; if (!string.IsNullOrEmpty(link.Anchor)) { hasBookmark = true; var b = new BookmarkStart() { Name = link.Anchor }; b.Id = b.GetHashCode().ToString(); var e = new BookmarkEnd() { Id = b.Id }; container.Append(b, e); } if (!string.IsNullOrEmpty(link.Href)) { var hyperlink = new Hyperlink(); string href = string.Empty; if (!string.IsNullOrEmpty(link.HyperlinkRelationship)) { hyperlink.Id = link.HyperlinkRelationship; } else { hyperlink.Anchor = link.Href; } foreach (var item in link.Content) { var run = TextWriter.Generate(item); run.RunProperties.Append( new RunStyle() { Val = "Hyperlink" }); hyperlink.Append(run); } if (!hasBookmark) { container = hyperlink; } else { container.Append(hyperlink); } } return(container); }
public static Paragraph GenerateParagraph() { Paragraph paragraph1 = new Paragraph() { RsidParagraphMarkRevision = "00D36A28", RsidParagraphAddition = "00D36A28", RsidRunAdditionDefault = "005478FD", ParagraphId = "16FCFC06", TextId = "77777777" }; ParagraphProperties paragraphProperties1 = new ParagraphProperties(); ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId() { Val = "TOC1" }; ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties(); RunFonts runFonts1 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial", EastAsiaTheme = ThemeFontValues.MinorEastAsia }; Caps caps1 = new Caps() { Val = false }; NoProof noProof1 = new NoProof(); FontSize fontSize1 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "20" }; Languages languages1 = new Languages() { EastAsia = "en-CA" }; paragraphMarkRunProperties1.Append(runFonts1); paragraphMarkRunProperties1.Append(caps1); paragraphMarkRunProperties1.Append(noProof1); paragraphMarkRunProperties1.Append(fontSize1); paragraphMarkRunProperties1.Append(fontSizeComplexScript1); paragraphMarkRunProperties1.Append(languages1); paragraphProperties1.Append(paragraphStyleId1); paragraphProperties1.Append(paragraphMarkRunProperties1); Run run1 = new Run() { RsidRunProperties = "004D1F3B" }; RunProperties runProperties1 = new RunProperties(); RunFonts runFonts2 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; FontSize fontSize2 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "20" }; runProperties1.Append(runFonts2); runProperties1.Append(fontSize2); runProperties1.Append(fontSizeComplexScript2); FieldChar fieldChar1 = new FieldChar() { FieldCharType = FieldCharValues.Begin }; run1.Append(runProperties1); run1.Append(fieldChar1); BookmarkEnd bookmarkEnd1 = new BookmarkEnd() { Id = "3" }; BookmarkEnd bookmarkEnd2 = new BookmarkEnd() { Id = "4" }; BookmarkEnd bookmarkEnd3 = new BookmarkEnd() { Id = "5" }; Run run2 = new Run() { RsidRunProperties = "004D1F3B" }; RunProperties runProperties2 = new RunProperties(); RunFonts runFonts3 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; FontSize fontSize3 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript3 = new FontSizeComplexScript() { Val = "20" }; runProperties2.Append(runFonts3); runProperties2.Append(fontSize3); runProperties2.Append(fontSizeComplexScript3); FieldCode fieldCode1 = new FieldCode() { Space = SpaceProcessingModeValues.Preserve }; fieldCode1.Text = " TOC \\o \"1-2\" \\h \\z \\u "; run2.Append(runProperties2); run2.Append(fieldCode1); Run run3 = new Run() { RsidRunProperties = "004D1F3B" }; RunProperties runProperties3 = new RunProperties(); RunFonts runFonts4 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; FontSize fontSize4 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript4 = new FontSizeComplexScript() { Val = "20" }; runProperties3.Append(runFonts4); runProperties3.Append(fontSize4); runProperties3.Append(fontSizeComplexScript4); FieldChar fieldChar2 = new FieldChar() { FieldCharType = FieldCharValues.Separate }; run3.Append(runProperties3); run3.Append(fieldChar2); Hyperlink hyperlink1 = new Hyperlink() { History = true, Anchor = "_Toc459701534" }; Run run4 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties4 = new RunProperties(); RunStyle runStyle1 = new RunStyle() { Val = "Hyperlink" }; RunFonts runFonts5 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof2 = new NoProof(); FontSize fontSize5 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript5 = new FontSizeComplexScript() { Val = "20" }; runProperties4.Append(runStyle1); runProperties4.Append(runFonts5); runProperties4.Append(noProof2); runProperties4.Append(fontSize5); runProperties4.Append(fontSizeComplexScript5); Text text1 = new Text(); text1.Text = "Article 1 definitions and iNTERPRETATION"; run4.Append(runProperties4); run4.Append(text1); Run run5 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties5 = new RunProperties(); RunFonts runFonts6 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof3 = new NoProof(); WebHidden webHidden1 = new WebHidden(); FontSize fontSize6 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript6 = new FontSizeComplexScript() { Val = "20" }; runProperties5.Append(runFonts6); runProperties5.Append(noProof3); runProperties5.Append(webHidden1); runProperties5.Append(fontSize6); runProperties5.Append(fontSizeComplexScript6); TabChar tabChar1 = new TabChar(); run5.Append(runProperties5); run5.Append(tabChar1); Run run6 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties6 = new RunProperties(); RunFonts runFonts7 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof4 = new NoProof(); WebHidden webHidden2 = new WebHidden(); FontSize fontSize7 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript7 = new FontSizeComplexScript() { Val = "20" }; runProperties6.Append(runFonts7); runProperties6.Append(noProof4); runProperties6.Append(webHidden2); runProperties6.Append(fontSize7); runProperties6.Append(fontSizeComplexScript7); FieldChar fieldChar3 = new FieldChar() { FieldCharType = FieldCharValues.Begin }; run6.Append(runProperties6); run6.Append(fieldChar3); Run run7 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties7 = new RunProperties(); RunFonts runFonts8 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof5 = new NoProof(); WebHidden webHidden3 = new WebHidden(); FontSize fontSize8 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript8 = new FontSizeComplexScript() { Val = "20" }; runProperties7.Append(runFonts8); runProperties7.Append(noProof5); runProperties7.Append(webHidden3); runProperties7.Append(fontSize8); runProperties7.Append(fontSizeComplexScript8); FieldCode fieldCode2 = new FieldCode() { Space = SpaceProcessingModeValues.Preserve }; fieldCode2.Text = " PAGEREF _Toc459701534 \\h "; run7.Append(runProperties7); run7.Append(fieldCode2); Run run8 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties8 = new RunProperties(); RunFonts runFonts9 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof6 = new NoProof(); WebHidden webHidden4 = new WebHidden(); FontSize fontSize9 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript9 = new FontSizeComplexScript() { Val = "20" }; runProperties8.Append(runFonts9); runProperties8.Append(noProof6); runProperties8.Append(webHidden4); runProperties8.Append(fontSize9); runProperties8.Append(fontSizeComplexScript9); run8.Append(runProperties8); Run run9 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties9 = new RunProperties(); RunFonts runFonts10 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof7 = new NoProof(); WebHidden webHidden5 = new WebHidden(); FontSize fontSize10 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript10 = new FontSizeComplexScript() { Val = "20" }; runProperties9.Append(runFonts10); runProperties9.Append(noProof7); runProperties9.Append(webHidden5); runProperties9.Append(fontSize10); runProperties9.Append(fontSizeComplexScript10); FieldChar fieldChar4 = new FieldChar() { FieldCharType = FieldCharValues.Separate }; run9.Append(runProperties9); run9.Append(fieldChar4); Run run10 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties10 = new RunProperties(); RunFonts runFonts11 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof8 = new NoProof(); WebHidden webHidden6 = new WebHidden(); FontSize fontSize11 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript11 = new FontSizeComplexScript() { Val = "20" }; runProperties10.Append(runFonts11); runProperties10.Append(noProof8); runProperties10.Append(webHidden6); runProperties10.Append(fontSize11); runProperties10.Append(fontSizeComplexScript11); Text text2 = new Text(); text2.Text = "2"; run10.Append(runProperties10); run10.Append(text2); Run run11 = new Run() { RsidRunProperties = "00D36A28", RsidRunAddition = "00D36A28" }; RunProperties runProperties11 = new RunProperties(); RunFonts runFonts12 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" }; NoProof noProof9 = new NoProof(); WebHidden webHidden7 = new WebHidden(); FontSize fontSize12 = new FontSize() { Val = "20" }; FontSizeComplexScript fontSizeComplexScript12 = new FontSizeComplexScript() { Val = "20" }; runProperties11.Append(runFonts12); runProperties11.Append(noProof9); runProperties11.Append(webHidden7); runProperties11.Append(fontSize12); runProperties11.Append(fontSizeComplexScript12); FieldChar fieldChar5 = new FieldChar() { FieldCharType = FieldCharValues.End }; run11.Append(runProperties11); run11.Append(fieldChar5); hyperlink1.Append(run4); hyperlink1.Append(run5); hyperlink1.Append(run6); hyperlink1.Append(run7); hyperlink1.Append(run8); hyperlink1.Append(run9); hyperlink1.Append(run10); hyperlink1.Append(run11); paragraph1.Append(paragraphProperties1); paragraph1.Append(run1); paragraph1.Append(bookmarkEnd1); paragraph1.Append(bookmarkEnd2); paragraph1.Append(bookmarkEnd3); paragraph1.Append(run2); paragraph1.Append(run3); paragraph1.Append(hyperlink1); return(paragraph1); }