Method InsertSectionBreak
InsertSectionBreak(WordDocument, DocumentPosition, SectionStartKind)
Inserts a section break at a position, as one undoable edit.
public static DocumentEdit InsertSectionBreak(this WordDocument document, DocumentPosition at, SectionStartKind kind)
Parameters
documentWordDocumentThe document that holds the position.
atDocumentPositionWhere the break goes: in a paragraph directly in a section's body (not in a table, a content control, a header or a note).
kindSectionStartKindHow the new section starts: next page, continuous, even page or odd page (next column too).
Returns
- DocumentEdit
The edit; After is the start of the new section.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The position is not in
document, or the kind is not defined.- InvalidOperationException
The position is not in a paragraph directly in a section's body.