To insert a page break, use the BreakAfter property for the RenderObject.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Make the document. MakeDoc() ' Generate the document. Me.C1PrintDocument1.Generate() |
To write code in C#
C# |
Copy Code
|
---|---|
// Make the document. MakeDoc(); // Generate the document. this.c1PrintDocument1.Generate(); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub MakeDoc() ' Create RenderText. Dim rt1 As New C1.C1Preview.RenderText rt1.Text = "This is RenderText. A RenderImage will be on page 2 and a RenderGraphic on page 3." ' Add a page break. rt1.BreakAfter = C1.C1Preview.BreakEnum.Page ' Create RenderImage. Dim ri1 As New C1.C1Preview.RenderImage ri1.Image = System.Drawing.Image.FromFile("c:\c1logo.bmp") ' Add a page break. ri1.BreakAfter = C1.C1Preview.BreakEnum.Page ' Create a RenderGraphic. Dim rg1 As New C1.C1Preview.RenderGraphics() rg1.Graphics.FillEllipse(Brushes.DarkBlue, 200, 200, 150, 150) rg1.Graphics.FillPie(Brushes.DarkRed, 200, 200, 150, 150, -45, 75) ' Add the RenderObjects to the document. Me.C1PrintDocument1.Body.Children.Add(rt1) Me.C1PrintDocument1.Body.Children.Add(ri1) Me.C1PrintDocument1.Body.Children.Add(rg1) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void MakeDoc() { // Create RenderText. C1.C1Preview.RenderText rt1 = new C1.C1Preview.RenderText(); rt1.Text = "This is RenderText. A RenderImage will be on page 2 and a RenderGraphic on page 3."; // Add a page break. rt1.BreakAfter = C1.C1Preview.BreakEnum.Page; // Create RenderImage. C1.C1Preview.RenderImage ri1 = new C1.C1Preview.RenderImage(); ri1.Image = System.Drawing.Image.FromFile("c:\\c1logo.bmp"); // Add a page break. ri1.BreakAfter = C1.C1Preview.BreakEnum.Page; // Create a RenderGraphic. C1.C1Preview.RenderGraphics rg1 = new C1.C1Preview.RenderGraphics(); rg1.Graphics.FillEllipse(Brushes.DarkBlue, 200, 200, 150, 150); rg1.Graphics.FillPie(Brushes.DarkRed, 200, 200, 150, 150, -45, 75); // Add the RenderObjects to the document. this.c1PrintDocument1.Body.Children.Add(rt1); this.c1PrintDocument1.Body.Children.Add(ri1); this.c1PrintDocument1.Body.Children.Add(rg1); } |
A page break is inserted between the different RenderObjects: