com.aspose.cells
Class Range

java.lang.Object
    extended by com.aspose.cells.Range

public class Range 
extends java.lang.Object

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

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

Property Getters/Setters Detail

getRowCount

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

getColumnCount

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

getName/setName

public java.lang.String getName() / public 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 java.lang.String getRefersTo()
Gets the range's refers to.

getFirstRow

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

getFirstColumn

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

getValue/setValue

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

getColumnWidth/setColumnWidth

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

getRowHeight/setRowHeight

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

getWorksheet

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

get

public 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 java.util.Iterator iterator()
Gets the cells enumerator
Returns:
The cells enumertor

isIntersect

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

intersect

public 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 java.util.ArrayList union(Range range)
Returns the union of two ranges.
Parameters:
range - The range
Returns:
The union of two ranges.

merge

public 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 void unMerge()
Unmerges merged cells of this range.

putValue

public 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 void applyStyle(Style style, StyleFlag flag)
Applies formattings 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 void setStyle(Style style)
Sets the style of the range.
Parameters:
style - The Style object.

setOutlineBorders

public void setOutlineBorders(int borderStyle, com.aspose.cells.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 void setOutlineBorders(int[] borderStyles, com.aspose.cells.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 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 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 void copyData(Range range)
Copies cell data (including formulas) from a source range.
Parameters:
range - Source Range object.

copyValue

public void copyValue(Range range)
Copies cell value from a source range.
Parameters:
range - Source Range object.

copyStyle

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

copy

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

copy

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

getCellOrNull

public 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.

toString

public java.lang.String toString()
Returns a string represents the current Range object.
Returns:

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