Break
Break element is an inline-level flow content element, which indicates that a break should be placed at the current position. There are three types of breaks:
Line Break: Breaks the current line and starts a new one.
Page Break: Breaks the current page and starts a new one.
Column Break: Breaks the current section column and starts a new one. If the current section is not divided into columns, or the column break occurs in the last column on the current page, then the restart location for text will be the next page of the document.
To modify the document content at runtime we recommend using the RadDocumentEditor class when possible, instead of working with
RadDocument
directly. The document editor ensures that the document will be measured and arranged properly on each change.
Inserting a Break
The Break elements can be used only in the context of a Paragraph element. The Paragraph exposes a collection of Inlines, to which the breaks can be added. Example 1 shows how to achieve this.
Example 1: Insert a break
// inserting a break in the Section object directly
Section section = new Section();
Paragraph paragraph = new Paragraph();
Break br = new Break(BreakType.PageBreak);
paragraph.Inlines.Add(br);
section.Blocks.Add(paragraph);
// inserting a break at the caret position using RadDocumentEditor
var editor = new RadDocumentEditor(this.richTextBox.Document);
editor.InsertPageBreak();
Dim section As New Section()
Dim paragraph As New Paragraph()
Dim break As Break = New Break(BreakType.PageBreak)
paragraph.Inlines.Add(break)
section.Blocks.Add(paragraph)
Modifying a Break
The Break element exposes a BreakType property, which specifies the type of the break. Example 2 demonstrates how to change it.
Example 2: Modify a break
br.BreakType = BreakType.LineBreak;