FileDocCategorySizeDatePackage
HSSFFont.javaAPI DocApache Poi 3.0.18931Mon Jan 01 12:39:36 GMT 2007org.apache.poi.hssf.usermodel

HSSFFont

public class HSSFFont extends Object
Represents a Font used in a workbook.
version
1.0-pre
author
Andrew C. Oliver
see
org.apache.poi.hssf.usermodel.HSSFWorkbook#createFont()
see
org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
see
org.apache.poi.hssf.usermodel.HSSFCellStyle#setFont(HSSFFont)

Fields Summary
public static final String
FONT_ARIAL
Arial font
public static final short
BOLDWEIGHT_NORMAL
Normal boldness (not bold)
public static final short
BOLDWEIGHT_BOLD
Bold boldness (bold)
public static final short
COLOR_NORMAL
normal type of black color.
public static final short
COLOR_RED
Dark Red color
public static final short
SS_NONE
no type offsetting (not super or subscript)
public static final short
SS_SUPER
superscript
public static final short
SS_SUB
subscript
public static final byte
U_NONE
not underlined
public static final byte
U_SINGLE
single (normal) underline
public static final byte
U_DOUBLE
double underlined
public static final byte
U_SINGLE_ACCOUNTING
accounting style single underline
public static final byte
U_DOUBLE_ACCOUNTING
accounting style double underline
public static final byte
ANSI_CHARSET
ANSI character set
public static final byte
DEFAULT_CHARSET
Default character set.
public static final byte
SYMBOL_CHARSET
Symbol character set
private FontRecord
font
private short
index
Constructors Summary
protected HSSFFont(short index, FontRecord rec)
Creates a new instance of HSSFFont


           

        
    
        font       = rec;
        this.index = index;
    
Methods Summary
public shortgetBoldweight()
get the boldness to use

return
boldweight
see
#BOLDWEIGHT_NORMAL
see
#BOLDWEIGHT_BOLD

        return font.getBoldWeight();
    
public bytegetCharSet()
get character-set to use.

return
character-set
see
#ANSI_CHARSET
see
#DEFAULT_CHARSET
see
#SYMBOL_CHARSET

        return font.getCharset();
    
public shortgetColor()
get the color for the font

return
color to use
see
#COLOR_NORMAL
see
#COLOR_RED

        return font.getColorPaletteIndex();
    
public shortgetFontHeight()
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..

return
short - height in 1/20ths of a point
see
#getFontHeightInPoints()

        return font.getFontHeight();
    
public shortgetFontHeightInPoints()
get the font height

return
short - height in the familiar unit of measure - points
see
#getFontHeight()

        return ( short ) (font.getFontHeight() / 20);
    
public java.lang.StringgetFontName()
get the name for the font (i.e. Arial)

return
String representing the name of the font to use
see
#FONT_ARIAL

        return font.getFontName();
    
public shortgetIndex()
get the index within the HSSFWorkbook (sequence within the collection of Font objects)

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

        return index;
    
public booleangetItalic()
get whether to use italics or not

return
italics or not

        return font.isItalic();
    
public booleangetStrikeout()
get whether to use a strikeout horizontal line through the text or not

return
strikeout or not

        return font.isStruckout();
    
public shortgetTypeOffset()
get normal,super or subscript.

return
offset type to use (none,super,sub)
see
#SS_NONE
see
#SS_SUPER
see
#SS_SUB

        return font.getSuperSubScript();
    
public bytegetUnderline()
get type of text underlining to use

return
underlining type
see
#U_NONE
see
#U_SINGLE
see
#U_DOUBLE
see
#U_SINGLE_ACCOUNTING
see
#U_DOUBLE_ACCOUNTING

        return font.getUnderline();
    
public voidsetBoldweight(short boldweight)
set the boldness to use

param
boldweight
see
#BOLDWEIGHT_NORMAL
see
#BOLDWEIGHT_BOLD

        font.setBoldWeight(boldweight);
    
public voidsetCharSet(byte charset)
set character-set to use.

return
character-set
see
#ANSI_CHARSET
see
#DEFAULT_CHARSET
see
#SYMBOL_CHARSET

        font.setCharset(charset);
    
public voidsetColor(short color)
set the color for the font

param
color to use
see
#COLOR_NORMAL Note: Use this rather than HSSFColor.AUTOMATIC for default font color
see
#COLOR_RED

        font.setColorPaletteIndex(color);
    
public voidsetFontHeight(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..

param
height height in 1/20ths of a point
see
#setFontHeightInPoints(short)

        font.setFontHeight(height);
    
public voidsetFontHeightInPoints(short height)
set the font height

param
height height in the familiar unit of measure - points
see
#setFontHeight(short)

        font.setFontHeight(( short ) (height * 20));
    
public voidsetFontName(java.lang.String name)
set the name for the font (i.e. Arial)

param
name String representing the name of the font to use
see
#FONT_ARIAL

        font.setFontName(name);
        font.setFontNameLength(( byte ) name.length());
    
public voidsetItalic(boolean italic)
set whether to use italics or not

param
italic italics or not

        font.setItalic(italic);
    
public voidsetStrikeout(boolean strikeout)
set whether to use a strikeout horizontal line through the text or not

param
strikeout or not

        font.setStrikeout(strikeout);
    
public voidsetTypeOffset(short offset)
set normal,super or subscript.

param
offset type to use (none,super,sub)
see
#SS_NONE
see
#SS_SUPER
see
#SS_SUB

        font.setSuperSubScript(offset);
    
public voidsetUnderline(byte underline)
set type of text underlining to use

param
underline type
see
#U_NONE
see
#U_SINGLE
see
#U_DOUBLE
see
#U_SINGLE_ACCOUNTING
see
#U_DOUBLE_ACCOUNTING

        font.setUnderline(underline);
    
public java.lang.StringtoString()

        return "org.apache.poi.hssf.usermodel.HSSFFont{" +
                 font +
                "}";