org.apache.poi.xssf.usermodel
Class XSSFFont

java.lang.Object
  extended by org.apache.poi.xssf.usermodel.XSSFFont
All Implemented Interfaces:
Font

public class XSSFFont
extends java.lang.Object
implements Font

Represents a font used in a workbook.

Author:
Gisella Bronzetti

Field Summary
static short DEFAULT_FONT_COLOR
          Default font color is black
static java.lang.String DEFAULT_FONT_NAME
          By default, Microsoft Office Excel 2007 uses the Calibry font in font size 11
static short DEFAULT_FONT_SIZE
          By default, Microsoft Office Excel 2007 uses the Calibry font in font size 11
 
Fields inherited from interface org.apache.poi.ss.usermodel.Font
ANSI_CHARSET, BOLDWEIGHT_BOLD, BOLDWEIGHT_NORMAL, COLOR_NORMAL, COLOR_RED, DEFAULT_CHARSET, SS_NONE, SS_SUB, SS_SUPER, SYMBOL_CHARSET, U_DOUBLE, U_DOUBLE_ACCOUNTING, U_NONE, U_SINGLE, U_SINGLE_ACCOUNTING
 
Constructor Summary
protected XSSFFont()
          Create a new XSSFont.
  XSSFFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont font)
          Create a new XSSFFont
  XSSFFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont font, int index)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 boolean getBold()
          get a boolean value for the boldness to use.
 short getBoldweight()
          get the boldness to use
 int getCharSet()
          get character-set to use.
 short getColor()
          get the indexed color value for the font References a color defined in IndexedColors.
 org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont getCTFont()
          get the underlying CTFont font
 int getFamily()
          get the font family to use.
 short getFontHeight()
          get the font height in point.
 short getFontHeightInPoints()
          get the font height
 java.lang.String getFontName()
          get the name of the font (i.e.
 short getIndex()
          get the index within the XSSFWorkbook (sequence within the collection of Font objects)
 boolean getItalic()
          get a boolean value that specify whether to use italics or not
 FontScheme getScheme()
          get the font scheme property.
 boolean getStrikeout()
          get a boolean value that specify whether to use a strikeout horizontal line through the text or not
 short getThemeColor()
          get the color value for the font References a color defined in theme.
 short getTypeOffset()
          get normal,super or subscript.
 byte getUnderline()
          get type of text underlining to use
 XSSFColor getXSSFColor()
          get the color value for the font References a color defined as Standard Alpha Red Green Blue color value (ARGB).
 int hashCode()
           
 long registerTo(StylesTable styles)
          Perform a registration of ourselves to the style table
 void setBold(boolean bold)
          set a boolean value for the boldness to use.
 void setBoldweight(short boldweight)
           
 void setCharSet(byte charset)
          set character-set to use.
 void setCharSet(FontCharset charSet)
          set character-set to use.
 void setCharSet(int charset)
          set character-set to use.
 void setColor(short color)
          set the indexed color for the font
 void setColor(XSSFColor color)
          set the color for the font in Standard Alpha Red Green Blue color value
 void setFamily(FontFamily family)
          set an enumeration representing the font family this font belongs to.
 void setFamily(int value)
          Set the font family this font belongs to.
 void setFontHeight(double height)
          set the font height in points.
 void setFontHeight(short height)
          set the font height in points.
 void setFontHeightInPoints(short height)
          set the font height in points.
 void setFontName(java.lang.String name)
          set the name for the font (i.e.
 void setItalic(boolean italic)
          set a boolean value for the property specifying whether to use italics or not If omitted, the default value is true.
 void setScheme(FontScheme scheme)
          set font scheme property
 void setStrikeout(boolean strikeout)
          set a boolean value for the property specifying whether to use a strikeout horizontal line through the text or not If omitted, the default value is true.
 void setThemeColor(short theme)
          set the theme color for the font to use
 void setThemesTable(ThemesTable themes)
          Records the Themes Table that is associated with the current font, used when looking up theme based colours and properties.
 void setTypeOffset(short offset)
          set normal,super or subscript, that representing the vertical-alignment setting.
 void setUnderline(byte underline)
          set the style of underlining that is used.
 void setUnderline(FontUnderline underline)
          set an enumeration representing the style of underlining that is used.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FONT_NAME

public static final java.lang.String DEFAULT_FONT_NAME
By default, Microsoft Office Excel 2007 uses the Calibry font in font size 11

See Also:
Constant Field Values

DEFAULT_FONT_SIZE

public static final short DEFAULT_FONT_SIZE
By default, Microsoft Office Excel 2007 uses the Calibry font in font size 11

See Also:
Constant Field Values

DEFAULT_FONT_COLOR

public static final short DEFAULT_FONT_COLOR
Default font color is black

See Also:
IndexedColors.BLACK
Constructor Detail

XSSFFont

public XSSFFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont font)
Create a new XSSFFont

Parameters:
font - the underlying CTFont bean

XSSFFont

public XSSFFont(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont font,
                int index)

XSSFFont

protected XSSFFont()
Create a new XSSFont. This method is protected to be used only by XSSFWorkbook

Method Detail

getCTFont

@Internal
public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont getCTFont()
get the underlying CTFont font


getBold

public boolean getBold()
get a boolean value for the boldness to use.

Returns:
boolean - bold

getCharSet

public int getCharSet()
get character-set to use.

Specified by:
getCharSet in interface Font
Returns:
int - character-set (0-255)
See Also:
FontCharset

getColor

public short getColor()
get the indexed color value for the font References a color defined in IndexedColors.

Specified by:
getColor in interface Font
Returns:
short - indexed color to use
See Also:
IndexedColors

getXSSFColor

public XSSFColor getXSSFColor()
get the color value for the font References a color defined as Standard Alpha Red Green Blue color value (ARGB).

Returns:
XSSFColor - rgb color to use

getThemeColor

public short getThemeColor()
get the color value for the font References a color defined in theme.

Returns:
short - theme defined to use

getFontHeight

public short getFontHeight()
get the font height in point.

Specified by:
getFontHeight in interface Font
Returns:
short - height in point
See Also:
Font.getFontHeightInPoints()

getFontHeightInPoints

public short getFontHeightInPoints()
Description copied from interface: Font
get the font height

Specified by:
getFontHeightInPoints in interface Font
Returns:
short - height in the familiar unit of measure - points
See Also:
getFontHeight()

getFontName

public java.lang.String getFontName()
get the name of the font (i.e. Arial)

Specified by:
getFontName in interface Font
Returns:
String - a string representing the name of the font to use

getItalic

public boolean getItalic()
get a boolean value that specify whether to use italics or not

Specified by:
getItalic in interface Font
Returns:
boolean - value for italic

getStrikeout

public boolean getStrikeout()
get a boolean value that specify whether to use a strikeout horizontal line through the text or not

Specified by:
getStrikeout in interface Font
Returns:
boolean - value for strikeout

getTypeOffset

public short getTypeOffset()
get normal,super or subscript.

Specified by:
getTypeOffset in interface Font
Returns:
short - offset type to use (none,super,sub)
See Also:
Font.SS_NONE, Font.SS_SUPER, Font.SS_SUB

getUnderline

public byte getUnderline()
get type of text underlining to use

Specified by:
getUnderline in interface Font
Returns:
byte - underlining type
See Also:
FontUnderline

setBold

public void setBold(boolean bold)
set a boolean value for the boldness to use. If omitted, the default value is true.

Parameters:
bold - - boldness to use

setBoldweight

public void setBoldweight(short boldweight)
Specified by:
setBoldweight in interface Font

getBoldweight

public short getBoldweight()
get the boldness to use

Specified by:
getBoldweight in interface Font
Returns:
boldweight
See Also:
Font.BOLDWEIGHT_NORMAL, Font.BOLDWEIGHT_BOLD

setCharSet

public void setCharSet(byte charset)
set character-set to use.

Specified by:
setCharSet in interface Font
Parameters:
charset - - charset
See Also:
FontCharset

setCharSet

public void setCharSet(int charset)
set character-set to use.

Specified by:
setCharSet in interface Font
Parameters:
charset - - charset
See Also:
FontCharset

setCharSet

public void setCharSet(FontCharset charSet)
set character-set to use.

Parameters:
charSet -

setColor

public void setColor(short color)
set the indexed color for the font

Specified by:
setColor in interface Font
Parameters:
color - - color to use
See Also:
- Note: default font color, IndexedColors

setColor

public void setColor(XSSFColor color)
set the color for the font in Standard Alpha Red Green Blue color value

Parameters:
color - - color to use

setFontHeight

public void setFontHeight(short height)
set the font height in points.

Specified by:
setFontHeight in interface Font
Parameters:
height - - height in points
See Also:
Font.setFontHeightInPoints(short)

setFontHeight

public void setFontHeight(double height)
set the font height in points.

Parameters:
height - - height in points

setFontHeightInPoints

public void setFontHeightInPoints(short height)
set the font height in points.

Specified by:
setFontHeightInPoints in interface Font
Parameters:
height - height in the familiar unit of measure - points
See Also:
Font.setFontHeight(short)

setThemeColor

public void setThemeColor(short theme)
set the theme color for the font to use

Parameters:
theme - - theme color to use

setFontName

public void setFontName(java.lang.String name)
set the name for the font (i.e. Arial). If the font doesn't exist (because it isn't installed on the system), or the charset is invalid for that font, then another font should be substituted. The string length for this attribute shall be 0 to 31 characters. Default font name is Calibri.

Specified by:
setFontName in interface Font
Parameters:
name - - value representing the name of the font to use
See Also:
DEFAULT_FONT_NAME

setItalic

public void setItalic(boolean italic)
set a boolean value for the property specifying whether to use italics or not If omitted, the default value is true.

Specified by:
setItalic in interface Font
Parameters:
italic - - value for italics or not

setStrikeout

public void setStrikeout(boolean strikeout)
set a boolean value for the property specifying whether to use a strikeout horizontal line through the text or not If omitted, the default value is true.

Specified by:
setStrikeout in interface Font
Parameters:
strikeout - - value for strikeout or not

setTypeOffset

public void setTypeOffset(short offset)
set normal,super or subscript, that representing the vertical-alignment setting. Setting this to either subscript or superscript shall make the font size smaller if a smaller font size is available.

Specified by:
setTypeOffset in interface Font
Parameters:
offset - - offset type to use (none,super,sub)
See Also:
Font.SS_NONE, Font.SS_SUPER, Font.SS_SUB

setUnderline

public void setUnderline(byte underline)
set the style of underlining that is used. The none style is equivalent to not using underlining at all.

Specified by:
setUnderline in interface Font
Parameters:
underline - - underline type to use
See Also:
FontUnderline

setUnderline

public void setUnderline(FontUnderline underline)
set an enumeration representing the style of underlining that is used. The none style is equivalent to not using underlining at all. The possible values for this attribute are defined by the FontUnderline

Parameters:
underline - - FontUnderline enum value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

registerTo

public long registerTo(StylesTable styles)
Perform a registration of ourselves to the style table


setThemesTable

public void setThemesTable(ThemesTable themes)
Records the Themes Table that is associated with the current font, used when looking up theme based colours and properties.


getScheme

public FontScheme getScheme()
get the font scheme property. is used only in StylesTable to create the default instance of font

Returns:
FontScheme
See Also:
StylesTable.createDefaultFont()

setScheme

public void setScheme(FontScheme scheme)
set font scheme property

Parameters:
scheme - - FontScheme enum value
See Also:
FontScheme

getFamily

public int getFamily()
get the font family to use.

Returns:
the font family to use
See Also:
FontFamily

setFamily

public void setFamily(int value)
Set the font family this font belongs to. A font family is a set of fonts having common stroke width and serif characteristics. The font name overrides when there are conflicting values.

Parameters:
value - - font family
See Also:
FontFamily

setFamily

public void setFamily(FontFamily family)
set an enumeration representing the font family this font belongs to. A font family is a set of fonts having common stroke width and serif characteristics.

Parameters:
family - font family

getIndex

public short getIndex()
get the index within the XSSFWorkbook (sequence within the collection of Font objects)

Specified by:
getIndex in interface Font
Returns:
unique index number of the underlying record this Font represents (probably you don't care unless you're comparing which one is which)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.