[]
        
(Showing Draft Content)

IHPageBreaks

Interface IHPageBreaks

All Superinterfaces:
Iterable<IHPageBreak>

public interface IHPageBreaks extends Iterable<IHPageBreak>
Represents the collection of horizontal page breaks within the print area.

Use this collection to enumerate existing horizontal page breaks, retrieve a page break by index, or add a new break above a specified range. Obtain an instance from IWorksheet.getHPageBreaks().


 worksheet.getHPageBreaks().add(worksheet.getRange("A10"));
 IHPageBreaks pageBreaks = worksheet.getHPageBreaks();
 IHPageBreak pageBreak = pageBreaks.get(0);
 
  • Method Details

    • getCount

      int getCount()
      Returns the number of horizontal page breaks in the collection.

      Use this method to determine how many horizontal page breaks are currently in the collection returned by IWorksheet.getHPageBreaks().

      
       worksheet.getHPageBreaks().add(worksheet.getRange("A4"));
       int count = worksheet.getHPageBreaks().getCount();
       
      Returns:
      The number of horizontal page breaks in the collection.
    • get

      IHPageBreak get(int index)
      Gets the IHPageBreak by index.

      The index is zero-based. An IndexOutOfBoundsException is thrown if the index is outside the collection.

      
       worksheet.getHPageBreaks().add(worksheet.getRange("A4"));
       IHPageBreak pageBreak = worksheet.getHPageBreaks().get(0);
       
      Parameters:
      index - The zero-based index of the horizontal page break.
      Returns:
      The IHPageBreak object at the specified index.
      Throws:
      IndexOutOfBoundsException - if index is outside the collection.
    • add

      IHPageBreak add(IRange before)
      Adds a horizontal page break within the print area.

      The new page break is inserted above the specified range. Use IWorksheet.getHPageBreaks() to access the collection of horizontal page breaks for a worksheet.

      
       worksheet.getRange("A1:B5").setValue(new Object[][] {
           {"Name", "Value"}, {"A", 100}, {"B", 200}, {"C", 300}, {"D", 400}
       });
       IRange before = worksheet.getRange("A4");
       IHPageBreak pageBreak = worksheet.getHPageBreaks().add(before);
       
      Parameters:
      before - The range above which the new page break will be added.
      Returns:
      The new IHPageBreak object.