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 shortDEFAULT_FONT_COLORDefault font color is blackstatic java.lang.StringDEFAULT_FONT_NAMEBy default, Microsoft Office Excel 2007 uses the Calibri font in font size 11static shortDEFAULT_FONT_SIZEBy 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 booleanequals(java.lang.Object o)booleangetBold()get a boolean value for the boldness to use.intgetCharSet()get character-set to use.shortgetColor()get the indexed color value for the font References a color defined in IndexedColors.CTFontgetCTFont()get the underlying CTFont fontintgetFamily()get the font family to use.shortgetFontHeight()Get the font height in unit's of 1/20th of a point.shortgetFontHeightInPoints()Get the font height in points.java.lang.StringgetFontName()get the name of the font (i.e.shortgetIndex()Deprecated.intgetIndexAsInt()get the index within the XSSFWorkbook (sequence within the collection of Font objects)booleangetItalic()get a boolean value that specify whether to use italics or notFontSchemegetScheme()get the font scheme property.booleangetStrikeout()get a boolean value that specify whether to use a strikeout horizontal line through the text or notshortgetThemeColor()get the color value for the font References a color defined in theme.shortgetTypeOffset()get normal,super or subscript.bytegetUnderline()get type of text underlining to useXSSFColorgetXSSFColor()get the color value for the font References a color defined as Standard Alpha Red Green Blue color value (ARGB).inthashCode()longregisterTo(StylesTable styles)Perform a registration of ourselves to the style tablevoidsetBold(boolean bold)set a boolean value for the boldness to use.voidsetCharSet(byte charset)set character-set to use.voidsetCharSet(int charset)set character-set to use.voidsetCharSet(FontCharset charSet)set character-set to use.voidsetColor(short color)set the indexed color for the fontvoidsetColor(XSSFColor color)set the color for the font in Standard Alpha Red Green Blue color valuevoidsetFamily(int value)Set the font family this font belongs to.voidsetFamily(FontFamily family)set an enumeration representing the font family this font belongs to.voidsetFontHeight(double height)set the font height in points.voidsetFontHeight(short height)set the font height in points.voidsetFontHeightInPoints(short height)set the font height in points.voidsetFontName(java.lang.String name)set the name for the font (i.e.voidsetItalic(boolean italic)set a boolean value for the property specifying whether to use italics or not If omitted, the default value is true.voidsetScheme(FontScheme scheme)set font scheme propertyvoidsetStrikeout(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.voidsetThemeColor(short theme)set the theme color for the font to usevoidsetThemesTable(ThemesTable themes)Records the Themes Table that is associated with the current font, used when looking up theme based colours and properties.voidsetTypeOffset(short offset)set normal,super or subscript, that representing the vertical-alignment setting.voidsetUnderline(byte underline)set the style of underlining that is used.voidsetUnderline(FontUnderline underline)set an enumeration representing the style of underlining that is used.java.lang.StringtoString()
-
-
-
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:
getCharSetin 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:
getColorin 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:
getFontHeightin 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:
getFontHeightInPointsin 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:
getFontNamein 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:
getStrikeoutin interfaceFont- Returns:
- boolean - value for strikeout
-
getTypeOffset
public short getTypeOffset()
get normal,super or subscript.- Specified by:
getTypeOffsetin 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:
getUnderlinein 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:
setCharSetin interfaceFont- Parameters:
charset- - charset- See Also:
FontCharset
-
setCharSet
public void setCharSet(int charset)
set character-set to use.- Specified by:
setCharSetin 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:
setColorin 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:
setFontHeightin 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:
setFontHeightInPointsin 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:
setFontNamein 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:
setStrikeoutin 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:
setTypeOffsetin 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:
setUnderlinein 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:
toStringin 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:Fontget the index within the XSSFWorkbook (sequence within the collection of Font objects)
-
getIndexAsInt
public int getIndexAsInt()
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)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-