Spread Windows Forms 8.0 Product Documentation
Adding a Page Break

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.

Using Code

  1. Use the SetRowPageBreak method on the sheet to set the row page break.
  2. Use the GetRowPageBreaks method to get the page breaks.

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
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback