org.apache.poi.hssf.usermodel
Class HSSFFont

java.lang.Object
  |
  +--org.apache.poi.hssf.usermodel.HSSFFont
All Implemented Interfaces:
HSSFColorConstants

public class HSSFFont
extends java.lang.Object
implements HSSFColorConstants

Represents a Font used in a workbook.

Version:
1.0-pre
Author:
Andrew C. Oliver
See Also:
HSSFWorkbook.createFont(), HSSFWorkbook.getFontAt(short), HSSFCellStyle.setFont(HSSFFont)

Field Summary
static short BOLDWEIGHT_BOLD
          Bold boldness (bold)
static short BOLDWEIGHT_NORMAL
          Normal boldness (not bold)
static short COLOR_NORMAL
          normal type of black color
static short COLOR_RED
          Dark Red color
static java.lang.String FONT_ARIAL
          Arial font
static short SS_NONE
          no type offsetting (not super or subscript)
static short SS_SUB
          subscript
static short SS_SUPER
          superscript
static byte U_DOUBLE
          double underlined
static byte U_DOUBLE_ACCOUNTING
          accounting style double underline
static byte U_NONE
          not underlined
static byte U_SINGLE
          single (normal) underline
static byte U_SINGLE_ACCOUNTING
          accounting style single underline
 
Fields inherited from interface org.apache.poi.hssf.usermodel.HSSFColorConstants
AQUA, AUTOMATIC, BLACK, BLUE, BLUE_GREY, BRIGHT_GREEN, BROWN, DARK_BLUE, DARK_GREEN, DARK_RED, DARK_TEAL, DARK_YELLOW, GOLD, GREEN, GREY_25_PERCENT, GREY_40_PERCENT, GREY_50_PERCENT, GREY_80_PERCENT, INDIGO, LAVENDER, LIGHT_BLUE, LIGHT_GREEN, LIGHT_ORANGE, LIGHT_TURQUOISE, LIGHT_YELLOW, LIME, OLIVE_GREEN, ORANGE, PALE_BLUE, PINK, PLUM, RED, ROSE, SEA_GREEN, SKY_BLUE, TAN, TEAL, TURQUOISE, VIOLET, WHITE, YELLOW
 
Constructor Summary
protected HSSFFont(short index, FontRecord rec)
          Creates a new instance of HSSFFont
 
Method Summary
 short getBoldweight()
          get the boldness to use
 short getColor()
          get the color for the font
 short getFontHeight()
          get the font height in unit's of 1/20th of a point.
 short getFontHeightInPoints()
          get the font height
 java.lang.String getFontName()
          get the name for the font (i.e.
 short getIndex()
          get the index within the HSSFWorkbook (sequence within the collection of Font objects)
 boolean getItalic()
          get whether to use italics or not
 boolean getStrikeout()
          get whether to use a strikeout horizontal line through the text or not
 short getTypeOffset()
          get normal,super or subscript.
 byte getUnderline()
          get type of text underlining to use
 void setBoldweight(short boldweight)
          set the boldness to use
 void setColor(short color)
          set the color for the font
 void setFontHeight(short height)
          set the font height in unit's of 1/20th of a point.
 void setFontHeightInPoints(short height)
          set the font height
 void setFontName(java.lang.String name)
          set the name for the font (i.e.
 void setItalic(boolean italic)
          set whether to use italics or not
 void setStrikeout(boolean strikeout)
          set whether to use a strikeout horizontal line through the text or not
 void setTypeOffset(short offset)
          set normal,super or subscript.
 void setUnderline(byte underline)
          set type of text underlining to use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_ARIAL

public static final java.lang.String FONT_ARIAL
Arial font

BOLDWEIGHT_NORMAL

public static final short BOLDWEIGHT_NORMAL
Normal boldness (not bold)

BOLDWEIGHT_BOLD

public static final short BOLDWEIGHT_BOLD
Bold boldness (bold)

COLOR_NORMAL

public static final short COLOR_NORMAL
normal type of black color

COLOR_RED

public static final short COLOR_RED
Dark Red color

SS_NONE

public static final short SS_NONE
no type offsetting (not super or subscript)

SS_SUPER

public static final short SS_SUPER
superscript

SS_SUB

public static final short SS_SUB
subscript

U_NONE

public static final byte U_NONE
not underlined

U_SINGLE

public static final byte U_SINGLE
single (normal) underline

U_DOUBLE

public static final byte U_DOUBLE
double underlined

U_SINGLE_ACCOUNTING

public static final byte U_SINGLE_ACCOUNTING
accounting style single underline

U_DOUBLE_ACCOUNTING

public static final byte U_DOUBLE_ACCOUNTING
accounting style double underline
Constructor Detail

HSSFFont

protected HSSFFont(short index,
                   FontRecord rec)
Creates a new instance of HSSFFont
Method Detail

setFontName

public void setFontName(java.lang.String name)
set the name for the font (i.e. Arial)
Parameters:
String - representing the name of the font to use
See Also:
FONT_ARIAL

getFontName

public java.lang.String getFontName()
get the name for the font (i.e. Arial)
Returns:
String representing the name of the font to use
See Also:
FONT_ARIAL

getIndex

public short getIndex()
get the index within the HSSFWorkbook (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)

setFontHeight

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:
short - - height in 1/20ths of a point
See Also:
setFontHeightInPoints(short)

setFontHeightInPoints

public void setFontHeightInPoints(short height)
set the font height
Parameters:
short - - height in the familiar unit of measure - points
See Also:
setFontHeight(short)

getFontHeight

public short getFontHeight()
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..
Returns:
short - height in 1/20ths of a point
See Also:
getFontHeightInPoints()

getFontHeightInPoints

public short getFontHeightInPoints()
get the font height
Returns:
short - height in the familiar unit of measure - points
See Also:
getFontHeight()

setItalic

public void setItalic(boolean italic)
set whether to use italics or not
Parameters:
italics - or not

getItalic

public boolean getItalic()
get whether to use italics or not
Returns:
italics or not

setStrikeout

public void setStrikeout(boolean strikeout)
set whether to use a strikeout horizontal line through the text or not
Parameters:
strikeout - or not

getStrikeout

public boolean getStrikeout()
get whether to use a strikeout horizontal line through the text or not
Returns:
strikeout or not

setColor

public void setColor(short color)
set the color for the font
Parameters:
color - to use
See Also:
COLOR_NORMAL, COLOR_RED

getColor

public short getColor()
get the color for the font
Returns:
color to use
See Also:
COLOR_NORMAL, COLOR_RED

setBoldweight

public void setBoldweight(short boldweight)
set the boldness to use
Parameters:
boldweight -  
See Also:
BOLDWEIGHT_NORMAL, BOLDWEIGHT_BOLD

getBoldweight

public short getBoldweight()
get the boldness to use
Returns:
boldweight
See Also:
BOLDWEIGHT_NORMAL, BOLDWEIGHT_BOLD

setTypeOffset

public void setTypeOffset(short offset)
set normal,super or subscript.
Parameters:
offset - type to use (none,super,sub)
See Also:
SS_NONE, SS_SUPER, SS_SUB

getTypeOffset

public short getTypeOffset()
get normal,super or subscript.
Returns:
offset type to use (none,super,sub)
See Also:
SS_NONE, SS_SUPER, SS_SUB

setUnderline

public void setUnderline(byte underline)
set type of text underlining to use
Parameters:
underlining - type
See Also:
U_NONE, U_SINGLE, U_DOUBLE, U_SINGLE_ACCOUNTING, U_DOUBLE_ACCOUNTING

getUnderline

public byte getUnderline()
get type of text underlining to use
Returns:
underlining type
See Also:
U_NONE, U_SINGLE, U_DOUBLE, U_SINGLE_ACCOUNTING, U_DOUBLE_ACCOUNTING


Copyright © 2001-2002 JAKARTA POI project. All Rights Reserved.