Range
Contents
[
Hide
]
Range class
Encapsulates the object that represents a range of cells within a spreadsheet.
public class Range
Properties
Name | Description |
---|---|
Address { get; } | Gets address of the range. |
CellCount { get; } | Gets all cell count in the range. |
ColumnCount { get; } | Gets the count of columns in the range. |
ColumnWidth { get; set; } | Sets or gets the column width of this range |
CurrentRegion { get; } | 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. |
EntireColumn { get; } | Gets a Range object that represents the entire column (or columns) that contains the specified range. |
EntireRow { get; } | Gets a Range object that represents the entire row (or rows) that contains the specified range. |
FirstColumn { get; } | Gets the index of the first column of the range. |
FirstRow { get; } | Gets the index of the first row of the range. |
Hyperlinks { get; } | Gets all hyperlink in the range. |
Item { get; } | Gets Cell object in this range. |
Name { get; set; } | Gets or sets the name of the range. |
RefersTo { get; } | Gets the range’s refers to. |
RowCount { get; } | Gets the count of rows in the range. |
RowHeight { get; set; } | Sets or gets the height of rows in this range |
Value { get; set; } | Gets and sets the value of the range. |
Worksheet { get; } | Gets the Worksheet object which contains this range. |
Methods
Name | Description |
---|---|
ApplyStyle(Style, StyleFlag) | Applies formats for a whole range. |
AutoFill(Range) | Automaticall fill the target range. |
AutoFill(Range, AutoFillType) | Automaticall fill the target range. |
Copy(Range) | Copies data (including formulas), formatting, drawing objects etc. from a source range. |
Copy(Range, PasteOptions) | Copying the range with paste special options. |
CopyData(Range) | Copies cell data (including formulas) from a source range. |
CopyStyle(Range) | Copies style settings from a source range. |
CopyValue(Range) | Copies cell value from a source range. |
ExportDataTable() | Exports data in this range to a DataTable object. |
ExportDataTable(ExportTableOptions) | Exports data in this range to a DataTable object. |
ExportDataTableAsString() | Exports data in this range to a DataTable object. |
GetCellOrNull(int, int) | Gets Cell object or null in this range. |
GetEnumerator() | Gets the enumerator for cells in this Range. |
GetOffset(int, int) | Gets Range range by offset. |
Intersect(Range) | Returns a Range object that represents the rectangular intersection of two ranges. |
IsIntersect(Range) | Indicates whether the range is intersect. |
Merge() | Combines a range of cells into a single cell. |
MoveTo(int, int) | Move the current range to the dest range. |
PutValue(string, bool, bool) | 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. |
SetInsideBorders(BorderType, CellBorderType, CellsColor) | Set inside borders of the range. |
SetOutlineBorder(BorderType, CellBorderType, Color) | Sets outline border around a range of cells. |
SetOutlineBorders(CellBorderType, Color) | Sets the outline borders around a range of cells with same border style and color. |
SetOutlineBorders(CellBorderType[], Color[]) | Sets out line borders around a range of cells. |
SetStyle(Style) | Sets the style of the range. |
override ToString() | Returns a string represents the current Range object. |
Union(Range) | Returns the union of two ranges. |
UnMerge() | Unmerges merged cells of this range. |
Examples
[C#]
//Instantiating a Workbook object
Workbook workbook = new Workbook();
// Get the first Worksheet Cells.
Cells cells = workbook.Worksheets[0].Cells;
// Create a range (A1:D3).
Range range = cells.CreateRange("A1", "D3");
// Set value to the range.
range.Value = "Hello";
//Save the Excel file
workbook.Save("book1.xlsm");
[Visual Basic]
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Get the first Worksheet Cells.
Dim cells as Cells = workbook.Worksheets[0].Cells
'Create a range (A1:D3).
Dim range as Range = cells.CreateRange("A1", "D3")
'Set value to the range.
range.Value = "Hello"
'Save the Excel file
workbook.Save("book1.xlsm")
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells