WinForms基于任务报表的帮助 > 打印及预览基于任务的帮助 > 向页面添加分栏 |
通过Add方法添加分栏至一个页面。
Visual Basic
Visual Basic |
拷贝代码
|
---|---|
// 构建文档 MakeDoc(); // 生成文档。 this.c1PrintDocument1.Generate(); |
C#
C# |
拷贝代码
|
---|---|
' 构建文档 MakeDoc() ' 生成文档。 Me.C1PrintDocument1.Generate() |
To write code in Visual Basic
Visual Basic |
拷贝代码
|
---|---|
Private Sub MakeDoc() '创建页面布局。 Dim pl As New C1.C1Preview.PageLayout ' 添加分栏的列 pl.Columns.Add() pl.Columns.Add() pl.PageSettings = New C1.C1Preview.C1PageSettings() Me.C1PrintDocument1.PageLayouts.Default = pl ' 创建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." ' 添加分列符 rt1.BreakAfter = C1.C1Preview.BreakEnum.Column ' 创建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." ' 添加分列符 rt2.BreakAfter = C1.C1Preview.BreakEnum.Column ' 创建RenderText2。 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." ' 将RenderText对象添加至文档。 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# |
拷贝代码
|
---|---|
public void MakeDoc() { //创建页面布局。 C1.C1Preview.PageLayout pl = new C1.C1Preview.PageLayout(); // 添加分栏的列 pl.Columns.Add(); pl.Columns.Add(); pl.PageSettings = new C1.C1Preview.C1PageSettings(); this.c1PrintDocument1.PageLayouts.Default = pl; // 创建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."; // 添加分列符 rt1.BreakAfter = C1.C1Preview.BreakEnum.Column; // 创建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."; // 添加分列符 rt2.BreakAfter = C1.C1Preview.BreakEnum.Column; // 创建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."; // 将RenderText对象添加至文档。 this.c1PrintDocument1.Body.Children.Add(rt1); this.c1PrintDocument1.Body.Children.Add(rt2); this.c1PrintDocument1.Body.Children.Add(rt3); } |
在文档的每一列,文档分栏显示为两列: