Breaks

Text can be broken so it continues in a new line, a new column or a new page.

Following sample demonstrates various text breaks, available through SpecialCharacter inline element.

Screenshot

Breaks Screenshot

See the full code below, use RUN EXAMPLE to execute.


1using System;
2using System.IO;
3using System.Linq;
4using GemBox.Document;
5using GemBox.Document.Drawing;
6
7class Sample
8{
9    [STAThread]
10    static void Main(string[] args)
11    {
12        // If using Professional version, put your serial key below.
13        ComponentInfo.SetLicense("FREE-LIMITED-KEY");
14
15        DocumentModel document = new DocumentModel();
16
17        Section section = new Section(document,
18            new Paragraph(document,
19                new Run(document, "First line."),
20                new SpecialCharacter(document, SpecialCharacterType.LineBreak),
21                new Run(document, "Next line."),
22                new SpecialCharacter(document, SpecialCharacterType.ColumnBreak),
23                new Run(document, "Next column."),
24                new SpecialCharacter(document, SpecialCharacterType.PageBreak),
25                new Run(document, "Next page.")));
26
27        section.PageSetup.TextColumns = new TextColumnCollection(2);
28
29        document.Sections.Add(section);
30
31        document.Save("Breaks.docx");
32    }
33}
1Imports System
2Imports System.IO
3Imports System.Linq
4Imports GemBox.Document
5Imports GemBox.Document.Drawing
6
7Module Samples
8
9    Sub Main()
10
11        ' If using Professional version, put your serial key below.
12        ComponentInfo.SetLicense("FREE-LIMITED-KEY")
13
14        Dim document As DocumentModel = New DocumentModel
15
16        Dim section As New Section(document,
17            New Paragraph(document,
18                New Run(document, "First line."),
19                New SpecialCharacter(document, SpecialCharacterType.LineBreak),
20                New Run(document, "Next line."),
21                New SpecialCharacter(document, SpecialCharacterType.ColumnBreak),
22                New Run(document, "Next column."),
23                New SpecialCharacter(document, SpecialCharacterType.PageBreak),
24                New Run(document, "Next page.")))
25
26        section.PageSetup.TextColumns = New TextColumnCollection(2)
27
28        document.Sections.Add(section)
29
30        document.Save("Breaks.docx")
31
32    End Sub
33
34End Module

Check next sample or find out more about GemBox.Document and GemBox Software.