All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aspose.cells.Range.html Maven / Gradle / Ivy






Range




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
java.lang.StringgetAddress()
           Gets address of the range.
intgetCellCount()
           Gets all cell count in the range.
intgetColumnCount()
           Gets the count of columns in the range.
doublegetColumnWidth()
voidsetColumnWidth(double)
           Sets or gets the column width of this range
RangegetCurrentRegion()
           Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns.
RangegetEntireColumn()
           Gets a Range object that represents the entire column (or columns) that contains the specified range.
RangegetEntireRow()
           Gets a Range object that represents the entire row (or rows) that contains the specified range.
intgetFirstColumn()
           Gets the index of the first column of the range.
intgetFirstRow()
           Gets the index of the first row of the range.
com.aspose.cells.Hyperlink[]getHyperlinks()
           Gets all hyperlink in the range.
java.lang.StringgetName()
voidsetName(java.lang.String)
           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)
           Sets or gets the height of rows in this range
java.lang.ObjectgetValue()
voidsetValue(java.lang.Object)
           Gets and sets the value of the range.
WorksheetgetWorksheet()
           Gets the Worksheetobject which contains this range.
Cellget(int, int)
           Gets Cell object in this range.
 
Method Summary
voidapplyStyle(Style style, StyleFlag flag)
           Applies formats for a whole range.
voidautoFill(Range target)
           Automaticall fill the target range.
voidautoFill(Range target, int autoFillType)
           Automaticall fill the target 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 rowOffset, int columnOffset)
           Gets Cell object or null in this range.
RangegetOffset(int rowOffset, int columnOffset)
           Gets Range range by offset.
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 enumerator for cells in this Range.
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.
voidsetInsideBorders(int borderEdge, int lineStyle, CellsColor borderColor)
           Set inside borders of the range.
voidsetOutlineBorder(int borderEdge, int borderStyle, com.aspose.cells.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

getCurrentRegion

public Range getCurrentRegion()
Returns a Range object that represents the current region. The current region is a range bounded by any combination of blank rows and blank columns.

getHyperlinks

public com.aspose.cells.Hyperlink[] getHyperlinks()
Gets all hyperlink in the range.

getRowCount

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

getColumnCount

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

getCellCount

public int getCellCount()
Gets all cell count in the range. NOTE: This property is now obsolete. Instead, please use RowCount and ColumnCount to get total cells count. This property will be removed 12 months later since February 2021. Aspose apologizes for any inconvenience you may have experienced.

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";


setName

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.

getAddress

public java.lang.String getAddress()
Gets address of the range.

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.

setValue

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

setColumnWidth

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

setRowHeight

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

getEntireColumn

public Range getEntireColumn()
Gets a Range object that represents the entire column (or columns) that contains the specified range.

getEntireRow

public Range getEntireRow()
Gets a Range object that represents the entire row (or rows) that contains the specified range.

getWorksheet

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

get

public Cell get(int rowOffset, int columnOffset)
Gets Cell object in this range.
Parameters:
rowOffset - Row offset in this range, zero based.
columnOffset - Column offset in this range, zero based.
Returns:
Cell object.

Method Detail

autoFill

public void autoFill(Range target)
             throws java.lang.Exception
Automaticall fill the target range.
Parameters:
target - the target range.

autoFill

public void autoFill(Range target, int autoFillType)
             throws java.lang.Exception
Automaticall fill the target range.
Parameters:
target - The targed range.
autoFillType - A AutoFillType value. The auto fill type.

iterator

public java.util.Iterator iterator()
Gets the enumerator for cells in this Range. When traversing elements by the returned Enumerator, the cells collection should not be modified(such as operations that will cause new Cell/Row be instantiated or existing Cell/Row be deleted). Otherwise the enumerator may not be able to traverse all cells correctly(some elements may be traversed repeatedly or skipped).
Returns:
The cells enumerator

isIntersect

public boolean isIntersect(Range range)
Indicates whether the range is intersect. If the two ranges 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:
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 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 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 borderStyles and borderStyles must be top,bottom,left,right
Parameters:
borderStyles - Border styles.
borderColors - Border colors.

setOutlineBorder

public void setOutlineBorder(int borderEdge, int borderStyle, com.aspose.cells.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.

setInsideBorders

public void setInsideBorders(int borderEdge, int lineStyle, CellsColor borderColor)
Set inside borders of the range.
Parameters:
borderEdge - A BorderType value. Inside borde type, only can be BorderType.VERTICAL and BorderType.HORIZONTAL.
lineStyle - A CellBorderType value. The border style.
borderColor - The color of the border.

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)
             throws java.lang.Exception
Copies cell data (including formulas) from a source range.
Parameters:
range - Source Range object.

copyValue

public void copyValue(Range range)
              throws java.lang.Exception
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)
         throws java.lang.Exception
Copying the range with paste special options.
Parameters:
range - The source range.
options - The paste special options.

copy

public 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 Cell getCellOrNull(int rowOffset, int columnOffset)
Gets Cell object or null in this range.
Parameters:
rowOffset - Row offset in this range, zero based.
columnOffset - Column offset in this range, zero based.
Returns:
Cell object.

getOffset

public Range getOffset(int rowOffset, int columnOffset)
Gets Range range by offset.
Parameters:
rowOffset - Row offset in this range, zero based.
columnOffset - Column offset in this range, zero based.
Returns:

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.Cells Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy