org.simpleods
public class OdsFile extends java.lang.Object
Constructor and Description |
---|
OdsFile(java.lang.String sName)
Create a new ODS file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addTable(java.lang.String sName)
Add a new table to the file, the new table is set to the active table.
|
TableCell |
getCell(int nTab,
int nRow,
int nCol)
Get the TableCell object.
|
TableCell |
getCell(int nTab,
java.lang.String sPos)
Get the TableCell object.
|
Content |
getContent() |
PageStyle |
getDefaultPageStyle() |
Footer |
getFooter()
Returns the current footer.
|
Header |
getHeader()
Returns the current header.
|
Meta |
getMeta()
Get the Meta data for this OdsFile.
|
java.lang.String |
getName()
The filename of the spreadsheet file.
|
Styles |
getStyles() |
java.lang.String |
getTableName(int n)
Returns the name of the table.
|
int |
getTableNumber(java.lang.String sName)
Search a table by name and return its number.
|
int |
lastTableNumber()
Gets the number of the last table.
|
boolean |
newFile(java.lang.String sName)
Create a new,empty file, use addTable to add tables.
|
boolean |
save()
Save the new file.
|
boolean |
save(java.io.OutputStream output)
Save the new file.
|
boolean |
setActiveTable(int nTab)
Set the active table, this is the table that is shown if you open the file.
|
void |
setActiveTable(java.lang.String sName)
Set the active table , this is the table that is shown if you open the file.
|
void |
setCell(int nTab,
int nRow,
int nCol,
java.util.Calendar cal)
Sets the cell value in table nTab to the date from the Calendar object.
|
void |
setCell(int nTab,
int nRow,
int nCol,
java.util.Calendar cal,
TableStyle ts)
Sets the cell value in table nTab to the date from the Calendar object.
|
void |
setCell(int nTab,
int nRow,
int nCol,
double dValue)
Sets the cell value in Table nTab to the given value, the value type is
TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
int nRow,
int nCol,
double dValue,
TableStyle ts)
Sets the cell value in table nTab to the given value, the value type is
TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
int nRow,
int nCol,
int nValue)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
int nRow,
int nCol,
int nValuetype,
java.lang.String sValue)
Sets the cell value in Table nTab to the given values.
|
void |
setCell(int nTab,
int nRow,
int nCol,
int nValuetype,
java.lang.String sValue,
TableStyle ts)
Sets the cell value in Table nTab to the given values.
|
void |
setCell(int nTab,
int nRow,
int nCol,
int nValue,
TableStyle ts)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
int nRow,
int nCol,
java.lang.String sValue)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_STRING.
|
void |
setCell(int nTab,
int nRow,
int nCol,
java.lang.String sValue,
TableStyle ts)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_STRING.
|
void |
setCell(int nTab,
java.lang.String sPos,
java.util.Calendar cal)
Sets the cell value in table nTab to the date from the Calendar object.
|
void |
setCell(int nTab,
java.lang.String sPos,
java.util.Calendar cal,
TableStyle ts)
Sets the cell value in table nTab to the date from the Calendar object.
|
void |
setCell(int nTab,
java.lang.String sPos,
double dValue)
Sets the cell value in Table nTab to the given value, the value type is
TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
java.lang.String sPos,
double dValue,
TableStyle ts)
Sets the cell value in table nTab to the given value, the value type is
TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
java.lang.String sPos,
int nValue)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
java.lang.String sPos,
int nValuetype,
java.lang.String sValue)
Sets the cell value in Table nTab to the given values.
|
void |
setCell(int nTab,
java.lang.String sPos,
int nValuetype,
java.lang.String sValue,
TableStyle ts)
Sets the cell value in Table nTab to the given values.
|
void |
setCell(int nTab,
java.lang.String sPos,
int nValue,
TableStyle ts)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_FLOAT.
|
void |
setCell(int nTab,
java.lang.String sPos,
java.lang.String sValue)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_STRING.
|
void |
setCell(int nTab,
java.lang.String sPos,
java.lang.String sValue,
TableStyle ts)
Sets the cell value in Table nTab to the given value, the value type is TableCell.STYLE_STRING.
|
void |
setCell(java.lang.String sTab,
int nRow,
int nCol,
int nValuetype,
java.lang.String sValue)
Deprecated.
As of release 0.2.1, use
getTableNumber(String) instead setCell("Tab2",1,1,"stringvalue") use setCell(getTableNumber("Tab2"),1,1,"stringvalue") |
void |
setCell(java.lang.String sTab,
int nRow,
int nCol,
int nValuetype,
java.lang.String sValue,
TableStyle ts)
Deprecated.
As of release 0.2.1, use
getTableNumber(String) instead e.g.setCell("Tab2",1,1,"stringvalue") use setCell(getTableNumber("Tab2"),1,1,"stringvalue") |
void |
setCellInAllTables(int nRow,
int nCol,
java.util.Calendar cal,
TableStyle ts)
Sets the cell value in all tables to the date from the Calendar object.
|
void |
setCellInAllTables(int nRow,
int nCol,
int nValuetype,
java.lang.String sValue,
TableStyle ts)
Sets the cell value in all tables to the given values.
|
void |
setCellInAllTables(java.lang.String sPos,
java.util.Calendar cal,
TableStyle ts)
Sets the cell value in all tables to the date from the Calendar object.
|
void |
setCellInAllTables(java.lang.String sPos,
int nValuetype,
java.lang.String sValue,
TableStyle ts)
Sets the cell value in all tables to the given values.
|
void |
setCellMerge(int nTab,
int nRow,
int nCol,
int nRowMerge,
int nColumnMerge)
Set the merging of multiple cells to one cell.
|
void |
setCellMerge(int nTab,
java.lang.String sPos,
int nRowMerge,
int nColumnMerge)
Set the merging of multiple cells to one cell.
|
void |
setCellMergeInAllTables(int nRow,
int nCol,
int nRowMerge,
int nColumnMerge)
Set the merging of multiple cells to one cell.
|
void |
setCellMergeInAllTables(java.lang.String sPos,
int nRowMerge,
int nColumnMerge)
Set the merging of multiple cells to one cell in all existing tables.
|
void |
setCellStyle(int nTab,
int nRow,
int nCol,
TableStyle ts)
Sets the style of this table cell.
|
void |
setCellStyle(int nTab,
java.lang.String sPos,
TableStyle ts)
Sets the style of this table cell.
|
void |
setCellStyle(java.lang.String sTab,
int nRow,
int nCol,
TableStyle ts)
Deprecated.
As of release 0.2.1, use
getTableNumber(String) instead setCellStyle("Tab2",1,1,"stringvalue") use setCellStyle(getTableNumber("Tab2"),1,1,"stringvalue") |
void |
setColumnStyle(int nTab,
int nCol,
TableStyle ts)
Sets the style of this table column.
|
void |
setContent(Content cont)
Set a new content to this OdsFile.
|
void |
setFooter(Footer f)
Sets a new footer object, any earlier footer that was set will be reset and the
new footer is used.
|
void |
setHeader(Header h)
Sets a new header object, any earlier header that was set will be reset and the.
|
void |
setStyles(Styles s)
Set the styles for this ODsFile to styles.
|
public OdsFile(java.lang.String sName)
sName
- - The filename for this file, if this file exists it is overwrittenpublic boolean newFile(java.lang.String sName)
sName
- - The filename of the new spreadsheet file, if this file exists it is overwrittenpublic java.lang.String getName()
public boolean save()
public boolean save(java.io.OutputStream output)
output
- The OutputStream that should be used.public Meta getMeta()
public void setActiveTable(java.lang.String sName)
sName
- The table name, this table should already exist, otherwise the first table is shownpublic boolean setActiveTable(int nTab)
nTab
- The table number, this table should already exist, otherwise the first table is shownpublic boolean addTable(java.lang.String sName) throws SimpleOdsException
sName
- - The name of the table to addSimpleOdsException
public void setCell(java.lang.String sTab, int nRow, int nCol, int nValuetype, java.lang.String sValue) throws SimpleOdsException
getTableNumber(String)
sTab
- The table name, this table must already existnRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValuetype
- The value type of sValue, TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or TableCell.STYLE_PERCENTAGEsValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, int nValuetype, java.lang.String sValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValuetype
- The value type of sValue, TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or TableCell.STYLE_PERCENTAGEsValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, int nValuetype, java.lang.String sValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'nValuetype
- The value type of sValue, TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or TableCell.STYLE_PERCENTAGEsValue
- The value to set the cell toSimpleOdsException
public void setCell(java.lang.String sTab, int nRow, int nCol, int nValuetype, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
getTableNumber(String)
sTab
- The table name, this table must already existnRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValuetype
- The value type of sValue, TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or TableCell.STYLE_PERCENTAGE.sValue
- The value to set the cell tots
- The table style for this cell, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, int nValuetype, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first table.nRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValuetype
- The value type of sValue, TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or TableCell.STYLE_PERCENTAGE.sValue
- The value to set the cell tots
- The table style for this cell, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, int nValuetype, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'nValuetype
- The value type of sValue, TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or TableCell.STYLE_PERCENTAGE.sValue
- The value to set the cell tots
- The table style for this cell, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, java.lang.String sValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnsValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, java.lang.String sValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'sValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnsValue
- The value to set the cell tots
- The table style for this cell, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'sValue
- The value to set the cell tots
- The table style for this cell, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, int nValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, int nValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'nValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, int nValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValue
- The value to set the cell tots
- The table style for this cell, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, int nValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'nValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, double dValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columndValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, double dValue) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablesPos
- The cell position e.g. 'A1'dValue
- The value to set the cell toSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, double dValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columndValue
- The value to set the cell tots
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, double dValue, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablesPos
- The cell position e.g. 'A1'dValue
- The value to set the cell tots
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, java.util.Calendar cal) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columncal
- The calendar object with the dateSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, java.util.Calendar cal) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablesPos
- The cell position e.g. 'A1'cal
- The calendar object with the dateSimpleOdsException
public void setCell(int nTab, int nRow, int nCol, java.util.Calendar cal, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columncal
- The calendar object with the datets
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCell(int nTab, java.lang.String sPos, java.util.Calendar cal, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablesPos
- The cell position e.g. 'A1'cal
- The calendar object with the datets
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public TableCell getCell(int nTab, int nRow, int nCol) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnSimpleOdsException
public TableCell getCell(int nTab, java.lang.String sPos) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the
first tablesPos
- The cell position e.g. 'A1'SimpleOdsException
public void setCellInAllTables(int nRow, int nCol, int nValuetype, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
nRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnValuetype
- The value type of sValue,
TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or
TableCell.STYLE_PERCENTAGE.sValue
- The value to set the cell tots
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellInAllTables(java.lang.String sPos, int nValuetype, java.lang.String sValue, TableStyle ts) throws SimpleOdsException
sPos
- The cell position e.g. 'A1'nValuetype
- The value type of sValue,
TableCell.STYLE_STRING,TableCell.STYLE_FLOAT or
TableCell.STYLE_PERCENTAGE.sValue
- The value to set the cell tots
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellInAllTables(int nRow, int nCol, java.util.Calendar cal, TableStyle ts) throws SimpleOdsException
nRow
- The row, 0 is the first rownCol
- The column, 0 is the first columncal
- The calendar object with the datets
- The table style for this cell, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellInAllTables(java.lang.String sPos, java.util.Calendar cal, TableStyle ts) throws SimpleOdsException
sPos
- The cell position e.g. 'A1'cal
- The calendar object with the datets
- The table style for this cells, must be of type
TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellStyle(java.lang.String sTab, int nRow, int nCol, TableStyle ts) throws SimpleOdsException
getTableNumber(String)
sTab
- The table name, this table must already existnRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnts
- The table style to be used, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellStyle(int nTab, int nRow, int nCol, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already existnRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnts
- The table style to be used, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellStyle(int nTab, java.lang.String sPos, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already existsPos
- The cell position e.g. 'A1'ts
- The table style to be used, must be of type TableStyle.STYLEFAMILY_TABLECELLSimpleOdsException
public void setCellMerge(int nTab, int nRow, int nCol, int nRowMerge, int nColumnMerge) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablenRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnRowMerge
- nColumnMerge
- SimpleOdsException
public void setCellMerge(int nTab, java.lang.String sPos, int nRowMerge, int nColumnMerge) throws SimpleOdsException
nTab
- The table number, this table must already exist, 0 is the first tablesPos
- The cell position e.g. 'A1'nRowMerge
- nColumnMerge
- SimpleOdsException
public void setCellMergeInAllTables(int nRow, int nCol, int nRowMerge, int nColumnMerge) throws SimpleOdsException
nRow
- The row, 0 is the first rownCol
- The column, 0 is the first columnnRowMerge
- nColumnMerge
- SimpleOdsException
public void setCellMergeInAllTables(java.lang.String sPos, int nRowMerge, int nColumnMerge) throws SimpleOdsException
sPos
- The cell position e.g. 'A1'nRowMerge
- nColumnMerge
- SimpleOdsException
public void setColumnStyle(int nTab, int nCol, TableStyle ts) throws SimpleOdsException
nTab
- The table number, this table must already existnCol
- The column, 0 is the first columnts
- The table style to be used, must be of type TableStyle.STYLEFAMILY_TABLECOLUMNSimpleOdsException
public PageStyle getDefaultPageStyle()
public int lastTableNumber()
public int getTableNumber(java.lang.String sName)
sName
- The name of the tablepublic java.lang.String getTableName(int n) throws SimpleOdsException
n
- The number of the tableSimpleOdsException
public void setFooter(Footer f)
f
- - The new footer to be used.public Footer getFooter()
public void setHeader(Header h)
h
- - The new header to be used.public Header getHeader()
public Content getContent()
public void setContent(Content cont)
content
- The new content to be used.public Styles getStyles()
public final void setStyles(Styles s)
s
- - The new styles object to be used.