Package org.apache.poi.ss.util
Class CellRangeUtil
java.lang.Object
org.apache.poi.ss.util.CellRangeUtil
Utility class that builds on
CellRangeAddress
Portions of this class may be moved to CellRangeAddressBase-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intfirst range encloses or is equal to the secondstatic final intfirst range is within the second rangestatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(CellRangeAddress crA, CellRangeAddress crB) Check if cell range A contains cell range B (B <= A) TODO: move this intoCellRangeAddressBasestatic CellRangeAddressCreate an enclosing CellRange for the two cell ranges.static booleanCheck if the two cell ranges have a shared border.static intintersect(CellRangeAddress crA, CellRangeAddress crB) Get the type of intersection between two cell rangesstatic CellRangeAddress[]mergeCellRanges(CellRangeAddress[] cellRanges) Do all possible cell merges between cells of the list so that:
if a cell range is completely inside of another cell range, it gets removed from the list if two cells have a shared border, merge them into one bigger cell range
-
Field Details
-
NO_INTERSECTION
public static final int NO_INTERSECTION- See Also:
-
OVERLAP
public static final int OVERLAP- See Also:
-
INSIDE
public static final int INSIDEfirst range is within the second range- See Also:
-
ENCLOSES
public static final int ENCLOSESfirst range encloses or is equal to the second- See Also:
-
-
Method Details
-
intersect
Get the type of intersection between two cell ranges- Parameters:
crB- - the specified range- Returns:
- code which reflects how the specified range is related to this range.
Possible return codes are:NO_INTERSECTION- the specified range is outside of this range;OVERLAP- both ranges partially overlapINSIDE- the specified range is inside of this oneENCLOSES- the specified range encloses (possibly exactly the same as) this range
- See Also:
-
mergeCellRanges
Do all possible cell merges between cells of the list so that:
- if a cell range is completely inside of another cell range, it gets removed from the list
- if two cells have a shared border, merge them into one bigger cell range
- Parameters:
cellRanges- the ranges to merge- Returns:
- list of merged cell ranges
-
contains
Check if cell range A contains cell range B (B <= A) TODO: move this intoCellRangeAddressBase- Parameters:
crA- cell range AcrB- cell range B- Returns:
- true if cell range A contains cell range B
-
createEnclosingCellRange
Create an enclosing CellRange for the two cell ranges.- Returns:
- enclosing CellRange
-