Spread Windows Forms 6.0 Product Documentation
Adding a Page Break
Support Options
Spread Windows Forms 6.0 Product Documentation > Developer's Guide > Managing Printing > Customizing the Appearance of the Printing > Adding a Page Break

Glossary Item Box

You can add a force page break before a specified column or row. Page breaks are not displayed on the screen but force page breaks when the sheet is printed. A column page break occurs to the left of the specified column. A row page break occurs above the specified row. To add or set the page breaks, use the SetRowPageBreak and SetColumnPageBreak methods.

You can also retrieve the number of the next column or row in the sheet where a page break occurs. To find the page breaks that are already set, use the GetRowPageBreaks method to return the number of row page breaks and use the GetColumnPageBreaks method to return the number of column page breaks.

You can calculate the number of printed pages for the sheet using the GetPrintPageCount method.

Return to the list for Specifying What to Print.

Using Code

  1. Use one of the set methods on the sheet to set the row page break.

Example

This example sets a row page break and gets the row numbers for the row page breaks.

C# Copy Code
// Add this code to the form load.
 
FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();
 
pi.UseMax =false;
 
fpSpread1.Sheets[0].PrintInfo = pi;
 
fpSpread1.Sheets[0].SetRowPageBreak(5,true);
 
// Add this code to a button click event.
 
int []i;
 
i = fpSpread1.GetRowPageBreaks(0);
 
foreach (object o in i)
 
{
 
    listBox1.Items.Add(o);
 
}
 
VB Copy Code
' Add this code to the form load event.
 
Dim pi As New FarPoint.Win.Spread.PrintInfo()
 
pi.UseMax = False
 
FpSpread1.Sheets(0).PrintInfo = pi
 
FpSpread1.Sheets(0).SetRowPageBreak(5, True)
 
' Add this code to a button click event.
 
Dim i() As Integer
 
Dim o As Object
 
i = FpSpread1.GetRowPageBreaks(0)
 
For Each o In i
 
    ListBox1.Items.Add(o)
 
Next
 

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.