public void Write(TextWriter writer) { writer.Write("<w:bookmarkStart w:id=\""); writer.Write(this._id); writer.Write("\" w:name=\""); writer.Write(OpenXmlBookmarkModel.CleanseBookmarkName(this._name)); writer.Write("\"/><w:bookmarkEnd w:id=\""); writer.Write(this._id); writer.Write("\"/>"); }
public void Write(TextWriter writer) { writer.Write("<w:r><w:fldChar w:fldCharType=\"begin\" w:fldLock=\"0\" w:dirty=\"0\"/></w:r><w:r><w:rPr><w:noProof/></w:rPr>"); if (this._bookmarkLink) { writer.Write("<w:instrText xml:space=\"preserve\"> HYPERLINK \\l ""); writer.Write(OpenXmlBookmarkModel.CleanseBookmarkName(this._target)); } else { writer.Write("<w:instrText xml:space=\"preserve\"> HYPERLINK ""); writer.Write(OpenXmlFieldGenerators.Escape(this._target)); } writer.Write("" </w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"separate\" w:fldLock=\"0\" w:dirty=\"0\"/></w:r>"); }
public static string CleanseBookmarkName(string name) { StringBuilder stringBuilder = OpenXmlBookmarkModel.EscapeBookmarkText(name); return(stringBuilder.ToString(0, Math.Min(40, stringBuilder.Length))); }