Top Fields Methods
org.apache.poi.ss.usermodel

public Interface Font

Known Direct Implementers
org.apache.poi.hssf.usermodel.HSSFFont
Imports
org.apache.poi.util.Removal

Field Summary

Modifier and TypeField and Description
public static final byte
ANSI_CHARSET

ANSI character set

public static final short
COLOR_NORMAL

normal type of black color.

public static final short
COLOR_RED

Dark Red color

public static final byte
DEFAULT_CHARSET

Default character set.

public static final short
SS_NONE

no type offsetting (not super or subscript)

public static final short
SS_SUB

subscript

public static final short
SS_SUPER

superscript

public static final byte
SYMBOL_CHARSET

Symbol character set

public static final int
TWIPS_PER_POINT

Font height is handled in points and 1/20th of points so this is the constant used to convert between those two units.

public static final byte
U_DOUBLE

double underlined

public static final byte
U_DOUBLE_ACCOUNTING

accounting style double underline

public static final byte
U_NONE

not underlined

public static final byte
U_SINGLE

single (normal) underline

public static final byte
U_SINGLE_ACCOUNTING

accounting style single underline

Method Summary

Modifier and TypeMethod and Description
public boolean
public int

Returns:

character-set
getCharSet
()

get character-set to use.

public short

Returns:

color to use
getColor
()

get the color for the font

public short

Returns:

short - height in 1/20ths of a point
getFontHeight
()

Get the font height in unit's of 1/20th of a point.

public short

Returns:

short - height in the familiar unit of measure - points
getFontHeightInPoints
()

Get the font height in points.

public String

Returns:

String representing the name of the font to use
getFontName
()

get the name for the font (i.e. Arial)

public int

Returns:

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

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

public int

Returns:

unique index number of the underlying record this Font represents (probably you don't care unless you're comparing which one is which)
getIndexAsInt
()
Deprecated use getIndex() instead

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

public boolean

Returns:

italics or not
getItalic
()

get whether to use italics or not

public boolean

Returns:

strikeout or not
getStrikeout
()

get whether to use a strikeout horizontal line through the text or not

public short

Returns:

offset type to use (none,super,sub)
getTypeOffset
()

get normal,super or subscript.

public byte

Returns:

underlining type
getUnderline
()

get type of text underlining to use

public void
setBold(boolean bold)

public void
setCharSet(byte charset)

set character-set to use.

public void
setCharSet(int charset)

set character-set to use.

public void
setColor(short
to use
color
)

set the color for the font

public void
setFontHeight(short
height in 1/20ths of a point
height
)

set the font height in unit's of 1/20th of a point.

public void
setFontHeightInPoints(short
height in the familiar unit of measure - points
height
)

set the font height

public void
setFontName(String
String representing the name of the font to use
name
)

set the name for the font (i.e. Arial)

public void
setItalic(boolean
italics or not
italic
)

set whether to use italics or not

public void
setStrikeout(boolean
or not
strikeout
)

set whether to use a strikeout horizontal line through the text or not

public void
setTypeOffset(short
type to use (none,super,sub)
offset
)

set normal,super or subscript.

public void
setUnderline(byte
type
underline
)

set type of text underlining to use

Field Detail

ANSI_CHARSETback to summary
public static final byte ANSI_CHARSET

ANSI character set

COLOR_NORMALback to summary
public static final short COLOR_NORMAL

normal type of black color.

COLOR_REDback to summary
public static final short COLOR_RED

Dark Red color

DEFAULT_CHARSETback to summary
public static final byte DEFAULT_CHARSET

Default character set.

SS_NONEback to summary
public static final short SS_NONE

no type offsetting (not super or subscript)

SS_SUBback to summary
public static final short SS_SUB

subscript

SS_SUPERback to summary
public static final short SS_SUPER

superscript

SYMBOL_CHARSETback to summary
public static final byte SYMBOL_CHARSET

Symbol character set

TWIPS_PER_POINTback to summary
public static final int TWIPS_PER_POINT

Font height is handled in points and 1/20th of points so this is the constant used to convert between those two units.

U_DOUBLEback to summary
public static final byte U_DOUBLE

double underlined

U_DOUBLE_ACCOUNTINGback to summary
public static final byte U_DOUBLE_ACCOUNTING

accounting style double underline

U_NONEback to summary
public static final byte U_NONE

not underlined

U_SINGLEback to summary
public static final byte U_SINGLE

single (normal) underline

U_SINGLE_ACCOUNTINGback to summary
public static final byte U_SINGLE_ACCOUNTING

accounting style single underline

Method Detail

getBoldback to summary
public boolean getBold()
getCharSetback to summary
public int getCharSet()

get character-set to use.

Returns:int

character-set

See Also
ANSI_CHARSET, DEFAULT_CHARSET, SYMBOL_CHARSET
getColorback to summary
public short getColor()

get the color for the font

Returns:short

color to use

See Also
COLOR_NORMAL, COLOR_RED, org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
getFontHeightback to summary
public 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

short - height in 1/20ths of a point

See Also
getFontHeightInPoints()
getFontHeightInPointsback to summary
public 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

short - height in the familiar unit of measure - points

See Also
getFontHeight()
getFontNameback to summary
public String getFontName()

get the name for the font (i.e. Arial)

Returns:String

String representing the name of the font to use

getIndexback to summary
public int getIndex()

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

Returns:int

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)
getIndexAsIntback to summary
public int getIndexAsInt()

Deprecated

use getIndex() instead

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

Returns:int

unique index number of the underlying record this Font represents (probably you don't care unless you're comparing which one is which)

Annotations
@Deprecated
@Removal
version:6.0.0
Since
4.0.0
getItalicback to summary
public boolean getItalic()

get whether to use italics or not

Returns:boolean

italics or not

getStrikeoutback to summary
public boolean getStrikeout()

get whether to use a strikeout horizontal line through the text or not

Returns:boolean

strikeout or not

getTypeOffsetback to summary
public short getTypeOffset()

get normal,super or subscript.

Returns:short

offset type to use (none,super,sub)

See Also
SS_NONE, SS_SUPER, SS_SUB
getUnderlineback to summary
public byte getUnderline()

get type of text underlining to use

Returns:byte

underlining type

See Also
U_NONE, U_SINGLE, U_DOUBLE, U_SINGLE_ACCOUNTING, U_DOUBLE_ACCOUNTING
setBoldback to summary
public void setBold(boolean bold)
setCharSetback to summary
public void setCharSet(byte charset)

set character-set to use.

See Also
ANSI_CHARSET, DEFAULT_CHARSET, SYMBOL_CHARSET
setCharSetback to summary
public void setCharSet(int charset)

set character-set to use.

See Also
ANSI_CHARSET, DEFAULT_CHARSET, SYMBOL_CHARSET
setColorback to summary
public void setColor(short color)

set the color for the font

Parameters
color:short

to use

See Also
Note: Use this rather than HSSFColor.AUTOMATIC for default font color, COLOR_RED
setFontHeightback to summary
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:short

height in 1/20ths of a point

See Also
setFontHeightInPoints(short)
setFontHeightInPointsback to summary
public void setFontHeightInPoints(short height)

set the font height

Parameters
height:short

height in the familiar unit of measure - points

See Also
setFontHeight(short)
setFontNameback to summary
public void setFontName(String name)

set the name for the font (i.e. Arial)

Parameters
name:String

String representing the name of the font to use

setItalicback to summary
public void setItalic(boolean italic)

set whether to use italics or not

Parameters
italic:boolean

italics or not

setStrikeoutback to summary
public void setStrikeout(boolean strikeout)

set whether to use a strikeout horizontal line through the text or not

Parameters
strikeout:boolean

or not

setTypeOffsetback to summary
public void setTypeOffset(short offset)

set normal,super or subscript.

Parameters
offset:short

type to use (none,super,sub)

See Also
SS_NONE, SS_SUPER, SS_SUB
setUnderlineback to summary
public void setUnderline(byte underline)

set type of text underlining to use

Parameters
underline:byte

type

See Also
U_NONE, U_SINGLE, U_DOUBLE, U_SINGLE_ACCOUNTING, U_DOUBLE_ACCOUNTING