public class ExcelFile
extends java.lang.Object
implements java.io.Serializable
This class is a representation of a workbook.
File access
This class have 2 methods for the file access: readFile()
and
writeFile()
. Also it has ability loading another file or saving to
other location - see setFileName(String)
.
Data access
Data may be read from and written to a workbook using various
getCell*(...)
and setCell*(...)
methods. This
object allows reading table functions (readTableFunction()
) and
hyper arrays (with 1 or 2 dimensions, see readHyperArray
) from
the sheet. Also, data sets may be written using writeDataSet
.
New cells may need to be created before writing data:
createCell(...)
(cell may be checked using
cellExists()
)
Cell access
All cell-access methods have 3 forms of cell location specification:
<sheet name>!<column name><row number>
"Sheet1!A3"
, "Sheet2!AAB100"
, "B2"
Model Snapshot serialization notes
This workbook may include all unsaved data (if any) to the model snapshot -
this is controlled by parameter saveToSnapshot
of
constructor.
Modifier and Type | Field and Description |
---|---|
static int |
CELL_TYPE_BLANK
Blank Cell type
|
static int |
CELL_TYPE_BOOLEAN
Boolean Cell type
|
static int |
CELL_TYPE_ERROR
Error Cell type
|
static int |
CELL_TYPE_FORMULA
Formula Cell type
|
static int |
CELL_TYPE_NUMERIC
Numeric Cell type
|
static int |
CELL_TYPE_STRING
String Cell type
|
Constructor and Description |
---|
ExcelFile(Presentable owner,
java.lang.String packagePrefix,
java.lang.String fileName,
boolean saveToSnapshot)
Creates new ExcelTM file accessor
|
ExcelFile(java.lang.String fileName,
boolean saveToSnapshot)
Deprecated.
this constructor is obsolete and will be removed in future
|
Modifier and Type | Method and Description |
---|---|
boolean |
cellExists(int sheetIndex,
int rowIndex,
int columnIndex)
Returns
true if the cell at the given position exists in the
workbook |
boolean |
cellExists(java.lang.String cellName)
Returns
true if the cell at the given position exists in the
workbook |
boolean |
cellExists(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns
true if the cell at the given position exists in the
workbook |
void |
clearCell(int sheetIndex,
int rowIndex,
int columnIndex)
Clears type and value of the cell.
|
void |
close()
Closes the workbook.
|
void |
createCell(int sheetIndex,
int rowIndex,
int columnIndex)
Creates new cell at the given position.
|
void |
createCell(java.lang.String cellName)
Creates new cell at the given position.
|
void |
createCell(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Creates new cell at the given position.
|
void |
evaluateFormulas()
Evaluates formulas and saves the results for all the cells containing
formulas in this workbook.
|
boolean |
getCellBooleanValue(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the value of the cell as a
boolean . |
boolean |
getCellBooleanValue(java.lang.String cellName)
Returns the value of the cell as a
boolean . |
boolean |
getCellBooleanValue(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the value of the cell as a
boolean . |
java.util.Date |
getCellDateValue(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the value of the cell as a date.
|
java.util.Date |
getCellDateValue(java.lang.String cellName)
Returns the value of the cell as a date.
|
java.util.Date |
getCellDateValue(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the value of the cell as a date.
|
byte |
getCellErrorValue(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the value of the cell as an error code.
|
byte |
getCellErrorValue(java.lang.String cellName)
Returns the value of the cell as an error code.
|
byte |
getCellErrorValue(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the value of the cell as an error code.
|
java.lang.String |
getCellFormula(int sheetIndex,
int rowIndex,
int columnIndex)
Return a formula for the cell, for example, SUM(C4:E4)
|
java.lang.String |
getCellFormula(java.lang.String cellName)
Return a formula for the cell, for example, SUM(C4:E4)
|
java.lang.String |
getCellFormula(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Return a formula for the cell, for example, SUM(C4:E4)
|
int |
getCellFormulaType(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the type of the formula cell.
|
int |
getCellFormulaType(java.lang.String cellName)
Returns the type of the formula cell.
|
int |
getCellFormulaType(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the type of the formula cell.
|
double |
getCellNumericValue(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the value of the cell as a number.
|
double |
getCellNumericValue(java.lang.String cellName)
Returns the value of the cell as a number.
|
double |
getCellNumericValue(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the value of the cell as a number.
|
java.lang.String |
getCellStringValue(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the value of the cell as a string - for numeric cells throws an
exception.
|
java.lang.String |
getCellStringValue(java.lang.String cellName)
Returns the value of the cell as a string - for numeric cells throws an
exception.
|
java.lang.String |
getCellStringValue(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the value of the cell as a string - for numeric cells throws an
exception.
|
int |
getCellType(int sheetIndex,
int rowIndex,
int columnIndex)
Returns the cell type (numeric, formula, string...)
|
int |
getCellType(java.lang.String cellName)
Returns the cell type (numeric, formula, string...)
|
int |
getCellType(java.lang.String sheetName,
int rowIndex,
int columnIndex)
Returns the cell type (numeric, formula, string...)
|
int |
getFirstCellNum(int sheetIndex,
int rowIndex)
Returns the number of the first cell contained in this row (the 1-based
column number of the first cell).
|
int |
getFirstCellNum(java.lang.String sheetName,
int rowIndex)
Returns the number of the first cell contained in this row (the 1-based
column number of the first cell).
|
int |
getFirstRowNum(int sheetIndex)
Returns the first row on the sheet
|
int |
getFirstRowNum(java.lang.String sheetName)
Returns the first row on the sheet
|
int |
getLastCellNum(int sheetIndex,
int rowIndex)
Returns the index of the last cell contained in this row (the 1-based
column number of the last cell).
|
int |
getLastCellNum(java.lang.String sheetName,
int rowIndex)
Returns the index of the last cell contained in this row (the 1-based
column number of the last cell).
|
int |
getLastRowNum(int sheetIndex)
Returns the number of the last row on the sheet.
|
int |
getLastRowNum(java.lang.String sheetName)
Returns the number of the last row on the sheet.
|
int |
getNumberOfSheets()
Returns the number of spreadsheets in the workbook
|
int |
getSheetIndex(java.lang.String sheetName)
Returns the index of the sheet with the given name.
|
java.lang.String |
getSheetName(int sheetIndex)
Returns the sheet name for the specified index
|
org.apache.poi.ss.usermodel.Workbook |
getWorkbook()
Returns internal class of the workbook,
null if file isn't
not loaded. |
boolean |
isLoaded()
Returns
true if workbook is loaded from file. |
void |
readFile()
Loads the workbook from the file.
|
void |
readHyperArray(HyperArray array,
int sheetIndex,
int rowIndex,
int columnIndex,
boolean dim1AcrossRows)
Reads one- or two-dimensional
HyperArray data from the sheet
starting at the given cell. |
void |
readHyperArray(HyperArray array,
java.lang.String cellName,
boolean dim1AcrossRows)
Reads one- or two-dimensional
HyperArray data from the sheet
starting at the given cell. |
void |
readHyperArray(HyperArray array,
java.lang.String sheetName,
int rowIndex,
int columnIndex,
boolean dim1AcrossRows)
Reads one- or two-dimensional
HyperArray data from the sheet
starting at the given cell. |
int |
readTableFunction(TableFunction tableFunction,
int sheetIndex,
int rowIndex,
int columnIndex,
int length)
Reads the table function from the sheet starting at the row with index
rowIndex :- arguments are read from column at columnIndex - values are read from column at columnIndex + 1 If there is not enough data in the sheet to fill in the length , then table function gets less points. |
int |
readTableFunction(TableFunction tableFunction,
java.lang.String cellName,
int length)
Reads the table function from the sheet starting at the row of the given
cell:
- arguments are read from column of the given cell - values are read from column next to the given cell If there is not enough data in the sheet to fill in the length , then table function gets less points. |
int |
readTableFunction(TableFunction tableFunction,
java.lang.String sheetName,
int rowIndex,
int columnIndex,
int length)
Reads the table function from the sheet starting at the row with index
rowIndex :- arguments are read from column at columnIndex - values are read from column at columnIndex + 1 If there is not enough data in the sheet to fill in the length , then table function gets less points. |
void |
setCellFormula(java.lang.String formula,
int sheetIndex,
int rowIndex,
int columnIndex)
Sets formula for this cell.
|
void |
setCellFormula(java.lang.String formula,
java.lang.String cellName)
Sets formula for this cell.
|
void |
setCellFormula(java.lang.String formula,
java.lang.String sheetName,
int rowIndex,
int columnIndex)
Sets formula for this cell.
|
void |
setCellValue(boolean value,
int sheetIndex,
int rowIndex,
int columnIndex)
Sets a boolean value for the cell.
|
void |
setCellValue(boolean value,
java.lang.String cellName)
Sets a boolean value for the cell.
|
void |
setCellValue(boolean value,
java.lang.String sheetName,
int rowIndex,
int columnIndex)
Sets a boolean value for the cell.
|
void |
setCellValue(java.util.Date value,
int sheetIndex,
int rowIndex,
int columnIndex)
Sets a date value for the cell.
|
void |
setCellValue(java.util.Date value,
java.lang.String cellName)
Sets a date value for the cell.
|
void |
setCellValue(java.util.Date value,
java.lang.String sheetName,
int rowIndex,
int columnIndex)
Sets a date value for the cell.
|
void |
setCellValue(double value,
int sheetIndex,
int rowIndex,
int columnIndex)
Sets a numeric value for the cell.
|
void |
setCellValue(double value,
java.lang.String cellName)
Sets a numeric value for the cell.
|
void |
setCellValue(double value,
java.lang.String sheetName,
int rowIndex,
int columnIndex)
Sets a numeric value for the cell.
|
void |
setCellValue(java.lang.String value,
int sheetIndex,
int rowIndex,
int columnIndex)
Sets a string value for the cell.
|
void |
setCellValue(java.lang.String value,
java.lang.String cellName)
Sets a string value for the cell.
|
void |
setCellValue(java.lang.String value,
java.lang.String sheetName,
int rowIndex,
int columnIndex)
Sets a string value for the cell.
|
void |
setChanged()
This method may be used to tell AnyLogic that this workbook has unsaved
changes and should be written on
writeFile() or included to the
model snapshot if it has such
setting. |
void |
setFileName(java.lang.String fileName)
Switches this object to work with another file.
|
java.lang.String |
toString() |
int |
writeDataSet(DataSet dataSet,
int sheetIndex,
int rowIndex,
int columnIndex)
Writes the given data set to the sheet starting at the given cell.
|
int |
writeDataSet(DataSet dataSet,
java.lang.String cellName)
Writes the given data set to the sheet starting at the given cell.
|
int |
writeDataSet(DataSet dataSet,
java.lang.String sheetName,
int rowIndex,
int columnIndex)
Writes the given data set to the sheet starting at the given cell.
|
void |
writeFile()
Stores the current workbook to the file.
|
void |
writeFile(boolean force)
Stores the current workbook to the file.
|
public static final int CELL_TYPE_BLANK
public static final int CELL_TYPE_BOOLEAN
public static final int CELL_TYPE_ERROR
public static final int CELL_TYPE_FORMULA
public static final int CELL_TYPE_NUMERIC
public static final int CELL_TYPE_STRING
@Deprecated public ExcelFile(java.lang.String fileName, boolean saveToSnapshot)
public ExcelFile(Presentable owner, java.lang.String packagePrefix, java.lang.String fileName, boolean saveToSnapshot)
owner
- the presentable object owning this shapepackagePrefix
- the package name of original agent where this image is
defined, formatted using '/' characters; with '/' character at
the beginning and at the endfileName
- the name of the filesaveToSnapshot
- true
: Store all unsaved data (in any) in the
workbook to the model snapshot filefalse
: When snapshot is loaded, this class
reads the original ExcelTM
file. If the file wasn't initially loaded, it isn't
loaded during restoring from snapshot.
public void setFileName(java.lang.String fileName)
readFile()
.fileName
- the new file namepublic void readFile()
writeFile()
public boolean isLoaded()
true
if workbook is loaded from file.true
if workbook is loaded from filereadFile()
public void close()
readFile()
public int getCellType(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedCELL_TYPE_*
constantspublic int getCellType(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedCELL_TYPE_*
constantspublic boolean getCellBooleanValue(int sheetIndex, int rowIndex, int columnIndex)
boolean
.false
.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedboolean
public double getCellNumericValue(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic java.lang.String getCellStringValue(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic java.lang.String getCellFormula(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic byte getCellErrorValue(int sheetIndex, int rowIndex, int columnIndex)
0
.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic java.util.Date getCellDateValue(int sheetIndex, int rowIndex, int columnIndex)
null
. See
org.apache.poi.ss.usermodel.DataFormatter
class for
formatting this date into a string similar to how excel does.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedDate
public org.apache.poi.ss.usermodel.Workbook getWorkbook()
null
if file isn't
not loaded.setChanged()
null
if file isn't
not loadedpublic boolean getCellBooleanValue(java.lang.String sheetName, int rowIndex, int columnIndex)
boolean
.false
.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedboolean
public double getCellNumericValue(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic java.lang.String getCellStringValue(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic java.lang.String getCellFormula(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic byte getCellErrorValue(java.lang.String sheetName, int rowIndex, int columnIndex)
0
.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic java.util.Date getCellDateValue(java.lang.String sheetName, int rowIndex, int columnIndex)
null
. See
org.apache.poi.ss.usermodel.DataFormatter
class for
formatting this date into a string similar to how excel does.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedDate
public int getCellType(java.lang.String cellName)
cellName
- the full name of the cellCELL_TYPE_*
constantspublic boolean getCellBooleanValue(java.lang.String cellName)
boolean
.false
.cellName
- the full name of the cellboolean
public double getCellNumericValue(java.lang.String cellName)
cellName
- the full name of the cellpublic java.lang.String getCellStringValue(java.lang.String cellName)
cellName
- the full name of the cellpublic java.lang.String getCellFormula(java.lang.String cellName)
cellName
- the full name of the cellpublic byte getCellErrorValue(java.lang.String cellName)
0
.cellName
- the full name of the cellpublic java.util.Date getCellDateValue(java.lang.String cellName)
null
. See
org.apache.poi.ss.usermodel.DataFormatter
class for
formatting this date into a string similar to how excel does.cellName
- the full name of the cellDate
public int getNumberOfSheets()
public int getLastRowNum(int sheetIndex)
org.apache.poi.ss.usermodel.Sheet.getPhysicalNumberOfRows()
to find out if there is a row at position zero or not.sheetIndex
- the index of the spreadsheet, 1-basedpublic int getLastRowNum(java.lang.String sheetName)
org.apache.poi.ss.usermodel.Sheet.getPhysicalNumberOfRows()
to find out if there is a row at position zero or not.sheetName
- the name of the sheetpublic int getFirstRowNum(int sheetIndex)
sheetIndex
- the index of the spreadsheet, 1-basedpublic int getFirstRowNum(java.lang.String sheetName)
sheetName
- the name of the sheetpublic int getFirstCellNum(int sheetIndex, int rowIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedpublic int getFirstCellNum(java.lang.String sheetName, int rowIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedpublic int getLastCellNum(int sheetIndex, int rowIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedpublic int getLastCellNum(java.lang.String sheetName, int rowIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedpublic boolean cellExists(int sheetIndex, int rowIndex, int columnIndex)
true
if the cell at the given position exists in the
workbooksheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedtrue
if the cell at the given position exists in the
workbook, false
otherwisepublic boolean cellExists(java.lang.String sheetName, int rowIndex, int columnIndex)
true
if the cell at the given position exists in the
workbooksheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedtrue
if the cell at the given position exists in the
workbook, false
otherwisepublic boolean cellExists(java.lang.String cellName)
true
if the cell at the given position exists in the
workbookcellName
- the full name of the celltrue
if the cell at the given position exists in the
workbook, false
otherwisepublic void clearCell(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic int readTableFunction(TableFunction tableFunction, int sheetIndex, int rowIndex, int columnIndex, int length)
rowIndex
:columnIndex
columnIndex + 1
length
, then table function gets less points.tableFunction
- the table function to fillsheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedlength
- the number of table function points to readpublic int readTableFunction(TableFunction tableFunction, java.lang.String sheetName, int rowIndex, int columnIndex, int length)
rowIndex
:columnIndex
columnIndex + 1
length
, then table function gets less points.tableFunction
- the table function to fillsheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedlength
- the number of table function points to readpublic int readTableFunction(TableFunction tableFunction, java.lang.String cellName, int length)
length
, then table function gets less points.tableFunction
- the table function to fillcellName
- the full name of the celllength
- the number of table function points to readpublic int getCellFormulaType(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedCELL_TYPE_NUMERIC
, CELL_TYPE_STRING
,
CELL_TYPE_BOOLEAN
, CELL_TYPE_ERROR
) depending
on the cached value of the formulapublic int getCellFormulaType(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedCELL_TYPE_NUMERIC
, CELL_TYPE_STRING
,
CELL_TYPE_BOOLEAN
, CELL_TYPE_ERROR
) depending
on the cached value of the formulapublic int getCellFormulaType(java.lang.String cellName)
cellName
- the full name of the cellCELL_TYPE_NUMERIC
, CELL_TYPE_STRING
,
CELL_TYPE_BOOLEAN
, CELL_TYPE_ERROR
) depending
on the cached value of the formulapublic java.lang.String getSheetName(int sheetIndex)
sheetIndex
- the index of the spreadsheet, 1-basedpublic int getSheetIndex(java.lang.String sheetName)
1
if sheetName
is
null
sheetName
- the sheet namepublic void readHyperArray(HyperArray array, int sheetIndex, int rowIndex, int columnIndex, boolean dim1AcrossRows)
HyperArray
data from the sheet
starting at the given cell.array
- the HyperArray
to write data to, should have 1 or 2
dimensions.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-baseddim1AcrossRows
- use true
to read the data corresponding to the
first dimension, across the sheet rows (e.g. in this mode data
for one-dimensional array is loaded from the sheet column)public void readHyperArray(HyperArray array, java.lang.String sheetName, int rowIndex, int columnIndex, boolean dim1AcrossRows)
HyperArray
data from the sheet
starting at the given cell.array
- the HyperArray
to write data to, should have 1 or 2
dimensions.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-baseddim1AcrossRows
- use true
to read the data corresponding to the
first dimension, across the sheet rows (e.g. in this mode data
for one-dimensional array is loaded from the sheet column)public void readHyperArray(HyperArray array, java.lang.String cellName, boolean dim1AcrossRows)
HyperArray
data from the sheet
starting at the given cell.array
- the HyperArray
to write data to, should have 1 or 2
dimensions.cellName
- the full name of the celldim1AcrossRows
- use true
to read the data corresponding to the
first dimension, across the sheet rows (e.g. in this mode data
for one-dimensional array is loaded from the sheet column)public void writeFile()
setFileName(String)
before this method.writeFile(boolean)
,
readFile()
,
setFileName(String)
public void writeFile(boolean force)
setFileName(String)
before this method.force
- if true
the workbook will be saved to the file
even if it is unchangedwriteFile()
,
readFile()
,
setFileName(String)
,
setChanged()
public void setChanged()
writeFile()
or included to the
model snapshot if it has such
setting.getWorkbook()
.setCell*()
etc. methods automatically mark workbook as
'changed'writeFile()
,
getWorkbook()
public void createCell(int sheetIndex, int rowIndex, int columnIndex)
sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void createCell(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void createCell(java.lang.String cellName)
cellName
- the full name of the cellpublic void setCellValue(boolean value, int sheetIndex, int rowIndex, int columnIndex)
value
- the boolean value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
boolean are changed to boolean cells.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(double value, int sheetIndex, int rowIndex, int columnIndex)
value
- the numeric value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
numeric are changed to numeric cells.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(java.lang.String value, int sheetIndex, int rowIndex, int columnIndex)
value
- the value to set this cell to. For formula cells the formula
string is set. Cells with types other than string are changed
to string cells. If value is null
then cell is
changed to a Blank cell.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(java.util.Date value, int sheetIndex, int rowIndex, int columnIndex)
value
- the date value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
numeric are changed to numeric cells.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellFormula(java.lang.String formula, int sheetIndex, int rowIndex, int columnIndex)
setCellValue(...)
methodformula
- the formula to set, e.g. "SUM(C4:E4)"
. If this
argument is null
then the current formula is
removed.sheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(boolean value, java.lang.String sheetName, int rowIndex, int columnIndex)
value
- the boolean value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
boolean are changed to boolean cells.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(double value, java.lang.String sheetName, int rowIndex, int columnIndex)
value
- the numeric value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
numeric are changed to numeric cells.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(java.lang.String value, java.lang.String sheetName, int rowIndex, int columnIndex)
value
- the value to set this cell to. For formula cells the formula
string is set. Cells with types other than string are changed
to string cells. If value is null
then cell is
changed to a Blank cell.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(java.util.Date value, java.lang.String sheetName, int rowIndex, int columnIndex)
value
- the date value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
numeric are changed to numeric cells.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellFormula(java.lang.String formula, java.lang.String sheetName, int rowIndex, int columnIndex)
setCellValue(...)
methodformula
- the formula to set, e.g. "SUM(C4:E4)"
. If this
argument is null
then the current formula is
removed.sheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic void setCellValue(boolean value, java.lang.String cellName)
value
- the boolean value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
boolean are changed to boolean cells.cellName
- the full name of the cellpublic void setCellValue(double value, java.lang.String cellName)
value
- the numeric value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
numeric are changed to numeric cells.cellName
- the full name of the cellpublic void setCellValue(java.lang.String value, java.lang.String cellName)
value
- the value to set this cell to. For formula cells the formula
string is set. Cells with types other than string are changed
to string cells. If value is null
then cell is
changed to a Blank cell.cellName
- the full name of the cellpublic void setCellValue(java.util.Date value, java.lang.String cellName)
value
- the date value to set this cell to. For formula cells the
'precalculated' value is set. Cells with types other than
numeric are changed to numeric cells.cellName
- the full name of the cellpublic void setCellFormula(java.lang.String formula, java.lang.String cellName)
setCellValue(...)
methodformula
- the formula to set, e.g. "SUM(C4:E4)"
. If this
argument is null
then the current formula is
removed.cellName
- the full name of the cellpublic java.lang.String toString()
toString
in class java.lang.Object
public int writeDataSet(DataSet dataSet, int sheetIndex, int rowIndex, int columnIndex)
X
and Y
components.dataSet
- the data set to store in the sheetsheetIndex
- the index of the spreadsheet, 1-basedrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic int writeDataSet(DataSet dataSet, java.lang.String sheetName, int rowIndex, int columnIndex)
X
and Y
components.dataSet
- the data set to store in the sheetsheetName
- the name of the sheetrowIndex
- the index of the cell row, 1-basedcolumnIndex
- the index of the cell column, 1-basedpublic int writeDataSet(DataSet dataSet, java.lang.String cellName)
X
and Y
components.dataSet
- the data set to store in the sheetcellName
- the full name of the cellpublic void evaluateFormulas()
org.apache.poi.ss.usermodel.Cell.evaluateInCell(org.apache.poi.ss.usermodel.Cell)
Copyright © AnyLogic North America, LLC. All Rights Reserved.