Click or drag to resize

Section Constructor (SectionType, String, String, Boolean)

Initializes a new instance of the Section class. Constructor with parameter

Namespace:  SIC.OpenDocumentFormat.MSWord
Assembly:  SIC.OpenDocumentFormat (in SIC.OpenDocumentFormat.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
public Section(
	SectionType pType,
	string pValue,
	string pStyle = "",
	bool pNewParagraph = false
)

Parameters

pType
Type: SIC.OpenDocumentFormat.MSWordSectionType
Type of section
pValue
Type: SystemString
Value of section (text or merge field or file of image)
pStyle (Optional)
Type: SystemString
Style name (must exists in the document)
pNewParagraph (Optional)
Type: SystemBoolean
Add new paragraph?
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.BookmarkAdd("BookmarkTest", lSections);
lDOC.BookmarkAdd("BookmarkTestIntoTable", lSections);
lDOC.Close();
See Also