Inheritance Hierarchy Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.11.20
Syntax public sealed class BookmarkCollection : ICollection<Bookmark>,
IEnumerable<Bookmark>, IEnumerable
Public NotInheritable Class BookmarkCollection
Implements ICollection(Of Bookmark), IEnumerable(Of Bookmark),
IEnumerable
The BookmarkCollection type exposes the following members.
Properties Methods | Name | Description |
---|
| Clear |
Removes all items from the ICollectionT.
|
| Contains |
Determines whether the ICollectionT contains a specific value.
|
| CopyTo |
Copies the elements of the ICollectionT to an
Array, starting at a particular Array index.
|
| GetEnumerator |
Gets an enumerator that iterates through the collection.
|
| IndexOf |
Determines the index of a specific item in the IListT.
|
| Remove |
Removes the first occurrence of a specific object from the ICollectionT.
|
| RemoveAt |
Removes the IListT item at the specified index.
|
TopExample See Developer Guide: How add a text bounded by BookmarkStart and BookmarkEnd
How add a text bounded by BookmarkStart and BookmarkEnd using C#
using SautinSoft.Document;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
AddBookmarks();
}
public static void AddBookmarks()
{
string documentPath = @"Bookmarks.docx";
DocumentCore dc = new DocumentCore();
dc.Sections.Add(
new Section(dc,
new Paragraph(dc,
new Run(dc, "Text before bookmark. "),
new BookmarkStart(dc, "SimpleBookmark"),
new Run(dc, "Text inside bookmark."),
new BookmarkEnd(dc, "SimpleBookmark"),
new Run(dc, " Text after bookmark.")),
new Paragraph(dc,
new SpecialCharacter(dc, SpecialCharacterType.PageBreak),
new Hyperlink(dc, "SimpleBookmark", "Go to Simple Bookmark.") { IsBookmarkLink = true })));
dc.Bookmarks["SimpleBookmark"].GetContent(false).Replace("Some text inside bookmark.");
dc.Save(documentPath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath) { UseShellExecute = true });
}
}
}
How add a text bounded by BookmarkStart and BookmarkEnd using VB.Net
Imports SautinSoft.Document
Namespace Sample
Friend Class Sample
Shared Sub Main(ByVal args() As String)
AddBookmarks()
End Sub
Public Shared Sub AddBookmarks()
Dim documentPath As String = "Bookmarks.docx"
Dim dc As New DocumentCore()
dc.Sections.Add(New Section(dc, New Paragraph(dc, New Run(dc, "Text before bookmark. "), New BookmarkStart(dc, "SimpleBookmark"), New Run(dc, "Text inside bookmark."), New BookmarkEnd(dc, "SimpleBookmark"), New Run(dc, " Text after bookmark.")), New Paragraph(dc, New SpecialCharacter(dc, SpecialCharacterType.PageBreak), New Hyperlink(dc, "SimpleBookmark", "Go to Simple Bookmark.") With {.IsBookmarkLink = True})))
dc.Bookmarks("SimpleBookmark").GetContent(False).Replace("Some text inside bookmark.")
dc.Save(documentPath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
End Sub
End Class
End Namespace
See Also