| Constructor and Description |
|---|
CellRange(Worksheet worksheet,
int topLeftColumn,
int topLeftRow,
int bottomRightColumn,
int bottomRightRow)
Initializes a new instance of the
CellRange class. |
CellRange(Worksheet worksheet,
java.lang.String range)
Initializes a new instance of the
CellRange class. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
autoFill(CellRange target,
boolean horizontal,
boolean copyOnly)
Automatically fills the values of the cells in the specified range based
on the values of the cells in this range.
|
boolean |
autoFilter()
Toggles autofiltering for the columns in this range.
|
void |
autoFilter(int field,
java.lang.Object criteria1,
AutoFilterOperator op,
java.lang.Object criteria2,
boolean visibleDropDown)
Enables autofiltering for the specified column in this range using the specified criteria.
|
boolean |
clear()
Clears the content of the cells in this range.
|
void |
fillData(FillType type,
FillDirection direction,
FillDate date,
double step,
java.lang.Double stop,
boolean trend)
Fills the data in this range according to the current data and the specified options.
|
int |
getBottom()
Gets the bottom side of the range.
|
CellRef |
getCellRef() |
IConditionalFormatCollection |
getConditionalFormats()
Gets a list with format objects that can be used to customize
the appearance of the cells in the range based on various conditions.
|
int |
getLeft()
Gets the left side of the range.
|
int |
getRight()
Gets the right side of the range.
|
IStyle |
getStyle()
Gets an
IStyle object that can be used to customize the appearance of all cells in the range. |
int |
getTop()
Gets the top side of the range.
|
IValidation |
getValidation()
Gets an
IValidation object that can be used to specify validation rules for the data in the cell range. |
Worksheet |
getWorksheet() |
void |
insert(PushDirection direction)
Inserts new cells in the current range of cells.
|
java.util.Iterator<Cell> |
iterator()
Returns an enumerator object that can be used to iterate through the cells in the range.
|
boolean |
merge()
Merges the cells in this range into a single cell.
|
boolean |
merge(boolean validate)
Merges the cells in this range into a single cell.
|
boolean |
moveTo(Cell targetCell)
Moves the data from the current range to the range identified by the specified cell.
|
boolean |
moveTo(int targetColumn,
int targetRow)
Moves the data from the current range to the range identified by the specified column and row.
|
void |
remove(ShiftDirection direction)
Remove the cells in the current range of cells.
|
void |
reset()
Clears the contents of the cells in the range, as well as their associated styles,
hyperlinks, annotations, conditional formatting and data validations.
|
void |
setCellRef(CellRef value) |
boolean |
sort(SortOptions options)
Sorts the data in this range according to the specified options.
|
double |
sum()
Returns the sum of Numeric cell values.
|
java.lang.String |
toString() |
void |
unmerge()
Unmerges all merged cells intersecting with this range.
|
public CellRange(Worksheet worksheet, int topLeftColumn, int topLeftRow, int bottomRightColumn, int bottomRightRow)
CellRange class.public java.util.Iterator<Cell> iterator()
iterator in interface java.lang.Iterable<Cell>public boolean clear()
true if at least one cell has been cleared; otherwise, false.public void reset()
public void insert(PushDirection direction)
This method will raise an IllegalStateException exception if
the operation would cause filled cells to be shifted beyond the sheet.
direction - Specifies the direction to push the existing cells in the range.public void remove(ShiftDirection direction)
direction - Specifies how to fill the space of the removed cells.public boolean moveTo(Cell targetCell)
This method will raise an IllegalArgumentException exception
if the target range is outside of the current worksheet.
targetCell - The top-left cell of the target range.public boolean moveTo(int targetColumn,
int targetRow)
This method will raise an IllegalArgumentException exception
if the target range is outside of the current worksheet.
targetColumn - The leftmost column of the target range.targetRow - The topmost row of the target range.public void fillData(FillType type, FillDirection direction, FillDate date, double step, java.lang.Double stop, boolean trend)
type - The fill type.direction - The fill direction.date - The date component to increment when the fill type is Date.
This parameter is ignored for any of the other fill types.step - The increment step. This parameter is ignored if the fill type
is Auto or when using linear or growth trend.stop - The fill restriction. The fill will stop when the running value exceeds this restriction.
This parameter is ignored if the fill type is Auto or when using linear or growth trend.trend - A flag indicating whether to use linear or growth trend. This flag can be combined
with the Linear and Growth fill types to specify the actual trend.public boolean autoFill(CellRange target, boolean horizontal, boolean copyOnly)
The autofill operation will fail if the specified range intersects with this range.
target - The range to fill.horizontal - A flag indicating the direction of the fill.copyOnly - A flag indicating whether to perform a raw copy, rather than increments/estimates.true, if the fill was successful; otherwise, false.public boolean merge()
The merge will fail if the current range contains only a single cell or if the range intersects with another merged cell.
true if the merge was successful; otherwise, false.public boolean merge(boolean validate)
validate - true to validate range coordinates, or false otherwise.true if the merge was successful; otherwise, false.public void unmerge()
public boolean sort(SortOptions options)
The sorting will fail if there are no keys specified or if all keys are outside of the current range.
options - The sort settings, such as sort keys and direction.true if the sort was successful; otherwise, false.public boolean autoFilter()
true if autofiltering was successfully toggled; otherwise, false.public void autoFilter(int field,
java.lang.Object criteria1,
AutoFilterOperator op,
java.lang.Object criteria2,
boolean visibleDropDown)
field - The 1-based index of the column, relatively to the leftmost column in the range.criteria1 - A string or an array of values, specifying the first criteria, for example "101".
Use "=" to find blank fields, or use "<>" to find nonblank fields.
If this argument is omitted, the criteria is All. If op is Top10Items,
criteria1 specifies the number of items, for example, "10".op - A value specifying the type of the filter.criteria2 - The second criteria. Used with criteria1 and op to construct compound criteria.visibleDropDown - true to display the autofilter drop-down arrow for the filtered field;
false to hide the autofilter drop-down arrow for the filtered field.public Worksheet getWorksheet()
public CellRef getCellRef()
public void setCellRef(CellRef value)
public IStyle getStyle()
IStyle object that can be used to customize the appearance of all cells in the range.public IValidation getValidation()
IValidation object that can be used to specify validation rules for the data in the cell range.public IConditionalFormatCollection getConditionalFormats()
public int getLeft()
public int getTop()
public int getRight()
public int getBottom()
public java.lang.String toString()
toString in class java.lang.Objectpublic double sum()