Package loci.poi.hssf.usermodel
Class HSSFFont
- java.lang.Object
-
- loci.poi.hssf.usermodel.HSSFFont
-
public class HSSFFont extends java.lang.ObjectRepresents a Font used in a workbook.- Version:
- 1.0-pre
- Author:
- Andrew C. Oliver
- See Also:
HSSFWorkbook.createFont(),HSSFWorkbook.getFontAt(short),HSSFCellStyle.setFont(HSSFFont)
-
-
Field Summary
Fields Modifier and Type Field Description static byteANSI_CHARSETANSI character setstatic shortBOLDWEIGHT_BOLDBold boldness (bold)static shortBOLDWEIGHT_NORMALNormal boldness (not bold)static shortCOLOR_NORMALnormal type of black color.static shortCOLOR_REDDark Red colorstatic byteDEFAULT_CHARSETDefault character set.static java.lang.StringFONT_ARIALArial fontstatic shortSS_NONEno type offsetting (not super or subscript)static shortSS_SUBsubscriptstatic shortSS_SUPERsuperscriptstatic byteSYMBOL_CHARSETSymbol character setstatic byteU_DOUBLEdouble underlinedstatic byteU_DOUBLE_ACCOUNTINGaccounting style double underlinestatic byteU_NONEnot underlinedstatic byteU_SINGLEsingle (normal) underlinestatic byteU_SINGLE_ACCOUNTINGaccounting style single underline
-
Constructor Summary
Constructors Modifier Constructor Description protectedHSSFFont(short index, FontRecord rec)Creates a new instance of HSSFFont
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description shortgetBoldweight()get the boldness to usebytegetCharSet()get character-set to use.shortgetColor()get the color for the fontshortgetFontHeight()get the font height in unit's of 1/20th of a point.shortgetFontHeightInPoints()get the font heightjava.lang.StringgetFontName()get the name for the font (i.e.shortgetIndex()get the index within the HSSFWorkbook (sequence within the collection of Font objects)booleangetItalic()get whether to use italics or notbooleangetStrikeout()get whether to use a strikeout horizontal line through the text or notshortgetTypeOffset()get normal,super or subscript.bytegetUnderline()get type of text underlining to usevoidsetBoldweight(short boldweight)set the boldness to usevoidsetCharSet(byte charset)set character-set to use.voidsetColor(short color)set the color for the fontvoidsetFontHeight(short height)set the font height in unit's of 1/20th of a point.voidsetFontHeightInPoints(short height)set the font heightvoidsetFontName(java.lang.String name)set the name for the font (i.e.voidsetItalic(boolean italic)set whether to use italics or notvoidsetStrikeout(boolean strikeout)set whether to use a strikeout horizontal line through the text or notvoidsetTypeOffset(short offset)set normal,super or subscript.voidsetUnderline(byte underline)set type of text underlining to usejava.lang.StringtoString()
-
-
-
Field Detail
-
FONT_ARIAL
public static final java.lang.String FONT_ARIAL
Arial font- See Also:
- Constant Field Values
-
BOLDWEIGHT_NORMAL
public static final short BOLDWEIGHT_NORMAL
Normal boldness (not bold)- See Also:
- Constant Field Values
-
BOLDWEIGHT_BOLD
public static final short BOLDWEIGHT_BOLD
Bold boldness (bold)- See Also:
- Constant Field Values
-
COLOR_NORMAL
public static final short COLOR_NORMAL
normal type of black color.- See Also:
- Constant Field Values
-
COLOR_RED
public static final short COLOR_RED
Dark Red color- See Also:
- Constant Field Values
-
SS_NONE
public static final short SS_NONE
no type offsetting (not super or subscript)- See Also:
- Constant Field Values
-
SS_SUPER
public static final short SS_SUPER
superscript- See Also:
- Constant Field Values
-
SS_SUB
public static final short SS_SUB
subscript- See Also:
- Constant Field Values
-
U_NONE
public static final byte U_NONE
not underlined- See Also:
- Constant Field Values
-
U_SINGLE
public static final byte U_SINGLE
single (normal) underline- See Also:
- Constant Field Values
-
U_DOUBLE
public static final byte U_DOUBLE
double underlined- See Also:
- Constant Field Values
-
U_SINGLE_ACCOUNTING
public static final byte U_SINGLE_ACCOUNTING
accounting style single underline- See Also:
- Constant Field Values
-
U_DOUBLE_ACCOUNTING
public static final byte U_DOUBLE_ACCOUNTING
accounting style double underline- See Also:
- Constant Field Values
-
ANSI_CHARSET
public static final byte ANSI_CHARSET
ANSI character set- See Also:
- Constant Field Values
-
DEFAULT_CHARSET
public static final byte DEFAULT_CHARSET
Default character set.- See Also:
- Constant Field Values
-
SYMBOL_CHARSET
public static final byte SYMBOL_CHARSET
Symbol character set- 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)- 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)- 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)- 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..- Parameters:
height- height in 1/20ths of a point- See Also:
setFontHeightInPoints(short)
-
setFontHeightInPoints
public void setFontHeightInPoints(short height)
set the font height- 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..- Returns:
- short - height in 1/20ths of a point
- See Also:
getFontHeightInPoints()
-
getFontHeightInPoints
public short getFontHeightInPoints()
get the font height- 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- Parameters:
italic- italics or not
-
getItalic
public boolean getItalic()
get whether to use italics or not- Returns:
- italics or not
-
setStrikeout
public void setStrikeout(boolean strikeout)
set whether to use a strikeout horizontal line through the text or not- Parameters:
strikeout- or not
-
getStrikeout
public boolean getStrikeout()
get whether to use a strikeout horizontal line through the text or not- Returns:
- strikeout or not
-
setColor
public void setColor(short color)
set the color for the font- Parameters:
color- to use- See Also:
Note: Use this rather than HSSFColor.AUTOMATIC for default font color,COLOR_RED
-
getColor
public short getColor()
get the color for the font- Returns:
- color to use
- See Also:
COLOR_NORMAL,COLOR_RED
-
setBoldweight
public void setBoldweight(short boldweight)
set the boldness to use- Parameters:
boldweight-- See Also:
BOLDWEIGHT_NORMAL,BOLDWEIGHT_BOLD
-
getBoldweight
public short getBoldweight()
get the boldness to use- Returns:
- boldweight
- See Also:
BOLDWEIGHT_NORMAL,BOLDWEIGHT_BOLD
-
setTypeOffset
public void setTypeOffset(short offset)
set normal,super or subscript.
-
getTypeOffset
public short getTypeOffset()
get normal,super or subscript.
-
setUnderline
public void setUnderline(byte underline)
set type of text underlining to use- Parameters:
underline- type- See Also:
U_NONE,U_SINGLE,U_DOUBLE,U_SINGLE_ACCOUNTING,U_DOUBLE_ACCOUNTING
-
getUnderline
public byte getUnderline()
get type of text underlining to use- Returns:
- underlining type
- See Also:
U_NONE,U_SINGLE,U_DOUBLE,U_SINGLE_ACCOUNTING,U_DOUBLE_ACCOUNTING
-
getCharSet
public byte getCharSet()
get character-set to use.- Returns:
- character-set
- See Also:
ANSI_CHARSET,DEFAULT_CHARSET,SYMBOL_CHARSET
-
setCharSet
public void setCharSet(byte charset)
set character-set to use.- See Also:
ANSI_CHARSET,DEFAULT_CHARSET,SYMBOL_CHARSET
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-