[Root] / Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / PageLayout Class / InsertPageBreaksAtCell Method
The Address of the Cell that is used as a reference point for the insertion; two page breaks will be added, one on top of the Cell & one at the left of it.
Example


In This Topic
    InsertPageBreaksAtCell Method
    In This Topic
    Inserts page breaks in the Worksheet, using the location of a specific Cell to determine where those page breaks will be inserted.  
    Syntax
    'Declaration
     
    
    Public Sub InsertPageBreaksAtCell( _
       ByVal cellAddress As String _
    ) 
    'Usage
     
    
    Dim instance As PageLayout
    Dim cellAddress As String
     
    instance.InsertPageBreaksAtCell(cellAddress)
    public void InsertPageBreaksAtCell( 
       string cellAddress
    )

    Parameters

    cellAddress
    The Address of the Cell that is used as a reference point for the insertion; two page breaks will be added, one on top of the Cell & one at the left of it.
    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 page breaks using specific cells as a target location for the insertion.
          worksheet.PageLayout.InsertPageBreaksAtCell("B2");
          worksheet.PageLayout.InsertPageBreaksAtCell("C3");
    	  
          // Saves workbook to disk.
          workbook.Save();
          Console.WriteLine( "/tCreated:PageMarginsAndBreaks.xlsx/n" );
        }
    }
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also