ページに列を追加するには、Add メソッドを使用します。
Visual Basic コードの書き方
Visual Basic |
コードのコピー
|
---|---|
' ドキュメントを作成します。 MakeDoc(); ' ドキュメントを生成します. this.c1PrintDocument1.Generate(); |
C# コードの書き方
C# |
コードのコピー
|
---|---|
// ドキュメントを作成します。 MakeDoc() // ドキュメントを生成します Me.C1PrintDocument1.Generate() |
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 ' 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." ' RenderText をドキュメントに追加します。 Me.C1PrintDocument1.Body.Children.Add(rt1) Me.C1PrintDocument1.Body.Children.Add(rt2) Me.C1PrintDocument1.Body.Children.Add(rt3) End Sub |
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); } |
ドキュメントの各ページの2列にテキストが表示されます。