Package org.apache.poi.hssf.usermodel
Class HSSFFont
- java.lang.Object
-
- org.apache.poi.hssf.usermodel.HSSFFont
-
-
Field Summary
Fields Modifier and Type Field Description static StringFONT_ARIALArial font-
Fields inherited from interface org.apache.poi.ss.usermodel.Font
ANSI_CHARSET, COLOR_NORMAL, COLOR_RED, DEFAULT_CHARSET, SS_NONE, SS_SUB, SS_SUPER, SYMBOL_CHARSET, TWIPS_PER_POINT, U_DOUBLE, U_DOUBLE_ACCOUNTING, U_NONE, U_SINGLE, U_SINGLE_ACCOUNTING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHSSFFont(int index, FontRecord rec)Creates a new instance of HSSFFont
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(Object obj)booleangetBold()get if the font is bold or notintgetCharSet()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 heightStringgetFontName()get the name for the font (i.e.HSSFColorgetHSSFColor(HSSFWorkbook wb)get the color value for the fontintgetIndex()get the index within the XSSFWorkbook (sequence within the collection of Font objects)intgetIndexAsInt()Deprecated.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 useinthashCode()voidsetBold(boolean bold)sets the font to be bold or notvoidsetCharSet(byte charset)set character-set to use.voidsetCharSet(int 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(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 useStringtoString()
-
-
-
Field Detail
-
FONT_ARIAL
public static final String FONT_ARIAL
Arial font- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HSSFFont
protected HSSFFont(int index, FontRecord rec)Creates a new instance of HSSFFont
-
-
Method Detail
-
setFontName
public void setFontName(String name)
set the name for the font (i.e. Arial)- Specified by:
setFontNamein interfaceFont- Parameters:
name- String representing the name of the font to use- See Also:
FONT_ARIAL
-
getFontName
public String getFontName()
get the name for the font (i.e. Arial)- Specified by:
getFontNamein interfaceFont- Returns:
- String representing the name of the font to use
- See Also:
FONT_ARIAL
-
getIndex
public int getIndex()
Description copied from interface:Fontget the index within the XSSFWorkbook (sequence within the collection of Font objects)
-
getIndexAsInt
@Deprecated @Removal(version="6.0.0") public int getIndexAsInt()
Deprecated.Description copied from interface:Fontget the index within the XSSFWorkbook (sequence within the collection of Font objects)- Specified by:
getIndexAsIntin interfaceFont- 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:
setFontHeightin interfaceFont- 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:
setFontHeightInPointsin interfaceFont- 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:
getFontHeightin interfaceFont- Returns:
- short - height in 1/20ths of a point
- See Also:
getFontHeightInPoints()
-
getFontHeightInPoints
public short getFontHeightInPoints()
get the font height- Specified by:
getFontHeightInPointsin interfaceFont- 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
-
getItalic
public boolean getItalic()
get whether to use italics or not
-
setStrikeout
public void setStrikeout(boolean strikeout)
set whether to use a strikeout horizontal line through the text or not- Specified by:
setStrikeoutin interfaceFont- Parameters:
strikeout- or not
-
getStrikeout
public boolean getStrikeout()
get whether to use a strikeout horizontal line through the text or not- Specified by:
getStrikeoutin interfaceFont- Returns:
- strikeout or not
-
setColor
public void setColor(short color)
set the color for the font- Specified by:
setColorin interfaceFont- 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:
getColorin interfaceFont- 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
-
setBold
public void setBold(boolean bold)
sets the font to be bold or not
-
getBold
public boolean getBold()
get if the font is bold or not
-
setTypeOffset
public void setTypeOffset(short offset)
set normal,super or subscript.- Specified by:
setTypeOffsetin interfaceFont- 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:
getTypeOffsetin interfaceFont- 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:
setUnderlinein interfaceFont- 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:
getUnderlinein interfaceFont- 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:
getCharSetin interfaceFont- 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:
setCharSetin interfaceFont- See Also:
Font.ANSI_CHARSET,Font.DEFAULT_CHARSET,Font.SYMBOL_CHARSET
-
setCharSet
public void setCharSet(byte charset)
set character-set to use.- Specified by:
setCharSetin interfaceFont- See Also:
Font.ANSI_CHARSET,Font.DEFAULT_CHARSET,Font.SYMBOL_CHARSET
-
-