Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jxl
Class Workbook

    java.lang.Object
      jxl.Workbook

    public abstract class Workbook

extends java.lang.Object

Represents a Workbook. Contains the various factory methods and provides a variety of accessors which provide access to the work sheets.

Method Summary
`abstract void` | `close()` Closes this workbook, and frees makes any memory allocated available for garbage collection
`static WritableWorkbook` | `createWorkbook(java.io.File file)` Creates a writable workbook with the given file name
`static WritableWorkbook` | `createWorkbook(java.io.File file, Workbook in)` Creates a writable workbook with the given filename as a copy of the workbook passed in.
`static WritableWorkbook` | `createWorkbook(java.io.File file, WorkbookSettings ws)` Creates a writable workbook with the given file name
`static WritableWorkbook` | `createWorkbook(java.io.File file, Workbook in, WorkbookSettings ws)` Creates a writable workbook with the given filename as a copy of the workbook passed in.
`static WritableWorkbook` | `createWorkbook(java.io.OutputStream os)` Creates a writable workbook.
`static WritableWorkbook` | `createWorkbook(java.io.OutputStream os, Workbook in)` Creates a writable workbook as a copy of the workbook passed in.
`static WritableWorkbook` | `createWorkbook(java.io.OutputStream os, WorkbookSettings ws)` Creates a writable workbook.
`static WritableWorkbook` | `createWorkbook(java.io.OutputStream os, Workbook in, WorkbookSettings ws)` Creates a writable workbook as a copy of the workbook passed in.
`abstract Range[]` | `findByName(java.lang.String name)` Gets the named range from this workbook.
`abstract Cell` | `findCellByName(java.lang.String name)` Gets the named cell from this workbook.
`abstract Cell` | `getCell(java.lang.String loc)` Returns the cell for the specified location eg.
`abstract int` | `getNumberOfSheets()` Returns the number of sheets in this workbook
`abstract java.lang.String[]` | `getRangeNames()` Gets the named ranges
`abstract Sheet` | `getSheet(int index)` Gets the specified sheet within this workbook As described in the accompanying technical notes, each call to getSheet forces a reread of the sheet (for memory reasons).
`abstract Sheet` | `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 Sheet[]` | `getSheets()` Gets the sheets within this workbook.
`static java.lang.String` | `getVersion()` Accessor for the software version
`static Workbook` | `getWorkbook(java.io.File file)` A factory method which takes in an excel file and reads in the contents.
`static Workbook` | `getWorkbook(java.io.File file, WorkbookSettings ws)` A factory method which takes in an excel file and reads in the contents.
`static Workbook` | `getWorkbook(java.io.InputStream is)` A factory method which takes in an excel file and reads in the contents.
`static Workbook` | `getWorkbook(java.io.InputStream is, WorkbookSettings ws)` A factory method which takes in an excel file and reads in the contents.
`abstract boolean` | `isProtected()` Determines whether the sheet is protected

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getSheets

    public abstract Sheet[] 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

### getSheetNames

    public abstract java.lang.String[] getSheetNames()

  Gets the sheet names

  Returns:
    an array of strings containing the sheet names

### getSheet

    public abstract Sheet getSheet(int index)
                            throws java.lang.IndexOutOfBoundsException

  Gets the specified sheet within this workbook As described in the accompanying technical notes, each call to getSheet forces a reread of the sheet (for memory reasons). Therefore, do not make unnecessary calls to this method. Furthermore, do not hold unnecessary references to Sheets in client code, as this will prevent the garbage collector from freeing the memory

  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 Sheet getSheet(java.lang.String name)

  Gets the sheet with the specified name from within this workbook. As described in the accompanying technical notes, each call to getSheet forces a reread of the sheet (for memory reasons). Therefore, do not make unnecessary calls to this method. Furthermore, do not hold unnecessary references to Sheets in client code, as this will prevent the garbage collector from freeing the memory

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

### getVersion

    public static java.lang.String getVersion()

  Accessor for the software version

  Returns:
    the version

### getNumberOfSheets

    public abstract int getNumberOfSheets()

  Returns the number of sheets in this workbook

  Returns:
    the number of sheets in this workbook

### findCellByName

    public abstract Cell findCellByName(java.lang.String name)

  Gets the named cell from this workbook. If the name refers to a range of cells, then the cell on the top left is returned. If the name cannot be found, null is returned. This is a convenience function to quickly access the contents of a single cell. If you need further information (such as the sheet or adjacent cells in the range) use the functionally richer method, findByName which returns a list of ranges

  Parameters:
    `name` - the name of the cell/range to search for
  Returns:
    the cell in the top left of the range if found, NULL otherwise

### getCell

    public abstract Cell getCell(java.lang.String loc)

  Returns the cell for the specified location eg. "Sheet1!A4". This is identical to using the CellReferenceHelper with its associated performance overheads, consequently it should be use sparingly

  Parameters:
    `loc` - the cell to retrieve
  Returns:
    the cell at the specified location

### 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

  Parameters:
    `name` - the name of the cell/range to search for
  Returns:
    the range of cells, or NULL if the range does not exist

### getRangeNames

    public abstract java.lang.String[] getRangeNames()

  Gets the named ranges

  Returns:
    the list of named cells within the workbook

### isProtected

    public abstract boolean isProtected()

  Determines whether the sheet is protected

  Returns:
    TRUE if the workbook is protected, FALSE otherwise

### close

    public abstract void close()

  Closes this workbook, and frees makes any memory allocated available for garbage collection

### getWorkbook

    public static Workbook getWorkbook(java.io.File file)
                                throws java.io.IOException,
                                       jxl.read.biff.BiffException

  A factory method which takes in an excel file and reads in the contents.

  Parameters:
    `file` - the excel 97 spreadsheet to parse
  Returns:
    a workbook instance
  Throws:
    `java.io.IOException`
    `jxl.read.biff.BiffException`

### getWorkbook

    public static Workbook getWorkbook(java.io.File file,
                                       WorkbookSettings ws)
                                throws java.io.IOException,
                                       jxl.read.biff.BiffException

  A factory method which takes in an excel file and reads in the contents.

  Parameters:
    `file` - the excel 97 spreadsheet to parse
    `ws` - the settings for the workbook
  Returns:
    a workbook instance
  Throws:
    `java.io.IOException`
    `jxl.read.biff.BiffException`

### getWorkbook

    public static Workbook getWorkbook(java.io.InputStream is)
                                throws java.io.IOException,
                                       jxl.read.biff.BiffException

  A factory method which takes in an excel file and reads in the contents.

  Parameters:
    `is` - an open stream which is the the excel 97 spreadsheet to parse
  Returns:
    a workbook instance
  Throws:
    `java.io.IOException`
    `jxl.read.biff.BiffException`

### getWorkbook

    public static Workbook getWorkbook(java.io.InputStream is,
                                       WorkbookSettings ws)
                                throws java.io.IOException,
                                       jxl.read.biff.BiffException

  A factory method which takes in an excel file and reads in the contents.

  Parameters:
    `is` - an open stream which is the the excel 97 spreadsheet to parse
    `ws` - the settings for the workbook
  Returns:
    a workbook instance
  Throws:
    `java.io.IOException`
    `jxl.read.biff.BiffException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.File file)
                                           throws java.io.IOException

  Creates a writable workbook with the given file name

  Parameters:
    `file` - the workbook to copy
  Returns:
    a writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.File file,
                                                  WorkbookSettings ws)
                                           throws java.io.IOException

  Creates a writable workbook with the given file name

  Parameters:
    `file` - the file to copy from
    `ws` - the global workbook settings
  Returns:
    a writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.File file,
                                                  Workbook in)
                                           throws java.io.IOException

  Creates a writable workbook with the given filename as a copy of the workbook passed in. Once created, the contents of the writable workbook may be modified

  Parameters:
    `file` - the output file for the copy
    `in` - the workbook to copy
  Returns:
    a writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.File file,
                                                  Workbook in,
                                                  WorkbookSettings ws)
                                           throws java.io.IOException

  Creates a writable workbook with the given filename as a copy of the workbook passed in. Once created, the contents of the writable workbook may be modified

  Parameters:
    `file` - the output file for the copy
    `in` - the workbook to copy
    `ws` - the configuration for this workbook
  Returns:
    a writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.OutputStream os,
                                                  Workbook in)
                                           throws java.io.IOException

  Creates a writable workbook as a copy of the workbook passed in. Once created, the contents of the writable workbook may be modified

  Parameters:
    `os` - the stream to write to
    `in` - the workbook to copy
  Returns:
    a writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.OutputStream os,
                                                  Workbook in,
                                                  WorkbookSettings ws)
                                           throws java.io.IOException

  Creates a writable workbook as a copy of the workbook passed in. Once created, the contents of the writable workbook may be modified

  Parameters:
    `os` - the output stream to write to
    `in` - the workbook to copy
    `ws` - the configuration for this workbook
  Returns:
    a writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.OutputStream os)
                                           throws java.io.IOException

  Creates a writable workbook. When the workbook is closed, it will be streamed directly to the output stream. In this manner, a generated excel spreadsheet can be passed from a servlet to the browser over HTTP

  Parameters:
    `os` - the output stream
  Returns:
    the writable workbook
  Throws:
    `java.io.IOException`

### createWorkbook

    public static WritableWorkbook createWorkbook(java.io.OutputStream os,
                                                  WorkbookSettings ws)
                                           throws java.io.IOException

  Creates a writable workbook. When the workbook is closed, it will be streamed directly to the output stream. In this manner, a generated excel spreadsheet can be passed from a servlet to the browser over HTTP

  Parameters:
    `os` - the output stream
    `ws` - the configuration for this workbook
  Returns:
    the writable workbook
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD