public class WorkSheetHandle extends Object implements Handle
WorkBookHandle book = new WorkBookHandle("testxls.xls");
WorkSheetHandle sheet1 = book.getWorkSheet("Sheet1");
CellHandle cell = sheet1.getCell("B22");
to add a cell:
CellHandle cell = sheet1.add("Hello World","C22");
to add a numeric cell:
CellHandle cell = sheet1.add(Integer.valueOf(120),"C23");
to add a formula cell:
CellHandle cell = sheet1.add("=PI()","C24");
WorkSheet,
WorkBookHandle,
CellHandle| Modifier and Type | Field and Description |
|---|---|
static short |
ALLOWAUTOFILTER
enhanced protection settings: Use Autofilter
|
static short |
ALLOWDELETECOLUMNS
enhanced protection settings: Delete columns
|
static short |
ALLOWDELETEROWS
enhanced protection settings: Delete rows
|
static short |
ALLOWFORMATCELLS
enhanced protection settings: Format cells
|
static short |
ALLOWFORMATCOLUMNS
enhanced protection settings: Format columns
|
static short |
ALLOWFORMATROWS
enhanced protection settings: Format rows
|
static short |
ALLOWINSERTCOLUMNS
enhanced protection settings: Insert columns
|
static short |
ALLOWINSERTHYPERLINKS
enhanced protection settings: Insert hyperlinks
|
static short |
ALLOWINSERTROWS
enhanced protection settings: Insert rows
|
static short |
ALLOWOBJECTS
enhanced protection settings: Edit Object
|
static short |
ALLOWPIVOTTABLES
enhanced protection settings: Use PivotTable reports
|
static short |
ALLOWSCENARIOS
enhanced protection settings: Edit scenario
|
static short |
ALLOWSELLOCKEDCELLS
enhanced protection settings: Select locked cells
|
static short |
ALLOWSELUNLOCKEDCELLS
enhanced protection settings: Select unlocked cells
|
static short |
ALLOWSORT
enhanced protection settings: Sort
|
static int |
ROW_DELETE |
static int |
ROW_DELETE_NO_REFERENCE_UPDATE |
static int |
ROW_INSERT
Excel standard row insertion behavior
|
static int |
ROW_INSERT_MULTI
Insert row multiple times allowed, also copies formulas to inserted row
|
static int |
ROW_INSERT_NO_REFERENCE_UPDATE
Insert row but do not update any cell references affected by insert
|
static int |
ROW_INSERT_ONCE
Insert row one time, multiple calls ignored
|
| Modifier | Constructor and Description |
|---|---|
protected |
WorkSheetHandle(Boundsheet sht,
WorkBookHandle b)
Constructor which takes a WorkBook and sheetname as parameters.
|
| Modifier and Type | Method and Description |
|---|---|
CellHandle |
add(Date dt,
int row,
int col,
String fmt)
Add a java.sql.Date Cell to a WorkSheet.
|
CellHandle |
add(Date dt,
String address,
String fmt)
Add a java.sql.Date Cell to a WorkSheet.
|
CellHandle |
add(Object obj,
int row,
int col)
Add a Cell with the specified value to a WorkSheet.
|
CellHandle |
add(Object obj,
int row,
int col,
int formatId)
Add a Cell with the specified value to a WorkSheet.
|
CellHandle |
add(Object obj,
String address)
Add a Cell with the specified value to a WorkSheet.
|
CellHandle |
add(Object obj,
String address,
boolean autoDetectValue)
Add a Cell with the specified value to a WorkSheet, optionally attempting to
convert numeric values to appropriate number cells with appropriate number
formatting applied.
|
CellHandle |
add(Timestamp dt,
String address,
String fmt)
Add a java.sql.Timestamp Cell to a WorkSheet.
|
AutoFilterHandle |
addAutoFilter(int column)
Adds a new AutoFilter for the specified column (0-based) in this sheet
returns a handle to the new AutoFilter |
void |
addChart(byte[] serialchart,
String name,
short[] coords) |
ColHandle |
addCol(int colNum)
adds the column (col1st, colLast) and returns the new ColHandle
|
ColHandle |
addCol(int c1st,
int clast)
Deprecated.
use addCol(int)
|
CellHandle[] |
addValidated(Date dt,
int row,
int col,
String fmt)
Add a java.sql.Date Cell to a WorkSheet.
|
CellHandle[] |
addValidated(Date dt,
String address,
String fmt)
Add a java.sql.Date Cell to a WorkSheet.
|
CellHandle[] |
addValidated(Object obj,
int row,
int col)
Add a Cell with the specified value to a WorkSheet.
|
CellHandle[] |
addValidated(Object obj,
int row,
int col,
int formatId)
Add a Cell with the specified value to a WorkSheet.
|
CellHandle[] |
addValidated(Object obj,
String address)
Add a Cell with the specified value to a WorkSheet.
|
CellHandle[] |
addValidated(Timestamp dt,
String address,
String fmt)
Add a java.sql.Timestamp Cell to a WorkSheet.
|
List<?> |
calculateAffectedCells(String CellAddress)
Calculates all formulas that reference the cell address passed in.
|
boolean |
checkProtectionPassword(String guess)
Checks whether the given password matches the protection password.
|
void |
clearCols(int first,
int count)
Removes columns and all their associated cells from the sheet.
|
void |
close()
clear out object references in prep for closing workbook
|
ConditionalFormatHandle |
createConditionalFormatHandle(String cellAddress,
String operator,
String value1,
String value2,
String format,
String firstCondition,
String secondCondition)
Create a Conditional Format handle for a cell/range
|
CommentHandle |
createNote(String address,
String txt,
String author)
Creates a new annotation (Note or Comment) to the worksheeet, attached to a
specific cell
|
CommentHandle |
createNote(String address,
Unicodestring txt,
String author)
Creates a new annotation (Note or Comment) to the worksheeet, attached to a
specific cell
The note or comment is a Unicode string, thus it can contain formatting information |
PivotTableHandle |
createPivotTable(String name,
String range,
int sId)
creates a new, blank PivotTable and adds it to the worksheet.
|
ValidationHandle |
createValidationHandle(String cellAddress,
byte valueType,
byte condition,
String errorBoxText,
String errorBoxTitle,
String promptBoxText,
String promptBoxTitle,
String firstCondition,
String secondCondition)
Create a validation handle for a cell/range
|
void |
evaluateAutoFilters()
Updates the Row filter (hidden status) for each row on the sheet by
evaluating all AutoFilter conditions
|
void |
extractChartToDirectory(String outdir)
retrieves all charts for this sheet and writes them (in SVG form) to outpdir
Filename is in form of: |
void |
extractImagesToDirectory(String outdir)
write out all of the images in the Sheet to a directory
|
void |
fastAdd(Object obj,
int row,
int col,
int formatId)
Fast-adds a Cell with the specified value to a WorkSheet.
|
void |
freezeCol(int col)
freezes the cols starting at the specified column and creating a scrollable
sheet to the right
|
void |
freezeRow(int row)
freezes the rows starting at the specified row and creating a scrollable
sheet below this row
|
CompatibleVector |
getAddedrows() |
ValidationHandle[] |
getAllValidationHandles()
Return all validation handles that refer to this worksheet
|
AutoFilterHandle[] |
getAutoFilterHandles()
Returns a list of all AutoFilterHandles on this sheet
An AutoFilterHandle allows access and manipulation of AutoFilters on the sheet |
protected Boundsheet |
getBoundsheet() |
CellHandle |
getCell(int row,
int col)
Returns a CellHandle for working with the value of a Cell on a WorkSheet.
|
CellHandle |
getCell(int row,
int col,
boolean cache)
Returns a CellHandle for working with the value of a Cell on a WorkSheet.
|
CellHandle |
getCell(String addr)
Returns a CellHandle for working with the value of a Cell on a WorkSheet.
|
CellRange |
getCellRange(String rangeName)
Create a CellRange object from an OpenXLS string range passed in such as
"A1:F6"
|
CellHandle[] |
getCells()
Returns all CellHandles defined on this WorkSheet.
|
ColHandle |
getCol(int clnum)
returns the ColHandle for the column at index position the column index is
zero based ie: column A = 0
|
ColHandle |
getCol(String name)
returns the Column at the named position
|
List<?> |
getColNames()
returns a List of Column names
|
ColHandle[] |
getColumns()
returns all of the Columns in this WorkSheet
|
CommentHandle[] |
getCommentHandles()
returns an array of all CommentHandles that exist in the sheet
|
ConditionalFormatHandle[] |
getConditionalFormatHandles()
returns an array of FormatHandles for the ConditionalFormats applied to this
cell
|
int |
getDefaultColWidth() |
boolean |
getEnhancedProtection(int protectionOption)
returns true if the indicated Enhanced Protection Setting is turned on
|
boolean |
getFastCellAdds()
Get the current fast add cell mode for this worksheet
|
int |
getFirstCol()
Get the first column on the Worksheet
|
int |
getFirstRow()
Get the first row on the Worksheet
|
String |
getFooterText()
Get the text for the Footer printed at the bottom of the Worksheet
|
FormulaHandle |
getFormula(String addr)
Returns a FormulaHandle for working with the ranges of a formula on a
WorkSheet.
|
String |
getHashedProtectionPassword()
Gets the hash of the sheet protection password.
|
String |
getHeaderText()
Get the text for the Header printed at the top of the Worksheet
|
boolean |
getHidden()
get whether this sheet is hidden from the user opening the file.
|
ImageHandle |
getImage(String name)
Get a handle to all of the images in this worksheet
|
ImageHandle[] |
getImages()
Get a handle to all of the images in this worksheet
|
int |
getLastCol()
Get the last column on the Worksheet
|
int |
getLastRow()
Get the last row on the Worksheet
|
boolean |
getManualGridLineColor()
Get whether to use manual grid color in the output sheet.
|
Boundsheet |
getMysheet()
FOR internal Use Only!
|
NameHandle |
getNamedRangeInScope(String rangename)
Returns a Named Range Handle if it exists in the specified scope.
|
NameHandle[] |
getNamedRangesInScope()
Returns all Named Range Handles scoped to this Worksheet.
|
int |
getNumCols()
Returns the number of Columns in this WorkSheet
|
int |
getNumImages()
returns the actual amount of images contained in the sheet and is determined
by imageMap
|
int |
getNumRows()
Returns the number of rows in this WorkSheet
|
String |
getPrintArea()
Get the print area set for this WorkSheetHandle.
|
PrinterSettingsHandle |
getPrinterSettings()
Get the printer settings handle for this WorkSheetHandle.
|
String |
getPrintTitles()
Get the Print Titles set for this WorkSheetHandle.
|
boolean |
getProtected()
Returns whether the sheet is protected.
|
String |
getQualifiedSheetName()
return the sheetname properly qualified or quoted used when the sheetname
contains spaces, commas or parentheses
|
RowHandle |
getRow(int t)
returns the RowHandle for the row at index position
the row index is zero based ie: Excel row 1 = 0
|
Map |
getRowMap()
get an array of BIFFREC Rows
|
List<?> |
getRowNums()
returns a List of Row numbers
|
RowHandle[] |
getRows()
get an array of all RowHandles for this WorkSheet
|
boolean |
getSelected()
get whether this sheet is selected upon opening the file.
|
byte[] |
getSerialBytes()
Returns the Serialized bytes for this WorkSheet.
|
protected Boundsheet |
getSheet()
Returns the underlying low-level Boundsheet object.
|
String |
getSheetName()
Returns the name of the Sheet.
|
int |
getSheetNum()
Returns the index of the Sheet.
|
boolean |
getShowFormulaResults()
Set whether to show calculated formula results in the output sheet.
|
boolean |
getShowGridlines()
Get whether to show gridlines in the output sheet.
|
boolean |
getShowInNormalView()
Get whether to show normal view or page break preview view in the output
sheet.
|
boolean |
getShowOutlineSymbols()
Get whether to show outline symbols in the output sheet.
|
boolean |
getShowSheetHeaders()
Get whether to show sheet headers in the output sheet.
|
boolean |
getShowZeroValues()
Get whether to show zero values in the output sheet.
|
int |
getSplitColLocation()
gets the column number (0-based)that the sheet split is locaated on; if the
sheet is not split, returns -1
|
int |
getSplitLocation()
Gets the twips split location returns -1
|
int |
getSplitRowLocation()
Gets the row number (0 based) that the sheet split is located on.
|
int |
getTabIndex()
get the tab display order of this Worksheet
this is a zero based index with zero representing the left-most WorkSheet
tab.
|
String |
getTopLeftCell()
if this sheet has freeze panes, return the address of the top left cell
otherwise, return null
|
boolean |
getUseCache() |
Object |
getVal(String address)
Get the Object value of a Cell.
|
ValidationHandle |
getValidationHandle(String cellAddress)
Get a validation handle for the cell address passed in.
|
boolean |
getVeryHidden()
return the 'veryhidden' state of the sheet
|
WorkBookHandle |
getWorkBook()
Returns the WorkBookHandle for this Sheet
|
float |
getZoom()
gets the zoom for the sheet
|
boolean |
hasDataValidations()
return true if sheet contains data validations
|
boolean |
hasFrozenPanes()
Get whether there are freeze panes in the output sheet.
|
void |
insertCol(int colnum)
Deprecated.
Use
insertCols(int, int) instead. |
void |
insertCol(String colnum)
Deprecated.
Use
insertCols(int, int) instead. |
void |
insertCols(int first,
int count)
Inserts empty columns and shifts the following columns to the right.
|
void |
insertImage(ImageHandle im)
insert an image into this worksheet
|
boolean |
insertRow(int rownum)
Insert a blank row into the worksheet.
|
boolean |
insertRow(int rownum,
boolean shiftrows)
Insert a blank row into the worksheet.
|
void |
insertRow(int rownum,
int flag)
Insert a blank row into the worksheet.
|
CellHandle[] |
insertRow(int row1,
Object[] data)
Insert a row of Objects into the worksheet.
|
CellHandle[] |
insertRow(int rownum,
Object[] data,
boolean shiftrows)
Insert a row of Objects into the worksheet.
|
boolean |
insertRow(int rownum,
RowHandle copyRow,
int flag,
boolean shiftrows)
Insert a blank row into the worksheet.
|
boolean |
insertRowAt(int rownum,
boolean shiftrows)
Insert a blank row into the worksheet.
|
void |
moveCell(CellHandle c,
String addr)
Move a cell on this WorkSheet.
|
void |
readCSV(BufferedReader input)
Imports the given CSV data into this worksheet.
|
void |
remove()
Remove this WorkSheet from the WorkBook
NOTE: will throw a WorkBookException if the last sheet is removed.
|
void |
removeAutoFilters()
Removes all AutoFilters from this sheet
As a consequence, all previously hidden rows are shown or unhidden |
void |
removeCell(CellHandle celldel)
Remove a Cell from this WorkSheet.
|
void |
removeCell(String celladdr)
Remove a Cell from this WorkSheet.
|
void |
removeCol(String colstr)
Deprecated.
Use
clearCols(int, int) instead. |
void |
removeCol(String colstr,
boolean shiftcols)
Deprecated.
Use
removeCols(int, int) or clearCols(int, int) instead. |
void |
removeCols(int first,
int count)
Removes columns from the sheet and shifts the following columns left.
|
void |
removeImage(ImageHandle img)
removes an Image from the Spreadsheet
Jan 22, 2010
|
void |
removeRow(int rownum)
Remove a Row and all associated Cells from this WorkSheet.
|
void |
removeRow(int rownum,
boolean shiftrows)
Remove a Row and all associated Cells from this WorkSheet.
|
void |
removeRow(int rownum,
int flag)
Remove a Row and all associated Cells from this WorkSheet.
|
void |
removeRowContents(int rownum)
Remove all cells and formatting from a row within this WorkSheet.
|
void |
setCopyFormatsFromPriorWhenAdding(boolean f)
When adding a new Cell to the sheet, OpenXLS can automatically copy the
formatting from the Cell directly above the inserted Cell.
|
void |
setDefaultColWidth(int t)
Set the default column width of the worksheet
This setting is roughly the width of the character '0' The default width of a column is 8. |
void |
setEnhancedProtection(int protectionOption,
boolean set)
Sets the worksheet enhanced protection option
|
void |
setFastCellAdds(boolean fastadds)
Toggle fast cell add mode.
|
void |
setFirstVisibleTab()
set this WorkSheet as the first visible tab on the left
|
void |
setFooterText(String t)
Set the text for the Footer printed at the bottom of the Worksheet
|
void |
setHasFrozenPanes(boolean b)
Set whether there are freeze panes in the output sheet.
|
void |
setHeaderText(String t)
Set the text for the Header printed at the top of the Worksheet
|
void |
setHidden(boolean b)
set whether this sheet is hidden from the user opening the file.
|
void |
setManualGridLineColor(boolean b)
Set whether to use manual grid color in the output sheet.
|
void |
setPrintArea(CellRange printarea)
Sets the print area for the worksheet
sets the printarea as a CellRange
|
void |
setProtected(boolean protect)
Sets whether the worksheet is protected.
|
void |
setProtected(boolean protect,
String password)
Sets whether the worksheet is protected.
|
void |
setProtectionPassword(String password)
Sets the password used to unlock the sheet when it is protected.
|
void |
setProtectionPasswordHashed(String hash)
Sets the password used to unlock the sheet when it is protected.
|
void |
setSelected(boolean b)
set whether this sheet is selected upon opening the file.
|
void |
setSheetName(String name)
Set the name of the Worksheet.
|
void |
setShowFormulaResults(boolean b) |
void |
setShowGridlines(boolean b)
Set whether to show gridlines in the output sheet.
|
void |
setShowInNormalView(boolean b)
Set whether to show normal view or page break preview view in the output
sheet.
|
void |
setShowOutlineSymbols(boolean b)
Set whether to show outline symbols in the output sheet.
|
void |
setShowSheetHeaders(boolean b)
Set whether to show sheet headers in the output sheet.
|
void |
setShowZeroValues(boolean b)
Set whether to show zero values in the output sheet.
|
void |
setTabIndex(int idx)
set the tab display order of this Worksheet
this is a zero based index with zero representing the left-most WorkSheet
tab.
|
void |
setVal(String address,
double d)
Set the double value of the Cell at the given address
|
void |
setVal(String address,
int i)
Set the int value of the Cell at the given address
|
void |
setVal(String address,
Object val)
Set the Object value of the Cell at the given address.
|
void |
setVal(String address,
String s)
Set the String value of the Cell at the given address
|
void |
setVeryHidden(boolean b)
set whether this sheet is VERY hidden opening the file.
|
void |
setZoom(float zm)
sets the zoom for the sheet
|
void |
splitCol(int col,
int splitpos)
splits the worksheet at column col for nCols
Note: unfreezes panes if frozen
|
void |
splitRow(int row,
int splitpos)
splits the worksheet at row for nRows
Note: unfreezes panes if frozen
|
String |
toString()
Returns the name of this Sheet.
|
void |
writeAsTabbedText(OutputStream dest)
write this sheet as tabbed text output:
All rows and all characters in each cell are saved. |
public static final int ROW_INSERT_MULTI
public static final int ROW_INSERT
public static final int ROW_INSERT_ONCE
public static final int ROW_INSERT_NO_REFERENCE_UPDATE
public static final int ROW_DELETE
public static final int ROW_DELETE_NO_REFERENCE_UPDATE
public static final short ALLOWOBJECTS
public static final short ALLOWSCENARIOS
public static final short ALLOWFORMATCELLS
public static final short ALLOWFORMATCOLUMNS
public static final short ALLOWFORMATROWS
public static final short ALLOWINSERTCOLUMNS
public static final short ALLOWINSERTROWS
public static final short ALLOWINSERTHYPERLINKS
public static final short ALLOWDELETECOLUMNS
public static final short ALLOWDELETEROWS
public static final short ALLOWSELLOCKEDCELLS
public static final short ALLOWSORT
public static final short ALLOWAUTOFILTER
public static final short ALLOWPIVOTTABLES
public static final short ALLOWSELUNLOCKEDCELLS
protected WorkSheetHandle(Boundsheet sht, WorkBookHandle b)
sht - The name of the WorkSheetmybk - The WorkBookpublic void addChart(byte[] serialchart,
String name,
short[] coords)
public int getFirstRow()
public int getFirstCol()
public int getLastRow()
public int getLastCol()
public void setProtected(boolean protect,
String password)
throws WorkBookException
protect is
true, the worksheet will be protected and the password will be
set to password. If it's false, the worksheet will
be unprotected and the password will be removed.protect - whether the worksheet should be protectedpassword - the password to set if protect is true. ignored when
protect is false.WorkBookException - never. This used to be thrown when unprotecting if the password
was incorrect.public void setProtected(boolean protect)
protect - whether worksheet protection should be enabledpublic void setProtectionPassword(String password)
password - the clear text of the password to be applied or null to remove the
existing passwordpublic void setProtectionPasswordHashed(String hash)
getHashedProtectionPassword() to copy
the password from one worksheet to another.hash - the hash of the protection password to be applied or null to
remove the existing passwordpublic String getHashedProtectionPassword()
setProtectionPasswordHashed(java.lang.String) to apply the same
password to another worksheet.public boolean getProtected()
public boolean checkProtectionPassword(String guess)
guess - the password to be checked against the stored hashpublic void setEnhancedProtection(int protectionOption,
boolean set)
int - protectionOptionoptionspublic boolean getEnhancedProtection(int protectionOption)
protectionOption - optionspublic void setVeryHidden(boolean b)
boolean - b hidden statepublic boolean getSelected()
public boolean getHidden()
public boolean getVeryHidden()
public void setHidden(boolean b)
boolean - b hidden statepublic void setFirstVisibleTab()
public int getTabIndex()
public void setTabIndex(int idx)
int - idx the new index of the sheet tabpublic void setSelected(boolean b)
boolean - b selected valuepublic ColHandle getCol(int clnum) throws ColumnNotFoundException
ColumnNotFoundException@Deprecated public ColHandle addCol(int c1st, int clast)
c1st - clast - public ColHandle addCol(int colNum)
colNum, - zero based number of the columnpublic ColHandle getCol(String name) throws ColumnNotFoundException
ColumnNotFoundExceptionpublic ColHandle[] getColumns()
public List<?> getColNames()
public List<?> getRowNums()
public RowHandle getRow(int t) throws RowNotFoundException
int - row number to returnRowNotFoundExceptionpublic RowHandle[] getRows()
public Map getRowMap()
public int getNumRows()
public int getNumCols()
public void removeCell(CellHandle celldel)
CellHandle - to removepublic void removeImage(ImageHandle img)
img - public void removeCell(String celladdr)
String - celladdr - the Address of the Cell to removepublic void removeRow(int rownum,
boolean shiftrows)
throws RowNotFoundException
int - rownum - the number of the row to removeboolean - shiftrows - true will shift all lower rows up one.RowNotFoundExceptionpublic void removeRow(int rownum)
throws RowNotFoundException
int - rownum - the number of the row to remove uses default row deletion
rules regarding updating referencesRowNotFoundExceptionpublic void removeRowContents(int rownum)
throws RowNotFoundException
int - rownum - the number of the row contents to removeRowNotFoundExceptionpublic void removeRow(int rownum,
int flag)
throws RowNotFoundException
int - rownum - the number of the row to removeint - flag - controls whether row deletions updates references as well
...RowNotFoundExceptionpublic void clearCols(int first,
int count)
removeCols(int, int).first - the zero-based index of the first column to be removedcount - the number of columns to remove.public void removeCols(int first,
int count)
first - the zero-based index of the first column to be removedcount - the number of columns to remove.@Deprecated public void removeCol(String colstr) throws ColumnNotFoundException
clearCols(int, int) instead.colstr - the name of the column to removeColumnNotFoundException@Deprecated public void removeCol(String colstr, boolean shiftcols) throws ColumnNotFoundException
removeCols(int, int) or clearCols(int, int) instead.colstr - the name of the column to removeshiftcols - whether to shift subsequent columnsColumnNotFoundExceptionpublic int getSheetNum()
public NameHandle[] getNamedRangesInScope()
public NameHandle getNamedRangeInScope(String rangename) throws CellNotFoundException
CellNotFoundExceptionpublic String getSheetName()
public String getQualifiedSheetName()
protected Boundsheet getSheet()
public byte[] getSerialBytes()
WorkBookHandle.addWorkSheet(byte[] serialsheet, String NewSheetName)public void writeAsTabbedText(OutputStream dest) throws IOException
IOExceptionpublic boolean getUseCache()
public void setVal(String address, Object val) throws CellNotFoundException, CellTypeMismatchException
String - Cell Address (ie: "D14")Object - new Cell Object valueCellNotFoundException - is thrown if there is no existing Cell at the specified
address.CellTypeMismatchExceptionpublic void setVal(String address, double d) throws CellNotFoundException, CellTypeMismatchException
String - Cell Address (ie: "D14")double - new Cell double valueaddress - d - CellNotFoundException - is thrown if there is no existing Cell at the specified
address.CellTypeMismatchExceptionpublic void setVal(String address, String s) throws CellNotFoundException, CellTypeMismatchException
String - Cell Address (ie: "D14")String - new Cell String valueCellNotFoundException - is thrown if there is no existing Cell at the specified
address.CellTypeMismatchExceptionpublic void setSheetName(String name)
String - the new name for the Worksheetpublic void setVal(String address, int i) throws CellNotFoundException, CellTypeMismatchException
String - Cell Address (ie: "D14")int - new Cell int valueCellNotFoundException - is thrown if there is no existing Cell at the specified
address.CellTypeMismatchExceptionpublic Object getVal(String address) throws CellNotFoundException
CellNotFoundException - is thrown if there is no existing Cell at the specified
address.public CellHandle[] insertRow(int row1, Object[] data)
an - array of Objects to insert into the new rowrownum - the rownumber to insertwhether - to shift down existing Cellspublic boolean insertRow(int rownum)
rownum - the rownumber to insertpublic void insertRow(int rownum,
int flag)
rownum - the rownumber to insertflag - row insertion rulepublic boolean insertRowAt(int rownum,
boolean shiftrows)
rownum - the rownumber to insertwhether - to shift down existing Cellspublic boolean insertRow(int rownum,
boolean shiftrows)
rownum - the rownumber to insert (NOTE: rownum is 0-based)whether - to shift down existing Cellspublic boolean insertRow(int rownum,
RowHandle copyRow,
int flag,
boolean shiftrows)
rownum - the rownumber to insertwhether - to shift down existing Cellspublic CellHandle[] insertRow(int rownum, Object[] data, boolean shiftrows)
an - array of Objects to insert into the new rowrownum - the rownumber to insertwhether - to shift down existing Cellspublic ConditionalFormatHandle[] getConditionalFormatHandles()
public WorkBookHandle getWorkBook()
public ImageHandle getImage(String name) throws ImageNotFoundException
ImageNotFoundExceptionpublic ImageHandle[] getImages()
public int getNumImages()
public void extractImagesToDirectory(String outdir)
imageoutput - directorypublic void extractChartToDirectory(String outdir)
outdir - String output folderpublic void insertImage(ImageHandle im)
im - -- the ImageHandle to insertImageHandlepublic void insertCols(int first,
int count)
add(java.lang.Object, int, int).first - the zero-based index of the first column to insertcount - the number of columns to insert@Deprecated public void insertCol(int colnum)
insertCols(int, int) instead.colnum - the zero-based index of the column to be inserted@Deprecated public void insertCol(String colnum)
insertCols(int, int) instead.colnum - the address of the column to be insertedpublic void setCopyFormatsFromPriorWhenAdding(boolean f)
public CellHandle add(Object obj, int row, int col)
obj - the value of the new Cellint - row the row of the new Cellint - col the column of the new Cellpublic CellHandle[] addValidated(Object obj, int row, int col) throws ValidationException
obj - the value of the new Cellint - row the row of the new Cellint - col the column of the new CellValidationExceptionpublic CellHandle[] addValidated(Object obj, int row, int col, int formatId) throws ValidationException
obj - the value of the new Cellint - row the row of the new Cellint - col the column of the new Cellint - the format id to apply to this cellValidationExceptionpublic CellHandle add(Object obj, int row, int col, int formatId)
obj - the value of the new Cellint - row the row of the new Cellint - col the column of the new Cellint - the format id to apply to this cellpublic void fastAdd(Object obj, int row, int col, int formatId)
obj - the value of the new Cellint - row the row of the new Cellint - col the column of the new Cellint - the format id to apply to this cellpublic void setFastCellAdds(boolean fastadds)
fastadds - whether to disable checking for existing cells andpublic boolean getFastCellAdds()
public CellHandle add(Object obj, String address, boolean autoDetectValue)
obj - the value of the new Celladdress - the address of the new CellautoDetectValue - whether to attempt to store as a number with a format pattern.public CellHandle add(Object obj, String address)
obj - the value of the new Celladdress - the address of the new Cellpublic CellHandle[] addValidated(Object obj, String address) throws ValidationException
obj - the value of the new Celladdress - the address of the new CellValidationExceptionpublic CellHandle add(Timestamp dt, String address, String fmt)
dt - the value of the new java.sql.Timestamp Celladdress - the address of the new java.sql.Date Cellformatting - pattern the address of the new java.sql.Date Cellpublic CellHandle[] addValidated(Timestamp dt, String address, String fmt) throws ValidationException
dt - the value of the new java.sql.Timestamp Celladdress - the address of the new java.sql.Date Cellformatting - pattern the address of the new java.sql.Date CellValidationExceptionpublic CellHandle add(Date dt, String address, String fmt)
dt - the value of the new java.sql.Date Cellrow - to add the datecol - to add the dateformatting - pattern the address of the new java.sql.Date Cellpublic CellHandle[] addValidated(Date dt, String address, String fmt) throws ValidationException
dt - the value of the new java.sql.Date Cellrow - to add the datecol - to add the dateformatting - pattern the address of the new java.sql.Date CellValidationExceptionpublic CellHandle add(Date dt, int row, int col, String fmt)
dt - the value of the new java.sql.Date Celladdress - the address of the new java.sql.Date Cellformatting - pattern the address of the new java.sql.Date Cellpublic CellHandle[] addValidated(Date dt, int row, int col, String fmt) throws ValidationException
dt - the value of the new java.sql.Date Celladdress - the address of the new java.sql.Date Cellformatting - pattern the address of the new java.sql.Date CellValidationExceptionpublic void remove()
public CellRange getCellRange(String rangeName) throws CellNotFoundException
rangeName - "A1:F6"CellNotFoundException - if the range cannot be createdpublic CellHandle[] getCells()
public FormulaHandle getFormula(String addr) throws FormulaNotFoundException, CellNotFoundException
addr - the address of the CellFormulaNotFoundException - is thrown if there is no existing formula at the specified
address.CellNotFoundExceptionpublic CellHandle getCell(String addr) throws CellNotFoundException
addr - the address of the CellCellNotFoundException - is thrown if there is no existing Cell at the specified
address.public CellHandle getCell(int row, int col) throws CellNotFoundException
int - Row the integer row of the Cellint - Col the integer col of the CellCellNotFoundException - is thrown if there is no existing Cell at the specified
address.public CellHandle getCell(int row, int col, boolean cache) throws CellNotFoundException
int - Row the integer row of the Cellint - Col the integer col of the Cellboolean - whether to cache or return a new CellHandle each callCellNotFoundException - is thrown if there is no existing Cell at the specified
address.public void moveCell(CellHandle c, String addr) throws CellPositionConflictException
CellHandle - c - the cell to be movedString - celladdr - the destination address of the cellCellPositionConflictExceptionpublic String getFooterText()
public String getHeaderText()
public String getPrintArea()
public String getPrintTitles()
public PrinterSettingsHandle getPrinterSettings()
public void setPrintArea(CellRange printarea)
printarea - public void setHeaderText(String t)
String - header textpublic void setFooterText(String t)
String - footer textpublic void setDefaultColWidth(int t)
public int getDefaultColWidth()
public String toString()
toString in class ObjectObject.toString()public Boundsheet getMysheet()
public List<?> calculateAffectedCells(String CellAddress)
public boolean getShowFormulaResults()
public void setShowFormulaResults(boolean b)
public boolean getShowGridlines()
boolean - whether to show gridlinespublic void setShowGridlines(boolean b)
public boolean getShowSheetHeaders()
public void setShowSheetHeaders(boolean b)
boolean - whether to show sheet headerspublic boolean getShowZeroValues()
public void setShowZeroValues(boolean b)
public boolean getShowOutlineSymbols()
public void setShowOutlineSymbols(boolean b)
boolean - whether to show outline symbolspublic boolean getShowInNormalView()
public void setShowInNormalView(boolean b)
boolean - whether to show normal view or page break preview viewpublic boolean hasFrozenPanes()
public void setHasFrozenPanes(boolean b)
boolean - whether there are freeze panespublic void setZoom(float zm)
the - zoom as a float percentage (.25 = 25%)public String getTopLeftCell()
public float getZoom()
public void freezeRow(int row)
row - the row to start the freezepublic void freezeCol(int col)
col - the col to start the freezepublic void splitCol(int col,
int splitpos)
col - col start col to splitsplitpos - position of the horizontal splitpublic void splitRow(int row,
int splitpos)
row - start row to splitsplitpos - position of the vertical splitpublic int getSplitRowLocation()
public int getSplitColLocation()
public int getSplitLocation()
public boolean getManualGridLineColor()
public void setManualGridLineColor(boolean b)
boolean - whether to use manual grid colorpublic CompatibleVector getAddedrows()
public ConditionalFormatHandle createConditionalFormatHandle(String cellAddress, String operator, String value1, String value2, String format, String firstCondition, String secondCondition)
cellAddress - without sheetname. Can also be a range, such as A1:B5qualifier - = maps to CONDITION_* bytes in ConditionalFormatHandlevalue1 - = the error messagevalue2 - = the error titleformat - = the initial format string to use with the conditionfirstCondition - = formula stringsecondCondition - = 2nd formula string (optional)public CommentHandle createNote(String address, String txt, String author)
address - -- address to attachtxt - -- text of noteauthor - -- name of authorCommentHandlepublic CommentHandle createNote(String address, Unicodestring txt, String author)
address - -- address to attachtxt - -- Unicode string of note with Formattingauthor - -- name of authorCommentHandlepublic CommentHandle[] getCommentHandles()
public PivotTableHandle createPivotTable(String name, String range, int sId)
name - pivot table namerange - source range for the pivot table. If no sheet is specified, the
current sheet will be used.sId - Stream or cachid Id -- links back to SxStream set of recordspublic ValidationHandle getValidationHandle(String cellAddress)
cell - address Stringpublic ValidationHandle createValidationHandle(String cellAddress, byte valueType, byte condition, String errorBoxText, String errorBoxTitle, String promptBoxText, String promptBoxTitle, String firstCondition, String secondCondition)
cellAddress - without sheetname. Can also be a range, such as A1:B5valueType - = maps to VALUE_* bytes in ValidationHandlecondition - = maps to CONDITION_* bytes in ValidationHandleerrorBoxText - = the error messageerrorBoxTitle - = the error titlepromptBoxText - = the prompt (hover) messagepromptBoxTitle - = the prompt (hover) titlefirstCondition - = formula string, seeValidationHandle.setFirstConditionsecondCondition - = seeValidationHandle.setSecondCondition, this can be left null
for validations that do not require a second argument.public ValidationHandle[] getAllValidationHandles()
public boolean hasDataValidations()
public AutoFilterHandle[] getAutoFilterHandles()
public AutoFilterHandle addAutoFilter(int column)
int - column - column number to add an AutoFilter topublic void removeAutoFilters()
public void evaluateAutoFilters()
NOTE: This method must be called after Autofilter updates or additions in order to see the results of the AutoFilter(s)
NOTE: this evaluation is NOT done automatically due to performance considerations, and is designed to be called after all additions and updating is completed (as evaluation may be time-consuming)
public void close()
protected Boundsheet getBoundsheet()
public void readCSV(BufferedReader input) throws IOException
io.starter.OpenXLS.csvdelimiter".IOExceptionCopyright © 2002–2019 Starter Inc.. All rights reserved.