| Constructor and Description |
|---|
SpreadSheet()
Create an empty spreadsheet
|
SpreadSheet(File file)
Load a Spreadsheet from an ODS file.
|
SpreadSheet(InputStream in)
Load a Spreadsheet from an inputstream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSheet(Sheet sheet,
int pos)
Add a new sheet in a specific position
|
void |
appendSheet(Sheet sheet)
Append a new sheet at the end of the book
|
void |
clear()
Remove all sheets of the book.
|
Object |
clone() |
void |
deleteSheet(int pos)
Remove a specific sheet from the book
|
boolean |
deleteSheet(Sheet sheet)
Remove the specified sheet of the book.
|
boolean |
deleteSheet(String name)
Remove a specific sheet from the book specified by the name.
|
boolean |
equals(Object o)
Compare two spreadsheets.
|
int |
getNumSheets()
Return the number of sheets in the book
|
Sheet |
getSheet(int index)
Return a sheet with a given index.
|
Sheet |
getSheet(String name)
Return a sheet with a given name.
|
List<Sheet> |
getSheets()
Return all the sheets of the book in a list.
|
int |
hashCode() |
void |
removeAdditionalFile(String path)
This function allows you to remove files that you have added to the Spreadsheet
|
void |
save(File out)
Save this SpreadSheet in a ODS file.
|
void |
save(OutputStream out)
Save this Spreadsheet to the stream in the ODS format
|
boolean |
setAdditionalFile(String path,
String mimetype,
byte[] data)
This function allows you to add/edit additional files inside your Spreadsheet
This is an advanced feature which could be useful if you intent to store
macros inside the Spreadsheet file.This function will override existing files.
|
void |
setSheet(Sheet sheet,
int pos)
Replace the sheet in the position pos.
|
void |
sortSheets()
Deprecated.
This operation will be discarded for simplicity. You can easily recreate it with client code
|
void |
sortSheets(Comparator<Sheet> comparator)
Deprecated.
This operation will be discarded for simplicity. You can easily recreate it with client code
|
String |
toString() |
void |
trimSheets()
Deprecated.
this operation relay in sheet.trim(), which is also deprecated
|
public SpreadSheet()
public SpreadSheet(File file) throws IOException
file - The file to load. It must be a valid readable fileNullPointerException - If the file is nullFileNotFoundException - If the file doesn't exist or it can be readedNotAnOdsException - If the file isn't an ODS file.OperationNotSupportedException - If the ODS file has a feature which it's not implemented in this libraryIOException - If an unexpected IO error is producedSpreadSheet(InputStream)public SpreadSheet(InputStream in) throws IOException
in - The inputstream to readNullPointerException - If the inputstream is nullNotAnOdsException - If the file isn't an ODS file.OperationNotSupportedException - If the ODS file has a feature which it's not implemented in this libraryIOException - If an unexpected IO error is producedSpreadSheet(InputStream)public void appendSheet(Sheet sheet)
sheet - A valid not-null sheetNullPointerException - if the sheet is nullpublic void addSheet(Sheet sheet, int pos)
sheet - A valid not-null sheet.pos - Position where insert. It must be in the range [0, getNumSheets()]NullPointerException - if the sheet is nullIndexOutOfBoundsException - If the position is out of rangepublic void clear()
public void deleteSheet(int pos)
pos - The index of the sheetIndexOutOfBoundsException - if the index is out of rangepublic boolean deleteSheet(String name)
name - The name of the sheet.deleteSheet(Sheet)public boolean deleteSheet(Sheet sheet)
sheet - sheet to remove.deleteSheet(String)public List<Sheet> getSheets()
public int getNumSheets()
public Sheet getSheet(String name)
name - The name to look up.public Sheet getSheet(int index)
index - Position of the sheetIndexOutOfBoundsException - If the position is invalid.public void setSheet(Sheet sheet, int pos)
sheet - The new sheet, it must be not-null.pos - The position where insert the sheetNullPointerException - if the sheet is nullIndexOutOfBoundsException - if the position is invalidpublic void save(File out) throws IOException
out - The file to be writted. It must be no-null and be in a valid pathNullPointerException - If the file is nullFileNotFoundException - If the file is an invalid pathIOException - In case of an io error.public void save(OutputStream out) throws IOException
out - The outputstream to be writted. It must be no-nullNullPointerException - If the OutputStream is nullIOException - In case of an io error.public boolean setAdditionalFile(String path, String mimetype, byte[] data)
path: - Location (inside the Spreadsheet) where the file should be placedmimetype: - Type of the filedata: - The file content itselfIllegalArgumentException - The path belongs to a reserved filepublic void removeAdditionalFile(String path)
path: - Location (inside the Spreadsheet) where the file is placedNullPointerException - if the string is null@Deprecated public void sortSheets()
@Deprecated public void sortSheets(Comparator<Sheet> comparator)
comparator - The comparator used in the sortingpublic void trimSheets()
public boolean equals(Object o)
public Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionCopyright © 2023. All rights reserved.