Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / PageLayout Class / InsertPageBreaks Method
The index that corresponds to the targeted Row; a page break will be added on top of that Row.
The index that corresponds to the targeted Column; a page break will be added to the left of this Column.
Example


In This Topic
    InsertPageBreaks Method
    In This Topic
    Inserts page breaks in the Worksheet, using a Row & a Column to determine where those page breaks will be inserted.
    Syntax
    'Declaration
     
    
    Public Sub InsertPageBreaks( _
       ByVal row As Integer, _
       ByVal columns As Integer _
    ) 
    'Usage
     
    
    Dim instance As PageLayout
    Dim row As Integer
    Dim columns As Integer
     
    instance.InsertPageBreaks(row, columns)
    public void InsertPageBreaks( 
       int row,
       int columns
    )

    Parameters

    row
    The index that corresponds to the targeted Row; a page break will be added on top of that Row.
    columns
    The index that corresponds to the targeted Column; a page break will be added to the left of this Column.
    Example
    public static void PageMarginsAndPageBreaks()
    {
      using( var workbook = Workbook.Create( PageLayoutSample.PageLayoutSampleOutputDirectory + @"PageMarginsAndBreaks.xlsx" ))
        {
          // Gets the first worksheet; a workbook always contains at least 1 worksheet.
          var worksheet = workbook.Worksheets[0];
    	  
          // Adds a title.
          worksheet.Cells["B1"].Value = "Page Margins and Breaks";
          worksheet.Cells["B1"].Style.Font = new Font() {Bold = true, Size = 15.5d};
    	  
          // Inserts two page breaks at the same time, using a column & a row as a reference point for the insertion.
          worksheet.PageLayout.InsertPageBreaks(444, 1111); 
    	   
          // Saves workbook to disk.
          workbook.Save();
          Console.WriteLine( "/tCreated:PageMarginsAndBreaks.xlsx/n" );
        }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also