jxl.write
Class WritableWorkbook

java.lang.Object
  extended byjxl.write.WritableWorkbook

public abstract class WritableWorkbook
extends java.lang.Object

A writable workbook


Field Summary
static WritableFont ARIAL_10_PT
          The default font for Cell formats
static WritableCellFormat HIDDEN_STYLE
          A cell format used to hide the cell contents
static WritableFont HYPERLINK_FONT
          The font used for hyperlinks
static WritableCellFormat HYPERLINK_STYLE
          The style used for hyperlinks
static WritableCellFormat NORMAL_STYLE
          The default style for cells
 
Method Summary
abstract  void close()
          Closes this workbook, and makes any memory allocated available for garbage collection.
abstract  void copySheet(int s, java.lang.String name, int index)
          Copies the specified sheet and places it at the index specified by the parameter
abstract  void copySheet(java.lang.String s, java.lang.String name, int index)
          Copies the specified sheet and places it at the index specified by the parameter
abstract  WritableSheet createSheet(java.lang.String name, int index)
          Creates, and returns a worksheet at the specified position with the specified name If the index specified is less than or equal to zero, the new sheet is created at the beginning of the workbook.
abstract  Range[] findByName(java.lang.String name)
          Gets the named range from this workbook.
abstract  WritableCell findCellByName(java.lang.String name)
          Gets the named cell from this workbook.
abstract  int getNumberOfSheets()
          Returns the number of sheets in this workbook
abstract  java.lang.String[] getRangeNames()
          Gets the named ranges
abstract  WritableSheet getSheet(int index)
          Gets the specified sheet within this workbook
abstract  WritableSheet getSheet(java.lang.String name)
          Gets the sheet with the specified name from within this workbook
abstract  java.lang.String[] getSheetNames()
          Gets the sheet names
abstract  WritableSheet[] getSheets()
          Gets the sheets within this workbook.
abstract  WritableSheet moveSheet(int fromIndex, int toIndex)
          Moves the specified sheet within this workbook to another index position.
abstract  void removeSheet(int index)
          Removes the sheet at the specified index from this workbook
abstract  void setColourRGB(Colour c, int r, int g, int b)
          Sets the RGB value for the specified colour for this workbook
abstract  void setProtected(boolean prot)
          Indicates whether or not this workbook is protected
abstract  void write()
          Writes out the data held in this workbook in Excel format
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARIAL_10_PT

public static final WritableFont ARIAL_10_PT
The default font for Cell formats


HIDDEN_STYLE

public static final WritableCellFormat HIDDEN_STYLE
A cell format used to hide the cell contents


HYPERLINK_FONT

public static final WritableFont HYPERLINK_FONT
The font used for hyperlinks


HYPERLINK_STYLE

public static final WritableCellFormat HYPERLINK_STYLE
The style used for hyperlinks


NORMAL_STYLE

public static final WritableCellFormat NORMAL_STYLE
The default style for cells

Method Detail

close

public abstract void close()
                    throws java.io.IOException
Closes this workbook, and makes any memory allocated available for garbage collection. Also closes the underlying output stream if necessary.

Throws:
java.io.IOException

copySheet

public abstract void copySheet(int s,
                               java.lang.String name,
                               int index)
Copies the specified sheet and places it at the index specified by the parameter

Parameters:
s - the index of the sheet to copy
name - the name of the new sheet
index - the position of the new sheet

copySheet

public abstract void copySheet(java.lang.String s,
                               java.lang.String name,
                               int index)
Copies the specified sheet and places it at the index specified by the parameter

Parameters:
s - the name of the sheet to copy
name - the name of the new sheet
index - the position of the new sheet

createSheet

public abstract WritableSheet createSheet(java.lang.String name,
                                          int index)
Creates, and returns a worksheet at the specified position with the specified name If the index specified is less than or equal to zero, the new sheet is created at the beginning of the workbook. If the index is greater than the number of sheet, then the sheet is created at the end of the workbook.

Parameters:
name - the sheet name
index - the index number at which to insert
Returns:
the new sheet

findByName

public abstract Range[] findByName(java.lang.String name)
Gets the named range from this workbook. The Range object returns contains all the cells from the top left to the bottom right of the range. If the named range comprises an adjacent range, the Range[] will contain one object; for non-adjacent ranges, it is necessary to return an array of length greater than one. If the named range contains a single cell, the top left and bottom right cell will be the same cell

Returns:
the range of cells

findCellByName

public abstract WritableCell findCellByName(java.lang.String name)
Gets the named cell from this workbook. The name refers to a range of cells, then the cell on the top left is returned. If the name cannot be, null is returned

Returns:
the cell in the top left of the range if found, NULL otherwise

getNumberOfSheets

public abstract int getNumberOfSheets()
Returns the number of sheets in this workbook

Returns:
the number of sheets in this workbook

getRangeNames

public abstract java.lang.String[] getRangeNames()
Gets the named ranges

Returns:
the list of named cells within the workbook

getSheet

public abstract WritableSheet getSheet(int index)
                                throws java.lang.IndexOutOfBoundsException
Gets the specified sheet within this workbook

Parameters:
index - the zero based index of the reQuired sheet
Returns:
The sheet specified by the index
Throws:
IndexOutOfBoundException - when index refers to a non-existent sheet
java.lang.IndexOutOfBoundsException

getSheet

public abstract WritableSheet getSheet(java.lang.String name)
Gets the sheet with the specified name from within this workbook

Parameters:
name - the sheet name
Returns:
The sheet with the specified name, or null if it is not found

getSheetNames

public abstract java.lang.String[] getSheetNames()
Gets the sheet names

Returns:
an array of strings containing the sheet names

getSheets

public abstract WritableSheet[] getSheets()
Gets the sheets within this workbook. Use of this method for large worksheets can cause performance problems.

Returns:
an array of the individual sheets

moveSheet

public abstract WritableSheet moveSheet(int fromIndex,
                                        int toIndex)
Moves the specified sheet within this workbook to another index position.

Parameters:
fromIndex - the zero based index of the required sheet
toIndex - the zero based index of the required sheet
Returns:
the sheet that has been moved

removeSheet

public abstract void removeSheet(int index)
Removes the sheet at the specified index from this workbook

Parameters:
index - the sheet index to remove

setColourRGB

public abstract void setColourRGB(Colour c,
                                  int r,
                                  int g,
                                  int b)
Sets the RGB value for the specified colour for this workbook

Parameters:
c - the colour whose RGB value is to be overwritten
r - the red portion to set (0-255)
g - the green portion to set (0-255)
b - the blue portion to set (0-255)

setProtected

public abstract void setProtected(boolean prot)
Indicates whether or not this workbook is protected

Parameters:
prot - Protected flag

write

public abstract void write()
                    throws java.io.IOException
Writes out the data held in this workbook in Excel format

Throws:
java.io.IOException