|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.extentech.ExtenXLS.CellRange
public class CellRange
Cell Range is a handle to a range of Workbook Cells
Contains useful methods for working with Collections of Cells.
for example:
CellRange cr = new CellRange("Sheet1!A1:B10", workbk);
cr.addCellToRange("C10");
CellHandle mycells = cr.getCells();
for(int x=0;x < mycells.length;x++)
Logger.logInfo(mycells[x].getCellAddress() + mycells[x].toString());
}
DataBoundCellRange,
XLSRecord,
Serialized Form| Field Summary | |
|---|---|
CellHandle[] |
cells
|
boolean |
DEBUG
|
static boolean |
REMOVE_MERGED_CELLS
|
static boolean |
RETAIN_MERGED_CELLS
|
static String |
xmlResponsePost
|
static String |
xmlResponsePre
|
| Constructor Summary | |
|---|---|
CellRange(CellHandle[] newcells)
Constructor which creates a new CellRange using an array of cells as it's constructor. |
|
CellRange(CellHandle[] newcells,
boolean createblanks)
create a new CellRange using an array of cells as it's constructor. |
|
CellRange(String r)
Constructor to Create a new CellRange from a String range The String range must be in the format Sheet!CR:CR For Example, "Sheet1!C9:I19" NOTE: You MUST Set the WorkBookHandle explicitly on this CellRange or it will generate NullPointerException when trying to access the Cells. |
|
CellRange(String range,
WorkBook bk)
Constructor which creates a new CellRange from a String range The String range must be in the format Sheet!CR:CR For Example, "Sheet1!C9:I19" |
|
CellRange(String range,
WorkBook bk,
boolean createblanks)
Constructor which creates a new CellRange from a String range The String range must be in the format Sheet!CR:CR For Example, "Sheet1!C9:I19" |
|
CellRange(String range,
WorkBook bk,
boolean createblanks,
boolean initcells)
Constructor which creates a new CellRange from a String range The String range must be in the format Sheet!CR:CR For Example, "Sheet1!C9:I19" |
|
CellRange(WorkSheetHandle sht,
int[] coords)
Constructor to create a new CellRange from a WorkSheetHandle and a set of range coordinates: coords[0] = first row coords[1] = first col coords[2] = last row coords[3] = last col |
|
CellRange(WorkSheetHandle sht,
int[] coords,
boolean cb)
Constructor to create a new CellRange from a WorkSheetHandle and a set of range coordinates: coords[0] = first row coords[1] = first col coords[2] = last row coords[3] = last col |
|
| Method Summary | |
|---|---|
boolean |
addCellToRange(CellHandle ch)
Increase the bounds of the CellRange by including the CellHandle. |
void |
clear()
|
void |
clearContents()
|
void |
clearFormats()
|
boolean |
contains(CellHandle ch)
returns whether this CellRange contains a particular Cell |
boolean |
contains(int[] rc)
returns whether this CellRange contains the specified Row/Col coordinates |
List |
getCellList()
Return a list of the cells in this cell range |
com.extentech.formats.XLS.BiffRec[] |
getCellRecs()
get the underlying Cell Records in this range NOTE: Cell Records are not a part of the public API and are not intended for use in client applications. |
CellHandle[] |
getCells()
get the Cells in this cell range |
static CellHandle[] |
getCells(String range,
WorkBookHandle wbh)
returns the cells for a given range static version |
int[] |
getColInts()
returns an array of column numbers referenced by this CellRange |
ColHandle[] |
getCols()
Returns an array of Columns (ColHandles) referenced by this CellRange |
boolean |
getCreateBlanks()
gets whether this CellRange will add blank records to the WorkBook for any missing Cells contained within the range. |
int[] |
getEdgePositions(CellHandle ch,
int sz)
returns edge status of the desired CellHandle within this CellRange ie: top, left, bottom, right returns 0 or 1 for 4 sides 1,1,1,1 is a single cell in a range 1,1,0,0 is on the top left edge of the range |
org.json.JSONArray |
getJSON()
returns a JSON representation of this CellRange |
static org.json.JSONArray |
getJSON(String range,
WorkBook wbh)
return a JSON array of cell values for the given range static version |
String |
getR1C1Range()
Return the String cell address of this range in R1C1 format |
String |
getRange()
Return the String representation of this range |
int[] |
getRangeCoords()
Gets the coordinates of this cell range. |
int[] |
getRowInts()
Returns an array of the row numbers referenced by this CellRange |
RowHandle[] |
getRows()
Returns an array of Rows (RowHandles) referenced by this CellRange |
WorkSheetHandle |
getSheet()
Returns the WorkSheet referenced in this CellRange. |
WorkBook |
getWorkBook()
|
String |
getXML()
Return the XML representation of this CellRange object |
void |
init()
initializes this CellRange |
void |
initCells(boolean createBlanks)
Initializes this CellRange's cell list if necessary. |
boolean |
intersects(CellRange cr)
returns whether this CellRange intersects with another CellRange |
boolean |
isMerged()
returns the merged state of the CellRange |
void |
mergeCells(boolean remove)
Merge the Cells contained in this CellRange |
void |
setAsPrintArea()
Set this CellRange to be the current Print Area |
void |
setBorder(int width,
int linestyle,
Color colr)
sets a border around the range of cells |
void |
setCreateBlanks(boolean b)
set whether this CellRange will add blank records to the WorkBook for any missing Cells contained within the range. |
void |
setFormatID(int fmtID)
Set the format ID of all cells in this CellRange FormatID can be obtained through any CellHandle with the getFormatID() call |
void |
setRange(String rng)
Sets the range of cells for this CellRange to a string range |
void |
setSheet(WorkSheetHandle aSheet)
Sets the sheet reference for this CellRange. |
void |
setURL(String url)
Set a hyperlink on all cells in this CellRange |
void |
setWorkBook(WorkBook bk)
attach the workbook for this CellRange |
String |
toString()
returns the String representation of this CellRange |
void |
unMergeCells()
Un-Merge the Cells contained in this CellRange |
boolean |
update()
update the CellRange when the underlying Cells change their location |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean REMOVE_MERGED_CELLS
public static final boolean RETAIN_MERGED_CELLS
public boolean DEBUG
public transient CellHandle[] cells
public static String xmlResponsePre
public static String xmlResponsePost
| Constructor Detail |
|---|
public CellRange(WorkSheetHandle sht,
int[] coords,
boolean cb)
throws Exception
WorkSheetHandle - sht - handle to the WorkSheet containing the Range's Cellsint[] - coords - the cell coordinatesboolean - cb - true if should create blank cells
Exception
public CellRange(WorkSheetHandle sht,
int[] coords)
throws Exception
WorkSheetHandle - sht - handle to the WorkSheet containing the Range's Cellsint[] - coords - the cell coordinates
Exceptionpublic CellRange(String r)
String - r - range StringCellRange.setWorkBook
public CellRange(String range,
WorkBook bk,
boolean createblanks,
boolean initcells)
String - range - the range stringWorkBook - bkboolean - createblanks - true if blank cells should be created if necessaryboolean - initcells - true if cells should (be initialized)
public CellRange(String range,
WorkBook bk,
boolean createblanks)
String - range - the range stringWorkBook - bkboolean - createblanks - true if blank cells should be created (if necessary)
public CellRange(CellHandle[] newcells)
throws com.extentech.formats.XLS.CellNotFoundException
CellHandle[] - newcells - the array of cells from which to create the new CellRange
com.extentech.formats.XLS.CellNotFoundException
public CellRange(CellHandle[] newcells,
boolean createblanks)
throws com.extentech.formats.XLS.CellNotFoundException
CellHandle[] - newcells - the array of cells from which to create the new CellRangeboolean - createblanks - true if should create blank cells if necesary
com.extentech.formats.XLS.CellNotFoundException
public CellRange(String range,
WorkBook bk)
throws com.extentech.formats.XLS.CellNotFoundException
String - range - the range stringWorkBook - bk
com.extentech.formats.XLS.CellNotFoundException| Method Detail |
|---|
public void clearFormats()
public void clearContents()
public void clear()
public void unMergeCells()
throws Exception
Exception
public void setFormatID(int fmtID)
throws Exception
int - fmtID - the format ID to set the cells within the range to
Exception
public void setURL(String url)
throws Exception
String - url - the URL String to set
Exceptionpublic void mergeCells(boolean remove)
boolean - remove - true to delete the Cells following the first in the rangepublic int[] getRowInts()
public int[] getColInts()
public RowHandle[] getRows()
throws com.extentech.formats.XLS.RowNotFoundException
com.extentech.formats.XLS.RowNotFoundException
public ColHandle[] getCols()
throws com.extentech.formats.XLS.ColumnNotFoundException
com.extentech.formats.XLS.ColumnNotFoundException
public int[] getEdgePositions(CellHandle ch,
int sz)
CellHandle - ch -int - sz -
public boolean intersects(CellRange cr)
CellRange - cr - CellRange to test
public boolean contains(CellHandle ch)
CellHandle - ch - the Cell to check
public boolean contains(int[] rc)
int[] - rc - row/col coordinates to test
public String toString()
toString in class Objectpublic void setAsPrintArea()
public boolean addCellToRange(CellHandle ch)
CellHandle - ch - the Cell to add to the CellRangepublic CellHandle[] getCells()
public List getCellList()
public com.extentech.formats.XLS.BiffRec[] getCellRecs()
public String getXML()
public void setWorkBook(WorkBook bk)
WorkBook - bk
public int[] getRangeCoords()
throws com.extentech.formats.XLS.CellNotFoundException
com.extentech.formats.XLS.CellNotFoundExceptionpublic WorkSheetHandle getSheet()
public void init()
throws com.extentech.formats.XLS.CellNotFoundException
com.extentech.formats.XLS.CellNotFoundExceptionpublic void initCells(boolean createBlanks)
CellRange's cell list if necessary.
This method is useful if this CellRange was created with
initCells set to false and it is later
necessary to retrieve the cell list.
createBlanks - whether missing cells should be created as blanks.
If this is false they will appear in the cell list
as nulls.public WorkBook getWorkBook()
public boolean getCreateBlanks()
public void setCreateBlanks(boolean b)
boolean - b - true if should create blank records for missing Cellspublic String getRange()
public String getR1C1Range()
public void setRange(String rng)
String - rng - Range string
public void setBorder(int width,
int linestyle,
Color colr)
int - width - line widthint - linestyle - line stylejava.awt.Color - colr - color of border linepublic boolean update()
public boolean isMerged()
public void setSheet(WorkSheetHandle aSheet)
WorkSheetHandle - aSheetpublic org.json.JSONArray getJSON()
public static org.json.JSONArray getJSON(String range,
WorkBook wbh)
String - range - a string representation of the desired range of cellsWorkBook - wbh - the source WorkBook for the cell range
public static CellHandle[] getCells(String range,
WorkBookHandle wbh)
String - range - a string representation of the desired range of cellsWorkBook - wbh - the source WorkBook for the cell range
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||