Aspose::Cells::Range class
Contents
[
Hide
]Range class
Encapsulates the object that represents a range of cells within a spreadsheet.
class Range
Methods
| Method | Description | 
|---|---|
| AddHyperlink(const U16String& address, const U16String& textToDisplay, const U16String& screenTip) | Adds a hyperlink to a specified cell or a range of cells. | 
| AddHyperlink(const char16_t* address, const char16_t* textToDisplay, const char16_t* screenTip) | Adds a hyperlink to a specified cell or a range of cells. | 
| ApplyStyle(const Style& style, const StyleFlag& flag) | Applies formats for a whole range. | 
| AutoFill(const Range& target) | Automaticall fill the target range. | 
| AutoFill(const Range& target, AutoFillType 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 clearFormat) | Only removes hyperlinks. | 
| Copy(const Range& range, const PasteOptions& options) | Copying the range with paste special options. | 
| Copy(const Range& range) | Copies data (including formulas), formatting, drawing objects etc. from a source range. | 
| CopyData(const Range& range) | Copies cell data (including formulas) from a source range. | 
| CopyStyle(const Range& range) | Copies style settings from a source range. | 
| CopyValue(const Range& range) | Copies cell value from a source range. | 
| Get(int32_t rowOffset, int32_t columnOffset) | Gets Cell object in this range. | 
| GetAddress() | Gets address of the range. | 
| GetCellOrNull(int32_t rowOffset, int32_t columnOffset) | Gets Cell object or null in this range. | 
| GetColumnCount() | Gets the count of columns in the range. | 
| GetColumnWidth() | Sets or gets the column width of this 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. | 
| GetEntireColumn() | Gets a Range object that represents the entire column (or columns) that contains the specified range. | 
| GetEntireRow() | Gets a Range object that represents the entire row (or rows) that contains the specified range. | 
| GetEnumerator() | Gets the enumerator for cells in this Range. | 
| GetFirstColumn() | Gets the index of the first column of the range. | 
| GetFirstRow() | Gets the index of the first row of the range. | 
| GetHeight() | Gets the width of a range in points. | 
| GetHyperlinks() | Gets all hyperlink in the range. | 
| GetLeft() | Gets the distance, in points, from the left edge of column A to the left edge of the range. | 
| GetName() | Gets or sets the name of the range. | 
| GetOffset(int32_t rowOffset, int32_t columnOffset) | Gets Range range by offset. | 
| GetRefersTo() | Gets the range’s refers to. | 
| GetRowCount() | Gets the count of rows in the range. | 
| GetRowHeight() | Sets or gets the height of rows in this range. | 
| GetTop() | Gets the distance, in points, from the top edge of row 1 to the top edge of the range. | 
| GetValue() | Gets and sets the value of the range. | 
| GetWidth() | Gets the width of a range in points. | 
| GetWorksheet() | Gets the Worksheetobject which contains this range. | 
| Intersect(const Range& range) | Returns a Range object that represents the rectangular intersection of two ranges. | 
| IsBlank() | Indicates whether the range contains values. | 
| IsIntersect(const Range& range) | Indicates whether the range is intersect. | 
| IsNull() const | Checks whether the implementation object is nullptr. | 
| Merge() | Combines a range of cells into a single cell. | 
| MoveTo(int32_t destRow, int32_t destColumn) | Move the current range to the dest range. | 
| explicit operator bool() const | operator bool() | 
| operator=(const Range& src) | operator= | 
| PutValue(const U16String& stringValue, bool isConverted, bool 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. | 
| PutValue(const char16_t* stringValue, bool isConverted, bool 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. | 
| Range(Range_Impl* impl) | Constructs from an implementation object. | 
| Range(const Range& src) | Copy constructor. | 
| SetColumnWidth(double value) | Sets or gets the column width of this range. | 
| SetInsideBorders(BorderType borderEdge, CellBorderType lineStyle, const CellsColor& borderColor) | Set inside borders of the range. | 
| SetName(const U16String& value) | Gets or sets the name of the range. | 
| SetName(const char16_t* value) | Gets or sets the name of the range. | 
| SetOutlineBorder(BorderType borderEdge, CellBorderType borderStyle, const CellsColor& borderColor) | Sets outline border around a range of cells. | 
| SetOutlineBorder(BorderType borderEdge, CellBorderType borderStyle, const Aspose::Cells::Color& borderColor) | Sets outline border around a range of cells. | 
| SetOutlineBorders(CellBorderType borderStyle, const CellsColor& borderColor) | Sets the outline borders around a range of cells with same border style and color. | 
| SetOutlineBorders(CellBorderType borderStyle, const Aspose::Cells::Color& borderColor) | Sets the outline borders around a range of cells with same border style and color. | 
| SetOutlineBorders(const Vector <CellBorderType>& borderStyles, const Vector <Aspose::Cells::Color>& borderColors) | Sets out line borders around a range of cells. | 
| SetRowHeight(double value) | Sets or gets the height of rows in this range. | 
| SetStyle(const Style& style, bool explicitFlag) | Apply the cell style. | 
| SetStyle(const Style& style) | Sets the style of the range. | 
| SetValue(const Aspose::Cells::Object& value) | Gets and sets the value of the range. | 
| ToHtml(const HtmlSaveOptions& saveOptions) | Convert the range to html . | 
| ToImage(const ImageOrPrintOptions& options) | Converts the range to image. | 
| ToJson(const JsonSaveOptions& options) | Convert the range to JSON value. | 
| ToString() | Returns a string represents the current Range object. | 
| Transpose() | Transpose (rotate) data from rows to columns or vice versa. | 
| UnionRang(const Range& range) | (Deprecated) Returns the union result of two ranges. | 
| UnionRanges(const Vector <Range>& ranges) | Returns the union result of two ranges. | 
| UnMerge() | Unmerges merged cells of this range. | 
| ~Range() | Destructor. | 
Fields
| Field | Description | 
|---|---|
| _impl | The implementation object. | 
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
Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
// Get the first Worksheet Cells.
Cells cells = workbook.GetWorksheets().Get(0).GetCells();
// Create a range (A1:D3).
Range range = cells.CreateRange(u"A1", u"D3");
//Save the Excel file
workbook.Save(u"book1.xlsm");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells
 - Library Aspose.Cells for C++