Click or drag to resize

BookmarkAdd Method

Add document objects of SectionType

Namespace:  SIC.OpenDocumentFormat.MSWord
Assembly:  SIC.OpenDocumentFormat (in SIC.OpenDocumentFormat.dll) Version: 19.1.23.1 (19.1.23.622)
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 SIC OpenDocument MS Word document *
SIC.OpenDocumentFormat.MSWord.Document lDOC = new SIC.OpenDocumentFormat.MSWord.Document(DOCXFile);;

//* declaration text sections *
List<SIC.OpenDocumentFormat.MSWord.Section> lSections = new List<SIC.OpenDocumentFormat.MSWord.Section>();
lSections.Add(new MSWord.Section(MSWord.SectionType.Text, "Test text 1", pNewParagraph: true));
lSections.Add(new MSWord.Section(MSWord.SectionType.Text, "Text vor MergeField", pNewParagraph: false));
lSections.Add(new MSWord.Section(MSWord.SectionType.Text, " "));
lSections.Add(new MSWord.Section(MSWord.SectionType.MergeField, "TestMergeField1", pNewParagraph: false));
lSections.Add(new MSWord.Section(MSWord.SectionType.Text, " "));
lSections.Add(new MSWord.Section(MSWord.SectionType.Text, "Text nach MergeField", pNewParagraph: true));
lSections.Add(new MSWord.Section(MSWord.SectionType.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