DocumentBuilderStartBookmark Method |
Namespace: Aspose.Words
Bookmarks in a document can overlap and span any range. To create a valid bookmark you need to call both StartBookmark(String) and EndBookmark(String) with the same bookmarkName parameter.
Badly formed bookmarks or bookmarks with duplicate names will be ignored when the document is saved.
DocumentBuilder builder = new DocumentBuilder(); builder.StartBookmark("MyBookmark"); builder.Writeln("Text inside a bookmark."); builder.EndBookmark("MyBookmark");
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.StartBookmark("Bookmark1"); builder.Write("Bookmarked text."); builder.EndBookmark("Bookmark1"); builder.Writeln("Some other text"); // Specify font formatting for the hyperlink builder.Font.Color = Color.Blue; builder.Font.Underline = Underline.Single; // Insert hyperlink // Switch \o is used to provide hyperlink tip text builder.InsertHyperlink("Hyperlink Text", @"Bookmark1"" \o ""Hyperlink Tip", true); // Clear hyperlink formatting builder.Font.ClearFormatting(); doc.Save(ArtifactsDir + "DocumentBuilder.InsertHyperlinkToLocalBookmark.doc");