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:
ByteData, CellFormat

public class WritableCellFormat
extends 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.


Inner classes inherited from class jxl.biff.XFRecord
XFRecord.BiffType, XFRecord.XFType
 
Fields inherited from class jxl.biff.XFRecord
align, backgroundColour, biff7, biff8, biffType, bottomBorder, cell, copied, date, dateFormat, dateFormats, excelFormat, font, fontIndex, format, formatIndex, formatInfoInitialized, formattingRecords, hidden, initialized, javaDateFormats, javaNumberFormats, leftBorder, locked, number, numberFormat, numberFormats, options, orientation, parentFormat, pattern, read, rightBorder, shrinkToFit, style, topBorder, usedAttributes, valign, wrap, xfFormatType, xfIndex
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Fields inherited from class jxl.biff.RecordData
code, record
 
Constructor Summary
WritableCellFormat()
          A default constructor, which uses the default font and format.
WritableCellFormat(CellFormat format)
          A public copy constructor which can be used for copy formats between different sheets
WritableCellFormat(DisplayFormat format)
          A constructor which specifies a date/number format for Cells which use this format object
WritableCellFormat(WritableFont font)
          A CellFormat which specifies the font for cells with this format
WritableCellFormat(WritableFont font, DisplayFormat format)
          A constructor which specifies the font and date/number format for cells which wish to use this format
 
Method Summary
 void setAlignment(Alignment a)
          Sets the horizontal alignment for this format
 void setBackground(Colour c)
          Sets the background colour for this cell format
 void setBackground(Colour c, Pattern p)
          Sets the background colour and pattern for this cell format
 void setBorder(Border b, BorderLineStyle ls)
          Sets the specified border for this format
 void setOrientation(Orientation o)
          Sets the text orientation for this format
 void setShrinkToFit(boolean s)
          Sets the shrink to fit flag
 void setVerticalAlignment(VerticalAlignment va)
          Sets the vertical alignment for this format
 void setWrap(boolean w)
          Sets the wrap indicator for this format.
 
Methods inherited from class jxl.write.biff.CellXFRecord
setLocked
 
Methods inherited from class jxl.biff.XFRecord
equals, getAlignment, getBackgroundColour, getBorder, getData, getDateFormat, getFont, getFontIndex, getFormat, getFormatRecord, getHidden, getLocked, getNumberFormat, getOrientation, getPattern, getVerticalAlignment, getWrap, getXFIndex, hasBorders, initialize, initializeFormatInformation, isDate, isInitialized, isNumber, isRead, isShrinkToFit, rationalize, setFontIndex, setFormatIndex, setXFAlignment, setXFBackground, setXFBorder, setXFCellOptions, setXFDetails, setXFIndex, setXFLocked, setXFOrientation, setXFShrinkToFit, setXFVerticalAlignment, setXFWrap, uninitialize
 
Methods inherited from class jxl.biff.WritableRecordData
getBytes, handleContinueRecords
 
Methods inherited from class jxl.biff.RecordData
getCode, getRecord
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

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

public WritableCellFormat(WritableFont font)
A CellFormat which specifies the font for cells with this format
Parameters:
font - the font

WritableCellFormat

public WritableCellFormat(DisplayFormat format)
A constructor which specifies a date/number format for Cells which use this format object
Parameters:
format - the format

WritableCellFormat

public WritableCellFormat(WritableFont font,
                          DisplayFormat format)
A constructor which specifies the font and date/number format for cells which wish to use this format
Parameters:
font - the font
format - the date/number format

WritableCellFormat

public WritableCellFormat(CellFormat format)
A public copy constructor which can be used for copy formats between different sheets
Method Detail

setAlignment

public void setAlignment(Alignment a)
                  throws WriteException
Sets the horizontal alignment for this format
Overrides:
setAlignment in class CellXFRecord
Parameters:
a -  
Throws:
WriteException -  

setVerticalAlignment

public void setVerticalAlignment(VerticalAlignment va)
                          throws WriteException
Sets the vertical alignment for this format
Overrides:
setVerticalAlignment in class CellXFRecord
Parameters:
va -  
Throws:
WriteException -  

setOrientation

public void setOrientation(Orientation o)
                    throws WriteException
Sets the text orientation for this format
Overrides:
setOrientation in class CellXFRecord
Parameters:
o -  
Throws:
WriteException -  

setWrap

public void setWrap(boolean w)
             throws WriteException
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 class CellXFRecord
Parameters:
w -  
Throws:
WriteException -  

setBorder

public void setBorder(Border b,
                      BorderLineStyle ls)
               throws WriteException
Sets the specified border for this format
Overrides:
setBorder in class CellXFRecord
Parameters:
b -  
ls -  
Throws:
WriteException -  

setBackground

public void setBackground(Colour c)
                   throws WriteException
Sets the background colour for this cell format
Parameters:
c -  
Throws:
WriteException -  

setBackground

public void setBackground(Colour c,
                          Pattern p)
                   throws WriteException
Sets the background colour and pattern for this cell format
Overrides:
setBackground in class CellXFRecord
Parameters:
c - the colour
p - the pattern
Throws:
WriteException -  

setShrinkToFit

public void setShrinkToFit(boolean s)
                    throws WriteException
Sets the shrink to fit flag
Overrides:
setShrinkToFit in class CellXFRecord
Parameters:
b - the shrink to fit flag