[]
        
(Showing Draft Content)

IHeaderFooter

Interface IHeaderFooter


public interface IHeaderFooter
Represents one section of a page header or footer that can contain text or a picture.

Use this object to configure the content shown in a specific header or footer section, such as the center header on the first printed page.


 IPageSetup pageSetup = worksheet.getPageSetup();
 pageSetup.setDifferentFirstPageHeaderFooter(true);
 IHeaderFooter centerHeader = pageSetup.getFirstPage().getCenterHeader();
 centerHeader.setText("&G");
 IGraphic picture = centerHeader.getPicture();
 try (InputStream stream = createSampleImageStream()) {
     picture.setGraphicStream(stream, ImageType.PNG);
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the IGraphic object that represents a picture field included in the specified header or footer section.
    Gets the text included in the specified header or footer section.
    void
    setText(String value)
    Sets the text included in the specified header or footer section.
  • Method Details

    • getText

      String getText()
      Gets the text included in the specified header or footer section.

      Use this method to retrieve the string currently configured for a page header or footer section.

      
       IPageSetup pageSetup = worksheet.getPageSetup();
       pageSetup.setDifferentFirstPageHeaderFooter(true);
       IHeaderFooter centerHeader = pageSetup.getFirstPage().getCenterHeader();
       centerHeader.setText("Confidential");
       String text = centerHeader.getText();
       
      Returns:
      The text included in the specified header or footer section.
    • setText

      void setText(String value)
      Sets the text included in the specified header or footer section.

      Use this method to configure the string printed in a page header or footer section.

      
       IPageSetup pageSetup = worksheet.getPageSetup();
       pageSetup.setDifferentFirstPageHeaderFooter(true);
       IHeaderFooter centerHeader = pageSetup.getFirstPage().getCenterHeader();
       centerHeader.setText("Confidential");
       
      Parameters:
      value - The text included in the specified header or footer section.
    • getPicture

      IGraphic getPicture()
      Gets the IGraphic object that represents a picture field included in the specified header or footer section.

      Use the returned object to configure the picture shown in this header or footer section.

      
       IPageSetup pageSetup = worksheet.getPageSetup();
       pageSetup.setDifferentFirstPageHeaderFooter(true);
       IHeaderFooter centerHeader = pageSetup.getFirstPage().getCenterHeader();
       centerHeader.setText("&G");
       IGraphic picture = centerHeader.getPicture();
       try (InputStream stream = createSampleImageStream()) {
           picture.setGraphicStream(stream, ImageType.PNG);
       }
       
      Returns:
      An IGraphic object that represents the picture field in the header or footer section.