Class HeaderFooter

java.lang.Object
org.apache.poi.hssf.usermodel.HeaderFooter
All Implemented Interfaces:
HeaderFooter
Direct Known Subclasses:
HSSFFooter, HSSFHeader

public abstract class HeaderFooter extends Object implements HeaderFooter
Common class for HSSFHeader and HSSFFooter.
  • Constructor Details

    • HeaderFooter

      protected HeaderFooter()
  • Method Details

    • getRawText

      protected abstract String getRawText()
      Returns:
      the internal text representation (combining center, left and right parts). Possibly empty string if no header or footer is set. Never null.
    • getLeft

      public final String getLeft()
      Description copied from interface: HeaderFooter
      Get the left side of the header or footer.
      Specified by:
      getLeft in interface HeaderFooter
      Returns:
      the left side of the header or footer.
    • setLeft

      public final void setLeft(String newLeft)
      Description copied from interface: HeaderFooter
      Sets the left string.
      Specified by:
      setLeft in interface HeaderFooter
      Parameters:
      newLeft - The string to set as the left side.
    • getCenter

      public final String getCenter()
      Description copied from interface: HeaderFooter
      Get the center of the header or footer.
      Specified by:
      getCenter in interface HeaderFooter
      Returns:
      the center of the header or footer.
    • setCenter

      public final void setCenter(String newCenter)
      Description copied from interface: HeaderFooter
      Sets the center string.
      Specified by:
      setCenter in interface HeaderFooter
      Parameters:
      newCenter - The string to set as the center.
    • getRight

      public final String getRight()
      Description copied from interface: HeaderFooter
      Get the right side of the header or footer.
      Specified by:
      getRight in interface HeaderFooter
      Returns:
      The right side of the header or footer.
    • setRight

      public final void setRight(String newRight)
      Description copied from interface: HeaderFooter
      Sets the right string or footer.
      Specified by:
      setRight in interface HeaderFooter
      Parameters:
      newRight - The string to set as the right side.
    • setHeaderFooterText

      protected abstract void setHeaderFooterText(String text)
      Parameters:
      text - the new header footer text (contains mark-up tags). Possibly empty string never null
    • fontSize

      public static String fontSize(short size)
      Parameters:
      size - the new font size
      Returns:
      The mark-up tag representing a new font size
    • font

      public static String font(String font, String style)
      Parameters:
      font - the new font
      style - the fonts style, one of regular, italic, bold, italic bold or bold italic
      Returns:
      The mark-up tag representing a new font size
    • page

      public static String page()
      Returns:
      The mark-up tag representing the current page number
    • numPages

      public static String numPages()
      Returns:
      The mark-up tag representing the number of pages
    • date

      public static String date()
      Returns:
      The mark-up tag representing the current date date
    • time

      public static String time()
      Returns:
      The mark-up tag representing current time
    • file

      public static String file()
      Returns:
      The mark-up tag representing the current file name
    • tab

      public static String tab()
      Returns:
      The mark-up tag representing the current tab (sheet) name
    • startBold

      public static String startBold()
      Returns:
      The mark-up tag for start bold
    • endBold

      public static String endBold()
      Returns:
      The mark-up tag for end bold
    • startUnderline

      public static String startUnderline()
      Returns:
      The mark-up tag for start underline
    • endUnderline

      public static String endUnderline()
      Returns:
      The mark-up tag for end underline
    • startDoubleUnderline

      public static String startDoubleUnderline()
      Returns:
      The mark-up tag for start double underline
    • endDoubleUnderline

      public static String endDoubleUnderline()
      Returns:
      The mark-up tag for end double underline
    • stripFields

      public static String stripFields(String pText)
      Removes any fields (eg macros, page markers etc) from the string. Normally used to make some text suitable for showing to humans, and the resultant text should not normally be saved back into the document!