Package jxl.write
Class WritableCellFormat
java.lang.Object
jxl.biff.RecordData
jxl.biff.WritableRecordData
jxl.biff.XFRecord
jxl.write.biff.CellXFRecord
jxl.write.WritableCellFormat
- All Implemented Interfaces:
jxl.biff.ByteData
,CellFormat
public class WritableCellFormat
extends jxl.write.biff.CellXFRecord
A user specified cell format, which may be reused across many cells.
The constructors takes parameters, such as font details and the numerical
date formats, which specify to Excel how cells with this format should be
displayed.
Once a CellFormat has been added to a Cell which has been added to
a sheet, then the CellFormat becomes immutable (to prevent unforeseen
effects on other cells which share the same format). Attempts to
call the various set... functions on a WritableCellFormat after this
time will result in a runtime exception.
-
Field Summary
Fields inherited from class jxl.biff.XFRecord
biff7, biff8, formatIndex
-
Constructor Summary
ConstructorsConstructorDescriptionA default constructor, which uses the default font and format.WritableCellFormat
(jxl.biff.DisplayFormat format) A constructor which specifies a date/number format for Cells which use this format objectWritableCellFormat
(CellFormat format) A public copy constructor which can be used for copy formats between different sheetsA CellFormat which specifies the font for cells with this formatWritableCellFormat
(WritableFont font, jxl.biff.DisplayFormat format) A constructor which specifies the font and date/number format for cells which wish to use this format -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets the horizontal alignment for this formatvoid
Sets the background colour for this cell formatvoid
setBackground
(Colour c, Pattern p) Sets the background colour and pattern for this cell formatvoid
setBorder
(Border b, BorderLineStyle ls) Sets the specified border for this formatvoid
setBorder
(Border b, BorderLineStyle ls, Colour c) Sets the specified border for this formatvoid
setIndentation
(int i) Sets the indentation of the cell textvoid
setLocked
(boolean l) Sets whether or not this XF record locks the cell.void
Sets the text orientation for this formatvoid
setShrinkToFit
(boolean s) Sets the shrink to fit flagvoid
Sets the vertical alignment for this formatvoid
setWrap
(boolean w) Sets the wrap indicator for this format.Methods inherited from class jxl.biff.XFRecord
equals, getAlignment, getBackgroundColour, getBorder, getBorderColour, getBorderLine, getData, getDateFormat, getFont, getFontIndex, getFormat, getFormatRecord, getIndentation, getNumberFormat, getOrientation, getPattern, getVerticalAlignment, getWrap, getXFIndex, hasBorders, hashCode, initialize, isDate, isInitialized, isLocked, isNumber, isRead, isShrinkToFit, setFont, uninitialize
Methods inherited from class jxl.biff.WritableRecordData
getBytes
-
Constructor Details
-
WritableCellFormat
public WritableCellFormat()A default constructor, which uses the default font and format. This constructor should be used in conjunction with the more advanced two-phase methods setAlignment, setBorder etc. -
WritableCellFormat
A CellFormat which specifies the font for cells with this format- Parameters:
font
- the font
-
WritableCellFormat
public WritableCellFormat(jxl.biff.DisplayFormat format) A constructor which specifies a date/number format for Cells which use this format object- Parameters:
format
- the format
-
WritableCellFormat
A constructor which specifies the font and date/number format for cells which wish to use this format- Parameters:
font
- the fontformat
- the date/number format
-
WritableCellFormat
A public copy constructor which can be used for copy formats between different sheets- Parameters:
format
- the cell format to copy
-
-
Method Details
-
setAlignment
Sets the horizontal alignment for this format- Overrides:
setAlignment
in classjxl.write.biff.CellXFRecord
- Parameters:
a
- the alignment- Throws:
WriteException
-
setVerticalAlignment
Sets the vertical alignment for this format- Overrides:
setVerticalAlignment
in classjxl.write.biff.CellXFRecord
- Parameters:
va
- the vertical alignment- Throws:
WriteException
-
setOrientation
Sets the text orientation for this format- Overrides:
setOrientation
in classjxl.write.biff.CellXFRecord
- Parameters:
o
- the orientation- Throws:
WriteException
-
setWrap
Sets the wrap indicator for this format. If the wrap is set to TRUE, then Excel will wrap data in cells with this format so that it fits within the cell boundaries- Overrides:
setWrap
in classjxl.write.biff.CellXFRecord
- Parameters:
w
- the wrap flag- Throws:
WriteException
-
setBorder
Sets the specified border for this format- Parameters:
b
- the borderls
- the border line style- Throws:
WriteException
-
setBorder
Sets the specified border for this format- Overrides:
setBorder
in classjxl.write.biff.CellXFRecord
- Parameters:
b
- the borderls
- the border line stylec
- the colour of the specified border- Throws:
WriteException
-
setBackground
Sets the background colour for this cell format- Parameters:
c
- the bacground colour- Throws:
WriteException
-
setBackground
Sets the background colour and pattern for this cell format- Overrides:
setBackground
in classjxl.write.biff.CellXFRecord
- Parameters:
c
- the colourp
- the pattern- Throws:
WriteException
-
setShrinkToFit
Sets the shrink to fit flag- Overrides:
setShrinkToFit
in classjxl.write.biff.CellXFRecord
- Parameters:
s
- shrink to fit flag- Throws:
WriteException
-
setIndentation
Sets the indentation of the cell text- Overrides:
setIndentation
in classjxl.write.biff.CellXFRecord
- Parameters:
i
- the indentation- Throws:
WriteException
-
setLocked
Sets whether or not this XF record locks the cell. For this to have any effect, the sheet containing cells with this format must also be locke3d- Overrides:
setLocked
in classjxl.write.biff.CellXFRecord
- Parameters:
l
- the locked flag- Throws:
WriteException
-