Package jxl.write
Class WritableFont
java.lang.Object
jxl.biff.RecordData
jxl.biff.WritableRecordData
jxl.biff.FontRecord
jxl.write.biff.WritableFontRecord
jxl.write.WritableFont
- All Implemented Interfaces:
jxl.biff.ByteData
,Font
- Direct Known Subclasses:
Font
public class WritableFont
extends jxl.write.biff.WritableFontRecord
A class which is instantiated when the user application wishes to specify
the font for a particular cell
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Static inner class used for classifying the font names -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final WritableFont.FontName
Objects created with this font name will be rendered within Excel as ARIAL fontsstatic final jxl.write.WritableFont.BoldStyle
Indicates that this font should be presented in a BOLD stylestatic final WritableFont.FontName
Objects created with this font name will be rendered within Excel as COURIER fontsstatic final int
The default point size for all Fontsstatic final jxl.write.WritableFont.BoldStyle
Indicates that this font should not be presented as boldstatic final WritableFont.FontName
Objects created with this font name will be rendered within Excel as TAHOMA fontsstatic final WritableFont.FontName
Objects created with this font name will be rendered within Excel as TIMES fontsFields inherited from class jxl.biff.FontRecord
biff7
-
Constructor Summary
ConstructorsConstructorDescriptionWritableFont
(Font f) Publicly available copy constructorCreates a default font, vanilla font of the specified face and with default point size.WritableFont
(WritableFont.FontName fn, int ps) Constructs of font of the specified face and of size given by the specified point sizeWritableFont
(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs) Creates a font of the specified face, point size and bold styleWritableFont
(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean italic) Creates a font of the specified face, point size, bold weight and italicised option.WritableFont
(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean it, UnderlineStyle us) Creates a font of the specified face, point size, bold weight, italicisation and underline styleWritableFont
(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean it, UnderlineStyle us, Colour c) Creates a font of the specified face, point size, bold style, italicisation, underline style and colourWritableFont
(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean it, UnderlineStyle us, Colour c, ScriptStyle ss) Creates a font of the specified face, point size, bold style, italicisation, underline style, colour, and script style (superscript/subscript) -
Method Summary
Modifier and TypeMethodDescriptionstatic WritableFont.FontName
createFont
(String fontName) Factory method which creates the specified font name.boolean
Accessor for the strike-out flagvoid
setBoldStyle
(jxl.write.WritableFont.BoldStyle boldStyle) Sets the bold style for this font, if the font hasn't been initializedvoid
Sets the colour for this font, if the font hasn't been initializedvoid
setItalic
(boolean italic) Sets the italic indicator for this font, if the font hasn't been initializedvoid
setPointSize
(int pointSize) Sets the point size for this font, if the font hasn't been initializedvoid
setScriptStyle
(ScriptStyle scriptStyle) Sets the script style (eg.void
setStruckout
(boolean struckout) Sets Accessor for the strike-out flagvoid
Sets the underline style for this font, if the font hasn't been initializedMethods inherited from class jxl.biff.FontRecord
equals, getBoldWeight, getColour, getData, getFontIndex, getName, getPointSize, getScriptStyle, getUnderlineStyle, hashCode, initialize, isInitialized, isItalic, uninitialize
Methods inherited from class jxl.biff.WritableRecordData
getBytes
-
Field Details
-
ARIAL
Objects created with this font name will be rendered within Excel as ARIAL fonts -
TIMES
Objects created with this font name will be rendered within Excel as TIMES fonts -
COURIER
Objects created with this font name will be rendered within Excel as COURIER fonts -
TAHOMA
Objects created with this font name will be rendered within Excel as TAHOMA fonts -
NO_BOLD
public static final jxl.write.WritableFont.BoldStyle NO_BOLDIndicates that this font should not be presented as bold -
BOLD
public static final jxl.write.WritableFont.BoldStyle BOLDIndicates that this font should be presented in a BOLD style -
DEFAULT_POINT_SIZE
public static final int DEFAULT_POINT_SIZEThe default point size for all Fonts- See Also:
-
-
Constructor Details
-
WritableFont
Creates a default font, vanilla font of the specified face and with default point size.- Parameters:
fn
- the font name
-
WritableFont
Publicly available copy constructor- Parameters:
f
- the font to copy
-
WritableFont
Constructs of font of the specified face and of size given by the specified point size- Parameters:
fn
- the font nameps
- the point size
-
WritableFont
Creates a font of the specified face, point size and bold style- Parameters:
fn
- the font nameps
- the point sizebs
- the bold style
-
WritableFont
public WritableFont(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean italic) Creates a font of the specified face, point size, bold weight and italicised option.- Parameters:
fn
- the font nameps
- the point sizebs
- the bold styleitalic
- italic flag
-
WritableFont
public WritableFont(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean it, UnderlineStyle us) Creates a font of the specified face, point size, bold weight, italicisation and underline style- Parameters:
fn
- the font nameps
- the point sizebs
- the bold styleit
- italic flagus
- the underline style
-
WritableFont
public WritableFont(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean it, UnderlineStyle us, Colour c) Creates a font of the specified face, point size, bold style, italicisation, underline style and colour- Parameters:
fn
- the font nameps
- the point sizebs
- the bold styleit
- italic flagus
- the underline stylec
- the colour
-
WritableFont
public WritableFont(WritableFont.FontName fn, int ps, jxl.write.WritableFont.BoldStyle bs, boolean it, UnderlineStyle us, Colour c, ScriptStyle ss) Creates a font of the specified face, point size, bold style, italicisation, underline style, colour, and script style (superscript/subscript)- Parameters:
fn
- the font nameps
- the point sizebs
- the bold styleit
- the italic flagus
- the underline stylec
- the colourss
- the script style
-
-
Method Details
-
setPointSize
Sets the point size for this font, if the font hasn't been initialized- Parameters:
pointSize
- the point size- Throws:
WriteException
-
setBoldStyle
Sets the bold style for this font, if the font hasn't been initialized- Parameters:
boldStyle
- the bold style- Throws:
WriteException
-
setItalic
Sets the italic indicator for this font, if the font hasn't been initialized- Parameters:
italic
- the italic flag- Throws:
WriteException
-
setUnderlineStyle
Sets the underline style for this font, if the font hasn't been initialized- Parameters:
us
- the underline style- Throws:
WriteException
-
setColour
Sets the colour for this font, if the font hasn't been initialized- Parameters:
colour
- the colour- Throws:
WriteException
-
setScriptStyle
Sets the script style (eg. superscript, subscript) for this font, if the font hasn't been initialized- Parameters:
scriptStyle
- the colour- Throws:
WriteException
-
isStruckout
public boolean isStruckout()Accessor for the strike-out flag- Specified by:
isStruckout
in interfaceFont
- Overrides:
isStruckout
in classjxl.biff.FontRecord
- Returns:
- the strike-out flag
-
setStruckout
Sets Accessor for the strike-out flag- Parameters:
struckout
- TRUE if this is a struckout font- Throws:
WriteException
-
createFont
Factory method which creates the specified font name. This method should be used with care, since the string used to create the font name must be recognized by Excel's internal processing- Parameters:
fontName
- the name of the Excel font- Returns:
- the font name
-