WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IHPageBreak

    Show / Hide Table of Contents

    Interface IHPageBreak

    Represents a horizontal page break. The HPageBreak object is a member of the HPageBreaks collection.

    Namespace: Syncfusion.XlsIO
    Assembly: Syncfusion.XlsIO.Base.dll
    Syntax
    public interface IHPageBreak

    Properties

    Application

    Used without an object qualifier, this property returns an IApplication object that represents the Excel IApplication.

    Declaration
    IApplication Application { get; }
    Property Value
    Type Description
    IApplication
    Examples

    The following code illustrates how to access the IApplication property.

          using (ExcelEngine excelEngine = new ExcelEngine())
          {
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
            IWorksheet sheet = workbook.Worksheets[0];         
            //Get Page break with corresponding row
            IHPageBreak hPageBrk = sheet.HPageBreaks.GetPageBreak(5);
    
            //Property returns an Application object that represents the Microsoft Excel application
            IApplication hPageBreakApplication = hPageBrk.Application;
    
            workbook.SaveAs("PageSetup.xlsx");
            workbook.Close();
          }

    Location

    For the HPageBreak and VPageBreak objects, this property returns or sets the cell (a Range object) that defines the page-break location. Horizontal page breaks are aligned with the top edge of the location cell; vertical page breaks are aligned with the left edge of the location cell. Read / write IRange.

    Declaration
    IRange Location { get; set; }
    Property Value
    Type Description
    IRange
    Remarks

    To know more about page setting refer this link.

    Examples

    The following code illustrates the use of Location property.

          using (ExcelEngine excelEngine = new ExcelEngine())
          {
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
            IWorksheet sheet = workbook.Worksheets[0];      
            //Get Page break with corresponding row
            IHPageBreak hPageBrk = sheet.HPageBreaks.GetPageBreak(5);  
    
            //Get the IRange Location
            IRange range = hPageBrk.Location;
    
            //Set the IRange Location
            hPageBrk.Location = sheet.Range["F1:S10"]; 
    
            workbook.SaveAs("PageSetup.xlsx");
            workbook.Close();
          }

    Parent

    Returns the parent object for the specified object.

    Declaration
    object Parent { get; }
    Property Value
    Type Description
    System.Object
    Examples

    The following code illustrates the use of Parent property.

          using (ExcelEngine excelEngine = new ExcelEngine())
          {
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
            IWorksheet sheet = workbook.Worksheets[0];         
            //Get Page break with corresponding row
            IHPageBreak hPageBrk = sheet.HPageBreaks.GetPageBreak(5);        
    
            //The parent object for the specified object
            object hPageBreakParent = hPageBrk.Parent;    
    
            workbook.SaveAs("PageSetup.xlsx");
            workbook.Close();
          }
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved