ExcelRange Class

Represents a range of cells in a worksheet

Definition

Namespace: Winnovative.ExcelLib
Assembly: WnvXls_NetCore (in WnvXls_NetCore.dll) Version: 11.0.0
C#
public class ExcelRange
Inheritance
Object    ExcelRange

Properties

Address Gets the range reference in A1 notation and in the language of the macro.
BooleanValue Gets or sets the boolean value of the range. Returns false if the range cells don't contain a boolean value or the boolean value is not the same in all the cells. Setting this property has the same effect as setting the Value property with a Boolean value.
BottomRowIndex Returns the zero based index of the last row of the specified range.
Cells Gets the cells in this range.
Columns Gets an array of ExcelRangeColumn objects representing the columns in this specified range.
ColumnWidthInChars Gets or sets the width in characters of the columns in the range.
Comment Gets the comment of this range or null if no comment was assigned to this range. The range is expected to contain a single cell otherwise the comment of the top left cell of the range will be returned.
Count Gets the number of cells in range
DataValidator Gets the data validator object of this range.
DateTimeValue Gets or sets the DateTime value of the range. Returns DateTime.MinValue if the range cells don't contain a DateTime or the DateTime value is not the same in all the cells. Setting this property has the same effect as setting the Value property with a DateTime value.
ErrorValue Gets or sets the error of this range. Returns null if the range cells don't contain an error value or the error value is not the same in all the cells. When this property is set with a string value which is not an error string an exception will be thrown.
Formula Gets or sets the formula of the range in A1 notation.
FormulaArray Gets or sets array formula of the range in A1 notation.
FormulaArrayR1C1 Gets or sets array formula of the range in A1 notation.
FormulaR1C1 Gets or sets the formula of the range in R1C1 notation.
FormulaResultBooleanValue Gets or sets the calculated result of the formula of this range as a Boolean value.
FormulaResultDateTimeValue Gets or sets the calculated result of the formula of this range as a DateTime value.
FormulaResultErrorValue Gets or sets the calculated result of the formula of this range as an Error value.
FormulaResultNumberValue Gets or sets the calculated result of the formula of this range as a Double value.
FormulaResultText Gets or sets the calculated result of the formula of this range as a String value.
FormulaResultValue Gets or sets the calculated result of the formula of this range.
HasDataValidator Gets a value indicating if the range has a data validator.
HasDefaultStyle Gets a value indicating if the specified range was set with a style different from the default style. True means all the range cells have the default style.
Hyperlinks Gets the collection of hyperlinks of this range
IsArrayFormula Gets a flag indicating if all the cells in the range contain an array formula.
IsBoolean Gets a flag indicating if all the cells in the range are of boolean type.
IsEmpty Gets a flag indicating if all the cells in the range are empty.
IsError Gets a flag indicating if all the cells in the range contain an error string.
IsFormula Gets a flag indicating if all the cells in the range contain a formula.
IsFormulaResultBoolean Gets a flag indicating if the result of the formulas in all the cells in the range are of Boolean type.
IsFormulaResultError Gets a flag indicating if the result of the formulas in all the cells in the range are of Error type.
IsFormulaResultNumber Gets a flag indicating if the result of the formulas in all the cells in the range are of Double type.
IsFormulaResultString Gets a flag indicating if the result of the formulas in all the cells in the range are of String type.
IsNumber Gets a flag indicating if all the cells in the range are of number type.
IsString Gets a flag indicating if all the cells in the range are of string type.
LeftColumnIndex Returns the zero based index of the first column of the specified range.
MergeArea Gets a merged Range object containing the specified cell or null if the specified cell is not part of a merged range
NumberValue Gets or sets the number value of the range. Returns Double.Nan if the range cells don't contain a number or the number value is not the same in all the cells. Setting this property has the same effect as setting the Value property with a Double value.
RightColumnIndex Returns the zero based index of the last column of the specified range.
RowHeightInPoints Gets or sets the height in points of the rows in the range.
Rows Gets an array of Range objects representing the rows in this specified range.
Style Gets or sets the style of the cell or range of cells. The property can be assigned with an existing style from the workbook styles collection. The returned object can be used to set the Number, Borders, Font, Fill, Allignment and Protection options.
StyleName Gets or sets the name of the style of the cell or range of cells. This can be the name of a user defined style or a predefined style.
Text Gets or sets the string value of the range. Returns null if the cell does not contain text or the text is not the same in all the rane cells.
TopRowIndex Returns the zero based index of the first row of the specified range.
Value Gets or sets the cell value as an object. The setter will determine the value type (Boolean, DateTime or Number) from the specified object type. If it's not one these types range will be set with a Text value. If you simply want to set the range with a text you can use the Text property of the Range object. If you want to set a range with a formula string you can use the Formula or FormulaArray properties. If you want to set a range with an Error value you can use the ErrorValue property. If you want to disable the parsing of the string values and simply set the cell value to the specified string you can set ExcelWorksheet.ParseValueString = false.
Worksheet Gets the worksheet of this range

Methods

AddComment Adds the comment with the specified text to this range. The range is expected to contain a single cell otherwise the comment will be placed on the top left cell of the range.
AutofitColumns Changes the width of the range columns to achieve the best fit for the cells content.
AutofitRows Changes the height of the range rows to achieve the best fit for the cells content.
Clear Clears the range content and the cells formatting
ClearContents Clears the range content but leaves the cells formatting
Copy Copies this range to the specified destination range.
Delete Deletes the cell in the range and shifts cells up to replace the deleted cells.
Delete(ExcelDeleteShiftDirection) Deletes the cell in the range and shifts cells in the specified direction to replace the deleted cells.
Equals
(Inherited from Object)
Finalize
(Inherited from Object)
FreezePanes Freezes panes to keep row and column labels visible when the worksheet is scrolled. To lock rows select the row below where you want the freeze to appear (e.g. The range "A5" will freeze the rows from 1 to 4). To lock columns select the column to the right of where you want the split to appear (e.g. The range "D1" will freeze the columns A, B and C). To lock both rows and columns select the cell below and to the right of where you want the split to appear (e.g. The range "D5" will freeze the rows from 1 to 4 and the columns A, B and C).
GetHashCode
(Inherited from Object)
GetType
(Inherited from Object)
Group(ExcelGroupBy) Groups the range by rows or columns function of the groupBy parameter.
Group(ExcelGroupBy, Boolean) Groups the range by rows or columns function of the groupBy parameter.
MemberwiseClone
(Inherited from Object)
Merge Merge the cells in this range in a merged area.
Move Moves the range to the specified destination range.
ToString
(Inherited from Object)
UnGroup Ungroups the range.
UnMerge Separates a merged range into individual cells.

See Also