org.apache.poi.hssf.usermodel
Class HSSFFont

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFFont
All Implemented Interfaces:
Font

public final class HSSFFont
extends java.lang.Object
implements Font

Represents a Font used in a workbook.

Author:
Andrew C. Oliver
See Also:
HSSFWorkbook.createFont(), HSSFWorkbook.getFontAt(short), HSSFCellStyle.setFont(HSSFFont)

Field Summary
static java.lang.String FONT_ARIAL
          Arial font
 
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 HSSFFont(short index, FontRecord rec)
          Creates a new instance of HSSFFont
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 short getBoldweight()
          get the boldness to use
 int getCharSet()
          get character-set to use.
 short getColor()
          get the color for the font
 short getFontHeight()
          get the font height in unit's of 1/20th of a point.
 short getFontHeightInPoints()
          get the font height
 java.lang.String getFontName()
          get the name for the font (i.e.
 HSSFColor getHSSFColor(HSSFWorkbook wb)
          get the color value for the font
 short getIndex()
          get the index within the HSSFWorkbook (sequence within the collection of Font objects)
 boolean getItalic()
          get whether to use italics or not
 boolean getStrikeout()
          get whether to use a strikeout horizontal line through the text or not
 short getTypeOffset()
          get normal,super or subscript.
 byte getUnderline()
          get type of text underlining to use
 int hashCode()
           
 void setBoldweight(short boldweight)
          set the boldness to use
 void setCharSet(byte charset)
          set character-set to use.
 void setCharSet(int charset)
          set character-set to use.
 void setColor(short color)
          set the color for the font
 void setFontHeight(short height)
          set the font height in unit's of 1/20th of a point.
 void setFontHeightInPoints(short height)
          set the font height
 void setFontName(java.lang.String name)
          set the name for the font (i.e.
 void setItalic(boolean italic)
          set whether to use italics or not
 void setStrikeout(boolean strikeout)
          set whether to use a strikeout horizontal line through the text or not
 void setTypeOffset(short offset)
          set normal,super or subscript.
 void setUnderline(byte underline)
          set type of text underlining to use
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FONT_ARIAL

public static final java.lang.String FONT_ARIAL
Arial font

See Also:
Constant Field Values
Constructor Detail

HSSFFont

protected HSSFFont(short index,
                   FontRecord rec)
Creates a new instance of HSSFFont

Method Detail

setFontName

public void setFontName(java.lang.String name)
set the name for the font (i.e. Arial)

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

getFontName

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

Specified by:
getFontName in interface Font
Returns:
String representing the name of the font to use
See Also:
FONT_ARIAL

getIndex

public short getIndex()
get the index within the HSSFWorkbook (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)

setFontHeight

public void setFontHeight(short height)
set the font height in unit's of 1/20th of a point. Maybe you might want to use the setFontHeightInPoints which matches to the familiar 10, 12, 14 etc..

Specified by:
setFontHeight in interface Font
Parameters:
height - height in 1/20ths of a point
See Also:
setFontHeightInPoints(short)

setFontHeightInPoints

public void setFontHeightInPoints(short height)
set the font height

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

getFontHeight

public short getFontHeight()
get the font height in unit's of 1/20th of a point. Maybe you might want to use the getFontHeightInPoints which matches to the familiar 10, 12, 14 etc..

Specified by:
getFontHeight in interface Font
Returns:
short - height in 1/20ths of a point
See Also:
getFontHeightInPoints()

getFontHeightInPoints

public short getFontHeightInPoints()
get the font height

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

setItalic

public void setItalic(boolean italic)
set whether to use italics or not

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

getItalic

public boolean getItalic()
get whether to use italics or not

Specified by:
getItalic in interface Font
Returns:
italics or not

setStrikeout

public void setStrikeout(boolean strikeout)
set whether to use a strikeout horizontal line through the text or not

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

getStrikeout

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

Specified by:
getStrikeout in interface Font
Returns:
strikeout or not

setColor

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

Specified by:
setColor in interface Font
Parameters:
color - to use
See Also:
Note: Use this rather than HSSFColor.AUTOMATIC for default font color, Font.COLOR_RED

getColor

public short getColor()
get the color for the font

Specified by:
getColor in interface Font
Returns:
color to use
See Also:
Font.COLOR_NORMAL, Font.COLOR_RED, HSSFPalette.getColor(short)

getHSSFColor

public HSSFColor getHSSFColor(HSSFWorkbook wb)
get the color value for the font


setBoldweight

public void setBoldweight(short boldweight)
set the boldness to use

Specified by:
setBoldweight in interface Font
Parameters:
boldweight -
See Also:
Font.BOLDWEIGHT_NORMAL, Font.BOLDWEIGHT_BOLD

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

setTypeOffset

public void setTypeOffset(short offset)
set normal,super or subscript.

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

getTypeOffset

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

Specified by:
getTypeOffset in interface Font
Returns:
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 type of text underlining to use

Specified by:
setUnderline in interface Font
Parameters:
underline - type
See Also:
Font.U_NONE, Font.U_SINGLE, Font.U_DOUBLE, Font.U_SINGLE_ACCOUNTING, Font.U_DOUBLE_ACCOUNTING

getUnderline

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

Specified by:
getUnderline in interface Font
Returns:
underlining type
See Also:
Font.U_NONE, Font.U_SINGLE, Font.U_DOUBLE, Font.U_SINGLE_ACCOUNTING, Font.U_DOUBLE_ACCOUNTING

getCharSet

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

Specified by:
getCharSet in interface Font
Returns:
character-set
See Also:
Font.ANSI_CHARSET, Font.DEFAULT_CHARSET, Font.SYMBOL_CHARSET

setCharSet

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

Specified by:
setCharSet in interface Font
See Also:
Font.ANSI_CHARSET, Font.DEFAULT_CHARSET, Font.SYMBOL_CHARSET

setCharSet

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

Specified by:
setCharSet in interface Font
See Also:
Font.ANSI_CHARSET, Font.DEFAULT_CHARSET, Font.SYMBOL_CHARSET

toString

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

hashCode

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

equals

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


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