public class Workbook extends Object implements Iterable<Spreadsheet>, Serializable
Constructor and Description |
---|
Workbook()
Creates a new empty workbook.
|
Workbook(int sheets)
Creates a new workbook, which initially contains the given number
of blank spreadsheets.
|
Workbook(String[][]... contents)
Creates a new workbook, using the given content matrix to create
spreadsheets initially.
|
Modifier and Type | Method and Description |
---|---|
void |
addSpreadsheet()
Adds a blank spreadsheet to the end of the workbook.
|
void |
addSpreadsheet(String[][] content)
Adds a new spreadsheet to the workbook, in which cells are initialized
with data from the given content matrix.
|
void |
addWorkbookListener(WorkbookListener listener)
Registers the given listener on the workbook.
|
Spreadsheet |
getSpreadsheet(int index)
Returns the spreadsheet at the given index.
|
int |
getSpreadsheetCount()
Returns the number of spreadsheets in the the workbook.
|
WorkbookListener[] |
getWorkbookListeners()
Returns the listeners that have been registered on the workbook.
|
Iterator<Spreadsheet> |
iterator()
Returns an iterator over the spreadsheets in the workbook.
|
void |
removeSpreadsheet(Spreadsheet spreadsheet)
Adds a new blank spreadsheet to the workbook.
|
void |
removeWorkbookListener(WorkbookListener listener)
Removes the given listener from the workbook.
|
public Workbook()
public Workbook(int sheets)
sheets
- the number of sheets to create initiallypublic void addSpreadsheet()
public void addSpreadsheet(String[][] content)
content
- the contents of the cells in the spreadsheetpublic void removeSpreadsheet(Spreadsheet spreadsheet)
public Spreadsheet getSpreadsheet(int index) throws IndexOutOfBoundsException
index
- the index of the spreadsheet in the workbookIndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= |spreadsheets|)public int getSpreadsheetCount()
public Iterator<Spreadsheet> iterator()
iterator
in interface Iterable<Spreadsheet>
public void addWorkbookListener(WorkbookListener listener)
listener
- the listener to be addedpublic void removeWorkbookListener(WorkbookListener listener)
listener
- the listener to be removedpublic WorkbookListener[] getWorkbookListeners()