Package org.apache.poi.ss.usermodel
Interface Font
public interface Font
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
ANSI character setstatic final short
normal type of black color.static final short
Dark Red colorstatic final byte
Default character set.static final short
no type offsetting (not super or subscript)static final short
subscriptstatic final short
superscriptstatic final byte
Symbol character setstatic final int
Font height is handled in points and 1/20th of points so this is the constant used to convert between those two units.static final byte
double underlinedstatic final byte
accounting style double underlinestatic final byte
not underlinedstatic final byte
single (normal) underlinestatic final byte
accounting style single underline -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBold()
int
get character-set to use.short
getColor()
get the color for the fontshort
Get the font height in unit's of 1/20th of a point.short
Get the font height in points.get the name for the font (i.e.int
getIndex()
get the index within the XSSFWorkbook (sequence within the collection of Font objects)int
Deprecated.boolean
get whether to use italics or notboolean
get whether to use a strikeout horizontal line through the text or notshort
get normal,super or subscript.byte
get type of text underlining to usevoid
setBold
(boolean bold) 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 fontvoid
setFontHeight
(short height) set the font height in unit's of 1/20th of a point.void
setFontHeightInPoints
(short height) set the font heightvoid
setFontName
(String name) set the name for the font (i.e.void
setItalic
(boolean italic) set whether to use italics or notvoid
setStrikeout
(boolean strikeout) set whether to use a strikeout horizontal line through the text or notvoid
setTypeOffset
(short offset) set normal,super or subscript.void
setUnderline
(byte underline) set type of text underlining to use
-
Field Details
-
COLOR_NORMAL
static final short COLOR_NORMALnormal type of black color.- See Also:
-
COLOR_RED
static final short COLOR_REDDark Red color- See Also:
-
SS_NONE
static final short SS_NONEno type offsetting (not super or subscript)- See Also:
-
SS_SUPER
static final short SS_SUPERsuperscript- See Also:
-
SS_SUB
static final short SS_SUBsubscript- See Also:
-
U_NONE
static final byte U_NONEnot underlined- See Also:
-
U_SINGLE
static final byte U_SINGLEsingle (normal) underline- See Also:
-
U_DOUBLE
static final byte U_DOUBLEdouble underlined- See Also:
-
U_SINGLE_ACCOUNTING
static final byte U_SINGLE_ACCOUNTINGaccounting style single underline- See Also:
-
U_DOUBLE_ACCOUNTING
static final byte U_DOUBLE_ACCOUNTINGaccounting style double underline- See Also:
-
ANSI_CHARSET
static final byte ANSI_CHARSETANSI character set- See Also:
-
DEFAULT_CHARSET
static final byte DEFAULT_CHARSETDefault character set.- See Also:
-
SYMBOL_CHARSET
static final byte SYMBOL_CHARSETSymbol character set- See Also:
-
TWIPS_PER_POINT
static final int TWIPS_PER_POINTFont height is handled in points and 1/20th of points so this is the constant used to convert between those two units.- See Also:
-
-
Method Details
-
setFontName
set the name for the font (i.e. Arial)- Parameters:
name
- String representing the name of the font to use
-
getFontName
String getFontName()get the name for the font (i.e. Arial)- Returns:
- String representing the name of the font to use
-
setFontHeight
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
void setFontHeightInPoints(short height) set the font height- Parameters:
height
- height in the familiar unit of measure - points- See Also:
-
getFontHeight
short getFontHeight()Get the font height in unit's of 1/20th of a point.For many users, the related
getFontHeightInPoints()
will be more helpful, as that returns font heights in the more familiar points units, eg 10, 12, 14.- Returns:
- short - height in 1/20ths of a point
- See Also:
-
getFontHeightInPoints
short getFontHeightInPoints()Get the font height in points.This will return the same font height that is shown in Excel, such as 10 or 14 or 28.
- Returns:
- short - height in the familiar unit of measure - points
- See Also:
-
setItalic
void setItalic(boolean italic) set whether to use italics or not- Parameters:
italic
- italics or not
-
getItalic
boolean getItalic()get whether to use italics or not- Returns:
- italics or not
-
setStrikeout
void setStrikeout(boolean strikeout) set whether to use a strikeout horizontal line through the text or not- Parameters:
strikeout
- or not
-
getStrikeout
boolean getStrikeout()get whether to use a strikeout horizontal line through the text or not- Returns:
- strikeout or not
-
setColor
void setColor(short color) set the color for the font- Parameters:
color
- to use- See Also:
-
getColor
short getColor()get the color for the font- Returns:
- color to use
- See Also:
-
setTypeOffset
void setTypeOffset(short offset) set normal,super or subscript.- Parameters:
offset
- type to use (none,super,sub)- See Also:
-
getTypeOffset
short getTypeOffset()get normal,super or subscript.- Returns:
- offset type to use (none,super,sub)
- See Also:
-
setUnderline
void setUnderline(byte underline) set type of text underlining to use- Parameters:
underline
- type- See Also:
-
getUnderline
byte getUnderline()get type of text underlining to use- Returns:
- underlining type
- See Also:
-
getCharSet
int getCharSet()get character-set to use.- Returns:
- character-set
- See Also:
-
setCharSet
void setCharSet(byte charset) set character-set to use.- See Also:
-
setCharSet
void setCharSet(int charset) set character-set to use.- See Also:
-
getIndex
int getIndex()get the index within the XSSFWorkbook (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)
- Since:
- 5.0.0 (used to return a short)
-
getIndexAsInt
Deprecated.usegetIndex()
insteadget the index within the XSSFWorkbook (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)
- Since:
- 4.0.0
-
setBold
void setBold(boolean bold) -
getBold
boolean getBold()
-
getIndex()
instead