Range class
Range class
Encapsulates the object that represents a range of cells within a spreadsheet.
The Range type exposes the following members:
Properties
Property | Description |
---|---|
current_region | 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. |
hyperlinks | Gets all hyperlink in the range. |
row_count | Gets the count of rows in the range. |
column_count | Gets the count of columns in the range. |
name | Gets or sets the name of the range. |
refers_to | Gets the range’s refers to. |
address | Gets address of the range. |
left | Gets the distance, in points, from the left edge of column A to the left edge of the range. |
top | Gets the distance, in points, from the top edge of row 1 to the top edge of the range. |
width | Gets the width of a range in points. |
height | Gets the width of a range in points. |
first_row | Gets the index of the first row of the range. |
first_column | Gets the index of the first column of the range. |
value | Gets and sets the value of the range. |
column_width | Sets or gets the column width of this range |
row_height | Sets or gets the height of rows in this range |
entire_column | Gets a Range object that represents the entire column (or columns) that contains the specified range. |
entire_row | Gets a Range object that represents the entire row (or rows) that contains the specified range. |
worksheet | Gets the Range.worksheet object which contains this range. |
Methods
Method | Description |
---|---|
auto_fill | Automaticall fill the target range. |
auto_fill | Automaticall fill the target range. |
set_style | Apply the cell style. |
set_style | Sets the style of the range. |
set_outline_borders | Sets the outline borders around a range of cells with same border style and color. |
set_outline_borders | Sets the outline borders around a range of cells with same border style and color. |
set_outline_borders | Sets out line borders around a range of cells. |
set_outline_border | Sets outline border around a range of cells. |
set_outline_border | Sets outline border around a range of cells. |
copy | Copying the range with paste special options. |
copy | Copies data (including formulas), formatting, drawing objects etc. from a source range. |
add_hyperlink | Adds a hyperlink to a specified cell or a range of cells. |
get_enumerator | Gets the enumerator for cells in this Range. |
is_intersect | Indicates whether the range is intersect. |
intersect | Returns a Range object that represents the rectangular intersection of two ranges. |
union_rang | Returns the union result of two ranges. |
union_ranges | Returns the union result of two ranges. |
union | Returns the union of two ranges. |
is_blank | Indicates whether the range contains values. |
merge | Combines a range of cells into a single cell. |
un_merge | Unmerges merged cells of this range. |
put_value | 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. |
apply_style | Applies formats for a whole range. |
set_inside_borders | Set inside borders of the range. |
move_to | Move the current range to the dest range. |
copy_data | Copies cell data (including formulas) from a source range. |
copy_value | Copies cell value from a source range. |
copy_style | Copies style settings from a source range. |
transpose | Transpose (rotate) data from rows to columns or vice versa. |
get | Add API for Python Via .Net.since this[int, int] is unsupported |
get_cell_or_null | Gets Cell object or null in this range. |
get_offset | Gets Range range by offset. |
to_image | Converts the range to image. |
to_json | Convert the range to JSON value. |
to_html | Convert the range to html . |
Remarks
The Range class denotes a region of Excel spreadsheet. With this, you can format and set value of the range. And you can simply copy range of Excel too.
Example
The following example shows how to create a range and set value the range of Excel.
from aspose.cells import Workbook
# Instantiating a Workbook object
workbook = Workbook()
# Get the first Worksheet Cells.
cells = workbook.worksheets[0].cells
# Create a range (A1:D3).
range = cells.create_range("A1", "D3")
# Set value to the range.
range.value = "Hello"
# Save the Excel file
workbook.save("book1.xlsm")
See Also
- module
aspose.cells
- class
Cell
- class
Range