Class Range
Contents
[
Hide
]Range class
Encapsulates the object that represents a range of cells within a spreadsheet.
public class Range : IEnumerable
Properties
Name | Description |
---|---|
Address { get; } | Gets address of 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. |
Height { get; } | Gets the width of a range in points. |
Hyperlinks { get; } | Gets all hyperlink in the range. |
Item { get; } | Gets Cell object in this range. |
Left { get; } | Gets the distance, in points, from the left edge of column A to the left edge of the 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 |
Top { get; } | Gets the distance, in points, from the top edge of row 1 to the top edge of the range. |
Value { get; set; } | Gets and sets the value of the range. |
Width { get; } | Gets the width of a range in points. |
Worksheet { get; } | Gets the Worksheet object which contains this range. |
Methods
Name | Description |
---|---|
AddHyperlink(string, string, string) | Adds a hyperlink to a specified cell or a range of cells. |
ApplyStyle(Style, StyleFlag) | Applies formats for a whole range. |
AutoFill(Range) | Automaticall fill the target range. |
AutoFill(Range, AutoFillType) | Automaticall fill the target range. |
Clear() | Clears this range. |
ClearComments() | Clears the comments of this range. |
ClearContents() | Clears the contents of this range. |
ClearFormats() | Clears the formats of this range. |
ClearHyperlinks(bool) | Only removes hyperlinks. |
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. |
IsBlank() | Indicates whether the range contains values. |
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, CellsColor) | Sets outline border around a range of cells. |
SetOutlineBorder(BorderType, CellBorderType, Color) | Sets outline border around a range of cells. |
SetOutlineBorders(CellBorderType, CellsColor) | Sets the outline borders around a range of cells with same border style and color. |
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. |
SetStyle(Style, bool) | Apply the cell style. |
ToHtml(HtmlSaveOptions) | Convert the range to html . |
ToImage(ImageOrPrintOptions) | Converts the range to image. |
ToJson(JsonSaveOptions) | Convert the range to JSON value. |
override ToString() | Returns a string represents the current Range object. |
Transpose() | Transpose (rotate) data from rows to columns or vice versa. |
Union(Range) | (Obsolete.) Returns the union of two ranges. |
UnionRang(Range) | (Obsolete.) Returns the union result of two ranges. |
UnionRanges(Range[]) | Returns the union result of two ranges. |
UnMerge() | Unmerges merged cells of this range. |
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.
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class CellsClassRangeDemo
{
public static void Run()
{
Workbook workbook = new Workbook();
Cells cells = workbook.Worksheets[0].Cells;
Aspose.Cells.Range range = cells.CreateRange("A1", "D3");
range.Value = "Hello";
workbook.Save("book1.xlsm");
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells