com.aspose.cells
Class Range

java.lang.Object
    extended by com.aspose.cells.Range
Direct Known Subclasses:
RangeImp

public abstract class Range 
extends java.lang.Object

Encapsulates the object that represents a range of cells within a spreadsheet.

Property Getters/Setters Summary
abstract intgetColumnCount()
           Gets the count of columns in the range.
abstract doublegetColumnWidth()
abstract voidsetColumnWidth(double value)
           Sets or gets the column width of this range
abstract intgetFirstColumn()
           Gets the index of the first column of the range.
abstract intgetFirstRow()
           Gets the index of the first row of the range.
abstract java.lang.StringgetName()
abstract voidsetName(java.lang.String value)
           Gets or sets the name of the range.
abstract java.lang.StringgetRefersTo()
           Gets the range's refers to.
abstract intgetRowCount()
           Gets the count of rows in the range.
abstract doublegetRowHeight()
abstract voidsetRowHeight(double value)
           Sets or gets the height of rows in this range
abstract java.lang.ObjectgetValue()
abstract voidsetValue(java.lang.Object value)
           Gets and sets the value of the range.
abstract WorksheetgetWorksheet()
           Gets the Worksheetobject which contains this range.
abstract Cellget(int rowIndex, int columnIndex)
           Gets Cell object in this range.
 
Method Summary
abstract voidapplyStyle(Style style, StyleFlag flag)
           Applies formats for a whole range.
abstract voidcopy(Range range)
           Copies data (including formulas), formatting, drawing objects etc. from a source range.
abstract voidcopy(Range range, PasteOptions options)
           Copying the range with paste special options.
abstract voidcopyData(Range range)
           Copies cell data (including formulas) from a source range.
abstract voidcopyStyle(Range range)
           Copies style settings from a source range.
abstract voidcopyValue(Range range)
           Copies cell value from a source range.
abstract CellgetCellOrNull(int rowIndex, int columnIndex)
           Gets Cell object or null in this range.
abstract Rangeintersect(Range range)
           Returns a Range object that represents the rectangular intersection of two ranges.
abstract booleanisIntersect(Range range)
           Indicates whether the range is intersect.
abstract java.util.Iteratoriterator()
           Gets the cells enumerator
abstract voidmerge()
           Combines a range of cells into a single cell.
abstract voidmoveTo(int destRow, int destColumn)
           Move the current range to the dest range.
abstract voidputValue(java.lang.String stringValue, boolean isConverted, boolean setStyle)
           Puts a value into the range, if appropriate the value will be converted to other data type and cell's number format will be reset.
abstract voidsetOutlineBorder(int borderEdge, int borderStyle, Color borderColor)
           Sets outline border around a range of cells.
abstract voidsetOutlineBorders(int borderStyle, Color borderColor)
           Sets the outline borders around a range of cells with same border style and color.
abstract voidsetOutlineBorders(int[] borderStyles, Color[] borderColors)
           Sets out line borders around a range of cells.
abstract voidsetStyle(Style style)
           Sets the style of the range.
abstract java.util.ArrayListunion(Range range)
           Returns the union of two ranges.
abstract voidunMerge()
           Unmerges merged cells of this range.
 

Property Getters/Setters Detail

getRowCount

public abstract int getRowCount()
Gets the count of rows in the range.

getColumnCount

public abstract int getColumnCount()
Gets the count of columns in the range.

getName/setName

public abstract java.lang.String getName() / public abstract void setName(java.lang.String value)
Gets or sets the name of the range. Named range is supported. For example,

range.Name = "Sheet1!MyRange";


getRefersTo

public abstract java.lang.String getRefersTo()
Gets the range's refers to.

getFirstRow

public abstract int getFirstRow()
Gets the index of the first row of the range.

getFirstColumn

public abstract int getFirstColumn()
Gets the index of the first column of the range.

getValue/setValue

public abstract java.lang.Object getValue() / public abstract void setValue(java.lang.Object value)
Gets and sets the value of the range. If the range contains multiple cells, return a two-dimension com.aspose.cells.Array object. If applies object array to the range, it should be a two-dimension com.aspose.cells.Array object.

getColumnWidth/setColumnWidth

public abstract double getColumnWidth() / public abstract void setColumnWidth(double value)
Sets or gets the column width of this range

getRowHeight/setRowHeight

public abstract double getRowHeight() / public abstract void setRowHeight(double value)
Sets or gets the height of rows in this range

getWorksheet

public abstract Worksheet getWorksheet()
Gets the Worksheetobject which contains this range.

get

public abstract Cell get(int rowIndex, int columnIndex)
Gets Cell object in this range.
Parameters:
rowIndex - Row index in this range, zero based.
columnIndex - Column index in this range, zero based.
Returns:
Cell object.

Method Detail

iterator

public abstract java.util.Iterator iterator()
Gets the cells enumerator
Returns:
The cells enumerator

isIntersect

public abstract boolean isIntersect(Range range)
Indicates whether the range is intersect. If the two rangs are not in the same worksheet, return false.
Parameters:
range - The range.
Returns:
Whether the range is intersect.

intersect

public abstract Range intersect(Range range)
Returns a Range object that represents the rectangular intersection of two ranges. If the two ranges are not intersected, returns null.
Parameters:
range - The intersecting range.
Returns:
a Range object

union

public abstract java.util.ArrayList union(Range range)
Returns the union of two ranges.
Parameters:
range - The range
Returns:
The union of two ranges.

merge

public abstract void merge()
Combines a range of cells into a single cell. Reference the merged cell via the address of the upper-left cell in the range.

unMerge

public abstract void unMerge()
Unmerges merged cells of this range.

putValue

public abstract void putValue(java.lang.String stringValue, boolean isConverted, boolean setStyle)
Puts a value into the range, if appropriate the value will be converted to other data type and cell's number format will be reset.
Parameters:
stringValue - Input value
isConverted - True: converted to other data type if appropriate.
setStyle - True: set the number format to cell's style when converting to other data type

applyStyle

public abstract void applyStyle(Style style, StyleFlag flag)
Applies formats for a whole range. Each cell in this range will contains a Style object. So this is a memory-consuming method. Please use it carefully.
Parameters:
style - The style object which will be applied.
flag - Flags which indicates applied formatting properties.

setStyle

public abstract void setStyle(Style style)
Sets the style of the range.
Parameters:
style - The Style object.

setOutlineBorders

public abstract void setOutlineBorders(int borderStyle, Color borderColor)
Sets the outline borders around a range of cells with same border style and color.
Parameters:
borderStyle - A CellBorderType value. Border style.
borderColor - Border color.

setOutlineBorders

public abstract void setOutlineBorders(int[] borderStyles, Color[] borderColors)
Sets out line borders around a range of cells. Both the length of borderStyles and borderStyles must be 4. The order of of borderStyles and borderStyles must be top,bottom,left,right
Parameters:
borderStyles - Border styles.
borderColors - Border colors.

setOutlineBorder

public abstract void setOutlineBorder(int borderEdge, int borderStyle, Color borderColor)
Sets outline border around a range of cells.
Parameters:
borderEdge - A BorderType value. Border edge.
borderStyle - A CellBorderType value. Border style.
borderColor - Border color.

moveTo

public abstract void moveTo(int destRow, int destColumn)
Move the current range to the dest range.
Parameters:
destRow - The start row of the dest range.
destColumn - The start column of the dest range.

copyData

public abstract void copyData(Range range)
                           throws java.lang.Exception
Copies cell data (including formulas) from a source range.
Parameters:
range - Source Range object.

copyValue

public abstract void copyValue(Range range)
                            throws java.lang.Exception
Copies cell value from a source range.
Parameters:
range - Source Range object.

copyStyle

public abstract void copyStyle(Range range)
Copies style settings from a source range.
Parameters:
range - Source Range object.

copy

public abstract void copy(Range range, PasteOptions options)
                       throws java.lang.Exception
Copying the range with paste special options.
Parameters:
range - The soure range.
options - The paste special options.

copy

public abstract void copy(Range range)
                       throws java.lang.Exception
Copies data (including formulas), formatting, drawing objects etc. from a source range.
Parameters:
range - Source Range object.

getCellOrNull

public abstract Cell getCellOrNull(int rowIndex, int columnIndex)
Gets Cell object or null in this range.
Parameters:
rowIndex - Row index in this range, zero based.
columnIndex - Column index in this range, zero based.
Returns:
Cell object.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.