org.apache.poi.xssf.usermodel.extensions
Class XSSFHeaderFooter

java.lang.Object
  extended by org.apache.poi.xssf.usermodel.extensions.XSSFHeaderFooter
All Implemented Interfaces:
HeaderFooter
Direct Known Subclasses:
XSSFEvenFooter, XSSFEvenHeader, XSSFFirstFooter, XSSFFirstHeader, XSSFOddFooter, XSSFOddHeader

public abstract class XSSFHeaderFooter
extends java.lang.Object
implements HeaderFooter

Parent class of all XSSF headers and footers. For a list of all the different fields that can be placed into a header or footer, such as page number, bold, underline etc, see the follow formatting syntax Header/Footer Formatting Syntax

There are a number of formatting codes that can be written inline with the actual header / footer text, which affect the formatting in the header or footer.

This example shows the text "Center Bold Header" on the first line (center section), and the date on the second line (center section). &CCenter &"-,Bold"Bold &"-,Regular"Header_x000A_&D General Rules: There is no required order in which these codes must appear. The first occurrence of the following codes turns the formatting ON, the second occurrence turns it OFF again:
&L
code for "left section" (there are three header / footer locations, "left", "center", and "right"). When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the left section.
&P
code for "current page #"
&N
code for "total pages"
&font size
code for "text font size", where font size is a font size in points.
&K
code for "text font color" RGB Color is specified as RRGGBB Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value.
&S
code for "text strikethrough" on / off
&X
code for "text super script" on / off
&Y
code for "text subscript" on / off
&C
code for "center section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the center section. SpreadsheetML Reference Material - Worksheets 1966
&D
code for "date"
&T
code for "time"
&G
code for "picture as background"
&U
code for "text single underline"
&E
code for "double underline"
&R
code for "right section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the right section.
&Z
code for "this workbook's file path"
&F
code for "this workbook's file name"
&A
code for "sheet tab name"
&+
code for add to page #.
&-
code for subtract from page #.
&"font name,font type" - code for "text font name" and "text font type", where font name and font type are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font name, it means "none specified". Both of font name and font type can be localized values.
&"-,Bold"
code for "bold font style"
&B
also means "bold font style"
&"-,Regular"
code for "regular font style"
&"-,Italic"
code for "italic font style"
&I
also means "italic font style"
&"-,Bold Italic"
code for "bold italic font style"
&O
code for "outline style"
&H
code for "shadow style"


Constructor Summary
XSSFHeaderFooter(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter headerFooter)
          Create an instance of XSSFHeaderFooter from the supplied XML bean
 
Method Summary
 boolean areFieldsStripped()
          Are fields currently being stripped from the text that this XSSFHeaderFooter returns? Default is false, but can be changed
 java.lang.String getCenter()
          get the text representing the center part of this element
 org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter getHeaderFooter()
          Returns the underlying CTHeaderFooter xml bean
 java.lang.String getLeft()
          get the text representing the left part of this element
 java.lang.String getRight()
          get the text representing the right part of this element
abstract  java.lang.String getText()
           
 java.lang.String getValue()
           
 void setAreFieldsStripped(boolean stripFields)
          Should fields (eg macros) be stripped from the text that this class returns? Default is not to strip.
 void setCenter(java.lang.String newCenter)
          set a centered string value for this element
 void setLeft(java.lang.String newLeft)
          set a left string value for this element
 void setRight(java.lang.String newRight)
          set a right string value for this element
protected abstract  void setText(java.lang.String text)
           
static java.lang.String stripFields(java.lang.String text)
          Removes any fields (eg macros, page markers etc) from the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSSFHeaderFooter

public XSSFHeaderFooter(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter headerFooter)
Create an instance of XSSFHeaderFooter from the supplied XML bean

Parameters:
headerFooter -
Method Detail

getHeaderFooter

@Internal
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter getHeaderFooter()
Returns the underlying CTHeaderFooter xml bean

Returns:
the underlying CTHeaderFooter xml bean

getValue

public java.lang.String getValue()

areFieldsStripped

public boolean areFieldsStripped()
Are fields currently being stripped from the text that this XSSFHeaderFooter returns? Default is false, but can be changed


setAreFieldsStripped

public void setAreFieldsStripped(boolean stripFields)
Should fields (eg macros) be stripped from the text that this class returns? Default is not to strip.

Parameters:
stripFields -

stripFields

public static java.lang.String stripFields(java.lang.String text)
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!


getText

public abstract java.lang.String getText()

setText

protected abstract void setText(java.lang.String text)

getCenter

public java.lang.String getCenter()
get the text representing the center part of this element

Specified by:
getCenter in interface HeaderFooter

getLeft

public java.lang.String getLeft()
get the text representing the left part of this element

Specified by:
getLeft in interface HeaderFooter

getRight

public java.lang.String getRight()
get the text representing the right part of this element

Specified by:
getRight in interface HeaderFooter

setCenter

public void setCenter(java.lang.String newCenter)
set a centered string value for this element

Specified by:
setCenter in interface HeaderFooter

setLeft

public void setLeft(java.lang.String newLeft)
set a left string value for this element

Specified by:
setLeft in interface HeaderFooter

setRight

public void setRight(java.lang.String newRight)
set a right string value for this element

Specified by:
setRight in interface HeaderFooter