Click or drag to resize

BookmarkAdd Method (String, ListSection)

Namespace:  SOWIDocument.Word
Assembly:  SOWIDocument.Word (in SOWIDocument.Word.dll) Version: 22.2.10.1 (22.2.10.450)
Syntax
public void Add(
	string pBookmarkName,
	List<Section> pSectionList
)

Parameters

pBookmarkName
Type: SystemString
Bookmark name to insert pSectionList
pSectionList
Type: System.Collections.GenericListSection
Section objects
Remarks
Examples
This example writes definition sections to document
//* declaration SOWIDocument.Word.Helper OpenDocument Word document *
SOWIDocument.Word.Document lDOC = new SOWIDocument.Word.Document(DOCXFile);;

//* declaration text sections *
List<SOWIDocument.Word.Section> lSections = new List<SOWIDocument.Word.Section>();
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.Text, "Test text 1", pNewParagraph: true));
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.Text, "Text vor MergeField", pNewParagraph: false));
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.Text, " "));
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.MergeField, "TestMergeField1", pNewParagraph: false));
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.Text, " "));
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.Text, "Text nach MergeField", pNewParagraph: true));
lSections.Add(new SOWIDocument.Word.Section(SOWIDocument.Word.Section.Types.Text, "New line after merge field"));

//* "texts" and "merge fields" write to documentation bookmarks (BookmarkTest and BookmarkTestIntoTable") *
lDOC.Bookmark.Add("BookmarkTest", lSections);
lDOC.Bookmark.Add("BookmarkTestIntoTable", lSections);
lDOC.Close();
See Also