Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / PageLayout Class / ResetAllPageBreaks Method
Example


In This Topic
    ResetAllPageBreaks Method
    In This Topic
    Resets all page breaks to their default state. 
    Syntax
    'Declaration
     
    
    Public Sub ResetAllPageBreaks() 
    'Usage
     
    
    Dim instance As PageLayout
     
    instance.ResetAllPageBreaks()
    public void ResetAllPageBreaks()
    Remarks
    This will remove all page breaks that were manually added to the Worksheet & keep only those that were automatically added, like all page breaks related to PaperSize, for example. 
    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
          worksheet.PageLayout.InsertPageBreakRow(3);
          worksheet.PageLayout.InsertPageBreakRow(5);
    	  
          // Resets all page breaks
          worksheet.PageLayout.ResetAllPageBreaks();
    	  
          // 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