Package org.apache.poi.xssf.usermodel
Class XSSFFont
- java.lang.Object
-
- org.apache.poi.xssf.usermodel.XSSFFont
-
-
Field Summary
Fields Modifier and Type Field Description static short
DEFAULT_FONT_COLOR
Default font color is blackstatic java.lang.String
DEFAULT_FONT_NAME
By default, Microsoft Office Excel 2007 uses the Calibri font in font size 11static short
DEFAULT_FONT_SIZE
By default, Microsoft Office Excel 2007 uses the Calibri font in font size 11-
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, U_DOUBLE, U_DOUBLE_ACCOUNTING, U_NONE, U_SINGLE, U_SINGLE_ACCOUNTING
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
boolean
getBold()
get a boolean value for the boldness to use.int
getCharSet()
get character-set to use.short
getColor()
get the indexed color value for the font References a color defined in IndexedColors.CTFont
getCTFont()
get the underlying CTFont fontint
getFamily()
get the font family to use.short
getFontHeight()
Get the font height in unit's of 1/20th of a point.short
getFontHeightInPoints()
Get the font height in points.java.lang.String
getFontName()
get the name of the font (i.e.short
getIndex()
Deprecated.int
getIndexAsInt()
get the index within the XSSFWorkbook (sequence within the collection of Font objects)boolean
getItalic()
get a boolean value that specify whether to use italics or notFontScheme
getScheme()
get the font scheme property.boolean
getStrikeout()
get a boolean value that specify whether to use a strikeout horizontal line through the text or notshort
getThemeColor()
get the color value for the font References a color defined in theme.short
getTypeOffset()
get normal,super or subscript.byte
getUnderline()
get type of text underlining to useXSSFColor
getXSSFColor()
get the color value for the font References a color defined as Standard Alpha Red Green Blue color value (ARGB).int
hashCode()
long
registerTo(StylesTable styles)
Perform a registration of ourselves to the style tablevoid
setBold(boolean bold)
set a boolean value for the boldness to use.void
setCharSet(byte charset)
set character-set to use.void
setCharSet(int charset)
set character-set to use.void
setCharSet(FontCharset charSet)
set character-set to use.void
setColor(short color)
set the indexed color for the fontvoid
setColor(XSSFColor color)
set the color for the font in Standard Alpha Red Green Blue color valuevoid
setFamily(int value)
Set the font family this font belongs to.void
setFamily(FontFamily family)
set an enumeration representing the font family this font belongs to.void
setFontHeight(double height)
set the font height in points.void
setFontHeight(short height)
set the font height in points.void
setFontHeightInPoints(short height)
set the font height in points.void
setFontName(java.lang.String name)
set the name for the font (i.e.void
setItalic(boolean italic)
set a boolean value for the property specifying whether to use italics or not If omitted, the default value is true.void
setScheme(FontScheme scheme)
set font scheme propertyvoid
setStrikeout(boolean strikeout)
set a boolean value for the property specifying whether to use a strikeout horizontal line through the text or not If omitted, the default value is true.void
setThemeColor(short theme)
set the theme color for the font to usevoid
setThemesTable(ThemesTable themes)
Records the Themes Table that is associated with the current font, used when looking up theme based colours and properties.void
setTypeOffset(short offset)
set normal,super or subscript, that representing the vertical-alignment setting.void
setUnderline(byte underline)
set the style of underlining that is used.void
setUnderline(FontUnderline underline)
set an enumeration representing the style of underlining that is used.java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_FONT_NAME
public static final java.lang.String DEFAULT_FONT_NAME
By default, Microsoft Office Excel 2007 uses the Calibri font in font size 11- See Also:
- Constant Field Values
-
DEFAULT_FONT_SIZE
public static final short DEFAULT_FONT_SIZE
By default, Microsoft Office Excel 2007 uses the Calibri font in font size 11- See Also:
- Constant Field Values
-
DEFAULT_FONT_COLOR
public static final short DEFAULT_FONT_COLOR
Default font color is black- See Also:
IndexedColors.BLACK
-
-
Constructor Detail
-
XSSFFont
@Internal public XSSFFont(CTFont font)
Create a new XSSFFont- Parameters:
font
- the underlying CTFont bean
-
XSSFFont
@Internal public XSSFFont(CTFont font, int index, IndexedColorMap colorMap)
Called from parsing styles.xml- Parameters:
font
- CTFontindex
- font indexcolorMap
- for default or custom indexed colors
-
XSSFFont
public XSSFFont()
Create a new XSSFont. This method is protected to be used only by XSSFWorkbook
-
-
Method Detail
-
getBold
public boolean getBold()
get a boolean value for the boldness to use.
-
getCharSet
public int getCharSet()
get character-set to use.- Specified by:
getCharSet
in interfaceFont
- Returns:
- int - character-set (0-255)
- See Also:
FontCharset
-
getColor
public short getColor()
get the indexed color value for the font References a color defined in IndexedColors.- Specified by:
getColor
in interfaceFont
- Returns:
- short - indexed color to use
- See Also:
IndexedColors
-
getXSSFColor
public XSSFColor getXSSFColor()
get the color value for the font References a color defined as Standard Alpha Red Green Blue color value (ARGB).- Returns:
- XSSFColor - rgb color to use
-
getThemeColor
public short getThemeColor()
get the color value for the font References a color defined in theme.- Returns:
- short - theme defined to use
-
getFontHeight
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.- Specified by:
getFontHeight
in interfaceFont
- Returns:
- short - height in 1/20ths of a point
- See Also:
getFontHeightInPoints()
-
getFontHeightInPoints
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.
- Specified by:
getFontHeightInPoints
in interfaceFont
- Returns:
- short - height in the familiar unit of measure - points
- See Also:
getFontHeight()
-
getFontName
public java.lang.String getFontName()
get the name of the font (i.e. Arial)- Specified by:
getFontName
in interfaceFont
- Returns:
- String - a string representing the name of the font to use
-
getItalic
public boolean getItalic()
get a boolean value that specify whether to use italics or not
-
getStrikeout
public boolean getStrikeout()
get a boolean value that specify whether to use a strikeout horizontal line through the text or not- Specified by:
getStrikeout
in interfaceFont
- Returns:
- boolean - value for strikeout
-
getTypeOffset
public short getTypeOffset()
get normal,super or subscript.- Specified by:
getTypeOffset
in interfaceFont
- Returns:
- short - offset type to use (none,super,sub)
- See Also:
Font.SS_NONE
,Font.SS_SUPER
,Font.SS_SUB
-
getUnderline
public byte getUnderline()
get type of text underlining to use- Specified by:
getUnderline
in interfaceFont
- Returns:
- byte - underlining type
- See Also:
FontUnderline
-
setBold
public void setBold(boolean bold)
set a boolean value for the boldness to use. If omitted, the default value is true.
-
setCharSet
public void setCharSet(byte charset)
set character-set to use.- Specified by:
setCharSet
in interfaceFont
- Parameters:
charset
- - charset- See Also:
FontCharset
-
setCharSet
public void setCharSet(int charset)
set character-set to use.- Specified by:
setCharSet
in interfaceFont
- Parameters:
charset
- - charset- See Also:
FontCharset
-
setCharSet
public void setCharSet(FontCharset charSet)
set character-set to use.- Parameters:
charSet
-
-
setColor
public void setColor(short color)
set the indexed color for the font- Specified by:
setColor
in interfaceFont
- Parameters:
color
- - color to use- See Also:
- Note: default font color
,IndexedColors
-
setColor
public void setColor(XSSFColor color)
set the color for the font in Standard Alpha Red Green Blue color value- Parameters:
color
- - color to use
-
setFontHeight
public void setFontHeight(short height)
set the font height in points.- Specified by:
setFontHeight
in interfaceFont
- Parameters:
height
- - height in points- See Also:
Font.setFontHeightInPoints(short)
-
setFontHeight
public void setFontHeight(double height)
set the font height in points.- Parameters:
height
- - height in points
-
setFontHeightInPoints
public void setFontHeightInPoints(short height)
set the font height in points.- Specified by:
setFontHeightInPoints
in interfaceFont
- Parameters:
height
- height in the familiar unit of measure - points- See Also:
setFontHeight(short)
-
setThemeColor
public void setThemeColor(short theme)
set the theme color for the font to use- Parameters:
theme
- - theme color to use
-
setFontName
public void setFontName(java.lang.String name)
set the name for the font (i.e. Arial). If the font doesn't exist (because it isn't installed on the system), or the charset is invalid for that font, then another font should be substituted. The string length for this attribute shall be 0 to 31 characters. Default font name is Calibri.- Specified by:
setFontName
in interfaceFont
- Parameters:
name
- - value representing the name of the font to use- See Also:
DEFAULT_FONT_NAME
-
setItalic
public void setItalic(boolean italic)
set a boolean value for the property specifying whether to use italics or not If omitted, the default value is true.
-
setStrikeout
public void setStrikeout(boolean strikeout)
set a boolean value for the property specifying whether to use a strikeout horizontal line through the text or not If omitted, the default value is true.- Specified by:
setStrikeout
in interfaceFont
- Parameters:
strikeout
- - value for strikeout or not
-
setTypeOffset
public void setTypeOffset(short offset)
set normal,super or subscript, that representing the vertical-alignment setting. Setting this to either subscript or superscript shall make the font size smaller if a smaller font size is available.- Specified by:
setTypeOffset
in interfaceFont
- Parameters:
offset
- - 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 the style of underlining that is used. The none style is equivalent to not using underlining at all.- Specified by:
setUnderline
in interfaceFont
- Parameters:
underline
- - underline type to use- See Also:
FontUnderline
-
setUnderline
public void setUnderline(FontUnderline underline)
set an enumeration representing the style of underlining that is used. The none style is equivalent to not using underlining at all. The possible values for this attribute are defined by the FontUnderline- Parameters:
underline
- - FontUnderline enum value
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
registerTo
public long registerTo(StylesTable styles)
Perform a registration of ourselves to the style table
-
setThemesTable
public void setThemesTable(ThemesTable themes)
Records the Themes Table that is associated with the current font, used when looking up theme based colours and properties.
-
getScheme
public FontScheme getScheme()
get the font scheme property. is used only in StylesTable to create the default instance of font- Returns:
- FontScheme
- See Also:
StylesTable.createDefaultFont()
-
setScheme
public void setScheme(FontScheme scheme)
set font scheme property- Parameters:
scheme
- - FontScheme enum value- See Also:
FontScheme
-
getFamily
public int getFamily()
get the font family to use.- Returns:
- the font family to use
- See Also:
FontFamily
-
setFamily
public void setFamily(int value)
Set the font family this font belongs to. A font family is a set of fonts having common stroke width and serif characteristics. The font name overrides when there are conflicting values.- Parameters:
value
- - font family- See Also:
FontFamily
-
setFamily
public void setFamily(FontFamily family)
set an enumeration representing the font family this font belongs to. A font family is a set of fonts having common stroke width and serif characteristics.- Parameters:
family
- font family- See Also:
setFamily(int value)
-
getIndex
@Deprecated public short getIndex()
Deprecated.Description copied from interface:Font
get the index within the XSSFWorkbook (sequence within the collection of Font objects)
-
getIndexAsInt
public int getIndexAsInt()
Description copied from interface:Font
get the index within the XSSFWorkbook (sequence within the collection of Font objects)- Specified by:
getIndexAsInt
in 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)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
-