To add columns to a page, use the Add method.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
// Make the document. MakeDoc(); // Generate the document. this.c1PrintDocument1.Generate(); |
To write code in C#
C# |
Copy Code
|
---|---|
' Make the document. MakeDoc() ' Generate the document. Me.C1PrintDocument1.Generate() |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub MakeDoc() ' Create page layout. Dim pl As New C1.C1Preview.PageLayout ' Add columns. pl.Columns.Add() pl.Columns.Add() pl.PageSettings = New C1.C1Preview.C1PageSettings() Me.C1PrintDocument1.PageLayouts.Default = pl ' Create RenderText1. Dim rt1 As New C1.C1Preview.RenderText rt1.Text = "This is the house that Jack built. This is the carrot, that lay in the house that Jack built. This is the rat, that ate the carrot, that lay in the house that Jack built. This is the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built." ' Insert column break. rt1.BreakAfter = C1.C1Preview.BreakEnum.Column ' Create RenderText2. Dim rt2 As New C1.C1Preview.RenderText rt2.Text = "This is the dog that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built." ' Insert column break. rt2.BreakAfter = C1.C1Preview.BreakEnum.Column ' Create RenderText3. Dim rt3 As New C1.C1Preview.RenderText rt3.Text = "This is the priest all shaven and shorn, that married the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the cock that crowed in the morn, that waked the priest all shaven and shorn, that married the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the farmer sowing the corn, that kept the cock that crowed in the morn, that waked the priest all shaven and shorn, that married the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built." ' Add the RenderText to the document. Me.C1PrintDocument1.Body.Children.Add(rt1) Me.C1PrintDocument1.Body.Children.Add(rt2) Me.C1PrintDocument1.Body.Children.Add(rt3) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
public void MakeDoc() { // Create page layout. C1.C1Preview.PageLayout pl = new C1.C1Preview.PageLayout(); // Add columns. pl.Columns.Add(); pl.Columns.Add(); pl.PageSettings = new C1.C1Preview.C1PageSettings(); this.c1PrintDocument1.PageLayouts.Default = pl; // Create RenderText1. C1.C1Preview.RenderText rt1 = new C1.C1Preview.RenderText(); rt1.Text = "This is the house that Jack built. This is the carrot, that lay in the house that Jack built. This is the rat, that ate the carrot, that lay in the house that Jack built. This is the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built."; // Insert column break. rt1.BreakAfter = C1.C1Preview.BreakEnum.Column; // Create RenderText2. C1.C1Preview.RenderText rt2 = new C1.C1Preview.RenderText(); rt2.Text = "This is the dog that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built."; // Insert column break. rt2.BreakAfter = C1.C1Preview.BreakEnum.Column; // Create RenderText3. C1.C1Preview.RenderText rt3 = new C1.C1Preview.RenderText(); rt3.Text = "This is the priest all shaven and shorn, that married the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the cock that crowed in the morn, that waked the priest all shaven and shorn, that married the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built. This is the farmer sowing the corn, that kept the cock that crowed in the morn, that waked the priest all shaven and shorn, that married the man all tattered and torn, that kissed the maiden all forlorn, that milked the cow with the crumbled horn, that tossed the dog, that worried the cat, that chased the rat, that ate the carrot, that lay in the house that Jack built."; // Add the RenderText to the document. this.c1PrintDocument1.Body.Children.Add(rt1); this.c1PrintDocument1.Body.Children.Add(rt2); this.c1PrintDocument1.Body.Children.Add(rt3); } |
The text appears in two columns on each page of the document: