Class GridRangeInfo
Defines a range of cells in the grid. Possible range types are: Row(s), Column(s), Cell(s), Table or Empty. GridRangeInfo is immutable.
Implements
Inherited Members
Namespace: Syncfusion.Olap.Engine
Assembly: Syncfusion.Olap.Base.dll
Syntax
public class GridRangeInfo : IFormattable, ICloneable, ISerializable
Constructors
GridRangeInfo()
Initializes a new instance of the GridRangeInfo class.
Declaration
public GridRangeInfo()
Remarks
This constructor initializes a new GridRangeInfo object with empty range type.
GridRangeInfo(SerializationInfo, StreamingContext)
Initializes a new GridRangeInfo from a serialization stream.
Declaration
protected GridRangeInfo(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | An object that holds all the data needed to serialize or de-serialize this instance. |
System.Runtime.Serialization.StreamingContext | context | Describes the source and destination of the serialized stream specified by the information. |
Fields
DelimitSign
Represents the delimiter sign.
Declaration
public const char DelimitSign = '-'
Field Value
Type |
---|
System.Char |
Empty
Represents a GridRangeInfo with its properties left uninitialized and range type set to GridRangeInfoType.Empty.
Declaration
public static readonly GridRangeInfo Empty
Field Value
Type |
---|
GridRangeInfo |
Remarks
A range is defined by its coordinates and range type. If uninitialized, the range type is GridRangeInfoType.Empty
Properties
Bottom
Gets or sets the row index of the bottom-right corner of the cell range.
Declaration
public int Bottom { get; }
Property Value
Type |
---|
System.Int32 |
Height
Gets the height of the range defined by this GridRangeInfo.
Declaration
public int Height { get; }
Property Value
Type |
---|
System.Int32 |
Info
Gets the grid range information as string.
Declaration
public string Info { get; }
Property Value
Type |
---|
System.String |
IsCells
Gets or sets a value indicating whether it a range of individual cells.
Declaration
public bool IsCells { get; }
Property Value
Type |
---|
System.Boolean |
IsCols
Gets or sets a value indicating whether it represents a range of columns.
Declaration
public bool IsCols { get; }
Property Value
Type |
---|
System.Boolean |
IsEmpty
Indicates whether this GridRangeInfo has a GridRangeInfoType of Empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if GridRangeInfoType is Empty; otherwise, false. |
IsRows
Gets or sets a value indicating whether it represents a range of rows.
Declaration
public bool IsRows { get; }
Property Value
Type |
---|
System.Boolean |
IsTable
Gets or sets a value indicating whether it represents a table.
Declaration
public bool IsTable { get; }
Property Value
Type |
---|
System.Boolean |
Left
Gets or sets the column index of the upper-left corner of the cell range.
Declaration
public int Left { get; }
Property Value
Type |
---|
System.Int32 |
RangeType
Gets or sets the GridRangeInfoType of this GridRangeInfo object.
Declaration
public GridRangeInfoType RangeType { get; }
Property Value
Type |
---|
GridRangeInfoType |
Right
Gets or sets the column index of the bottom-right corner of the cell range.
Declaration
public int Right { get; }
Property Value
Type |
---|
System.Int32 |
Top
Gets or sets the row index of the upper-left corner of the cell range.
Declaration
public int Top { get; }
Property Value
Type |
---|
System.Int32 |
Width
Gets the width of the range defined by this GridRangeInfo.
Declaration
public int Width { get; }
Property Value
Type |
---|
System.Int32 |
Methods
Auto(Int32, Int32)
Creates a new GridRangeInfo object for the specified row and column.
Declaration
public static GridRangeInfo Auto(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. It can be specified with -1 to create a range of columns or whole table. |
System.Int32 | colIndex | The column index. It can be specified with -1 to create a range of rows or whole table. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Remarks
If both row and column index are less than zero, a table will be created. If row index is less than zero and column index greater or equal to zero, a column range will be created. If row index is greater or equal to zero and column index less than zero, a row range will be created. Otherwise a cell range is created.
Auto(Int32, Int32, Int32, Int32)
Creates a new GridRangeInfo object for the specified rows and columns.
Declaration
public static GridRangeInfo Auto(int top, int left, int bottom, int right)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index. -1 to create a range of columns or whole table. |
System.Int32 | left | The column index. -1 to create a range of rows or whole table. |
System.Int32 | bottom | The bottom row index. |
System.Int32 | right | The right column index. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Remarks
If both row and column index are less than zero, a table will be created. If row index is less than zero and column index greater or equal to zero, a column range will be created. If row index is greater or equal to zero and column index less than zero, a row range will be created. Otherwise a cell range is created.
Cell(Int32, Int32)
Creates a new GridRangeInfo object for the specified row and column index.
Declaration
public static GridRangeInfo Cell(int row, int col)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row index. |
System.Int32 | col | The column index. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Cells(Int32, Int32, Int32, Int32)
Creates a new GridRangeInfo object with the specified bounds.
Declaration
public static GridRangeInfo Cells(int top, int left, int bottom, int right)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index of the upper-left corner of the cell range. |
System.Int32 | left | The column index of the upper-left corner of the cell range. |
System.Int32 | bottom | The row index of the bottom-right corner of the cell range. |
System.Int32 | right | The column index of the bottom-right corner of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Clone()
Creates an exact copy of this GridRangeInfo object.
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System.Object | The copy of GridRangeInfo object. |
Col(Int32)
Creates a new GridRangeInfo object for the specified column.
Declaration
public static GridRangeInfo Col(int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | colIndex | The column index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Cols(Int32, Int32)
Creates a new GridRangeInfo object for the specified columns.
Declaration
public static GridRangeInfo Cols(int left, int right)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | left | The left column index of the cell range. |
System.Int32 | right | The right column index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Compare(GridRangeInfo, GridRangeInfo)
Compares two range objects.
Declaration
public static bool Compare(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | The range to compare. |
GridRangeInfo | r2 | The range to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if both the ranges are equal; otherwise, false. |
Contains(GridRangeInfo)
Determines if this range contains the specified range
.
Declaration
public bool Contains(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range to be searched for. |
Returns
Type | Description |
---|---|
System.Boolean |
|
CopyAllMembers(GridRangeInfo)
Copies all members.
Declaration
protected void CopyAllMembers(GridRangeInfo rg)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | rg | The grid range information. |
EmptyRange()
Returns Empty that is an empty range.
Declaration
public static GridRangeInfo EmptyRange()
Returns
Type | Description |
---|---|
GridRangeInfo | An empty range object. |
Equals(Object)
Checks whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to be checked. |
Returns
Type | Description |
---|---|
System.Boolean | A value that indicates whether it is equal or not. |
Overrides
ExpandRange(Int32, Int32, Int32, Int32)
Converts the column and row ranges into cell ranges with the specified bounds. (Could also be done through IntersectRange ... if nFirstRow >= nFirstCol >= 0).
Declaration
public GridRangeInfo ExpandRange(int nFirstRow, int nFirstCol, int nRowCount, int nColCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nFirstRow | The row index for the first non-label cell in grid area. |
System.Int32 | nFirstCol | The column index for the first non-label cell in grid area. |
System.Int32 | nRowCount | The last row in the grid. |
System.Int32 | nColCount | The last column in the grid |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Remarks
Column ranges will be converted to cell ranges using nFirstRow and nRowCount. Row ranges will be converted to cell ranges using nFirstCol and nColCount. Column ranges will be converted to cell ranges using all input parameters.
FromTlhw(Int32, Int32, Int32, Int32)
Creates a new GridRangeInfo object with the specified bounds.
Declaration
public static GridRangeInfo FromTlhw(int top, int left, int height, int width)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index of the upper-left corner of the cell range. |
System.Int32 | left | The column index of the upper-left corner of the cell range. |
System.Int32 | height | The number of rows to span. |
System.Int32 | width | The number of columns to span. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
GetAlphaLabel(Int32)
Returns a string in the format of "A, B, C, ... AA, AB ..." which is to be used for column labels.
Declaration
public static string GetAlphaLabel(int nCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nCol | The column index. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column label for the column index. |
GetFirstCell(out Int32, out Int32)
Enumerates through all cells in the range object.
Declaration
public bool GetFirstCell(out int top, out int left)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index of the upper-left corner of the cell range. |
System.Int32 | left | The column index of the upper-left corner of the cell range. |
Returns
Type | Description |
---|---|
System.Boolean | This method returns the first cell in the range. |
GetHashCode()
Gets the hash code of grid range information.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
Overrides
GetNextCell(ref Int32, ref Int32)
Returns whether the adjacent cell is in the range for the given row and column index.
Declaration
public bool GetNextCell(ref int nRow, ref int nCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nRow | The row index. |
System.Int32 | nCol | The column index. |
Returns
Type | Description |
---|---|
System.Boolean | true if an adjacent cell in this GridRangeInfo object could be found; otherwise, false. |
GetNextCell(ref Int32, ref Int32, Boolean)
Returns whether the adjacent cell is in the range for the given row and column index.
Declaration
public bool GetNextCell(ref int nRow, ref int nCol, bool bSortByRow)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nRow | The row index. |
System.Int32 | nCol | The column index. |
System.Boolean | bSortByRow | Indicates whether the range should be traversed by row or column. |
Returns
Type | Description |
---|---|
System.Boolean | true if an adjacent cell in this GridRangeInfo object could be found; otherwise, false. |
GetNumericLabel(Int32)
Returns a numeric string in the numeric format to be used for row labels.
Declaration
public static string GetNumericLabel(int nRow)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nRow | The row index. |
Returns
Type | Description |
---|---|
System.String | A string that contains the row label for the row index. |
GetObjectData(SerializationInfo, StreamingContext)
Implements the ISerializable interface and returns the data needed to serialize the GridRangeInfo.
Declaration
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | A SerializationInfo object containing the information required to serialize the object. |
System.Runtime.Serialization.StreamingContext | context | A StreamingContext object containing the source and destination of the serialized stream. |
IntersectRange(GridRangeInfo)
Creates a new GridRangeInfo with the intersection of itself and the specified GridRangeInfo.
Declaration
public GridRangeInfo IntersectRange(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The GridRangeInfo with which to intersect. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Examples
The following example creates two GridRangeInfo objects and creates a GridRangeInfo with their intersection.
GridRangeInfo firstRange = new GridRangeInfo(0, 0, 100, 100);
IntersectRange(GridRangeInfo, GridRangeInfo)
Creates a new GridRangeInfo with the intersection of two GridRangeInfo parameters.
Declaration
public static GridRangeInfo IntersectRange(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | The first GridRangeInfo with which to intersect. |
GridRangeInfo | r2 | The second GridRangeInfo with which to intersect. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Examples
The following example creates two GridRangeInfo objects and creates a GridRangeInfo with their intersection.
GridRangeInfo firstRange = new GridRangeInfo(0, 0, 100, 100);
IntersectsWith(GridRangeInfo)
Determines if this range intersects with range
.
Declaration
public bool IntersectsWith(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range to check. |
Returns
Type | Description |
---|---|
System.Boolean | true only if there is any intersection. otherwise false. |
Examples
The following example creates two cell ranges and tests whether they intersect.
GridRangeInfo firstRange = new GridRangeInfo(1, 1, 100, 100);
OffsetRange(Int32, Int32)
Adjusts the location of this range by the specified amount.
Declaration
public GridRangeInfo OffsetRange(int rowOffset, int colOffset)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowOffset | The amount of rows to offset the location. |
System.Int32 | colOffset | The amount of columns to offset the location. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Parse(String)
Creates a range object from a string.
Declaration
public static GridRangeInfo Parse(string parseText)
Parameters
Type | Name | Description |
---|---|---|
System.String | parseText | The text with text representation of the range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The GridRangeInfo with coordinates specified in the string. |
Remarks
The method parses a string that was previously created with ToString().
The string should be in the format R#C#, R#, C#, T.
An example for a range of cells is "R1C1:R10C20" or "R5C5".
An example for a range of rows is "R1:R10" or "R6".
An example for a range of columns is "C1:C10" or "C7".
An example for a table range is "T".
Row(Int32)
Creates a new GridRangeInfo object for the specified row index.
Declaration
public static GridRangeInfo Row(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Rows(Int32, Int32)
Creates a new GridRangeInfo object for the specified rows.
Declaration
public static GridRangeInfo Rows(int top, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The top row index of the cell range. |
System.Int32 | bottom | The bottom row index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Table()
Creates a new GridRangeInfo object for the whole table.
Declaration
public static GridRangeInfo Table()
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
ToString()
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
Overrides
Remarks
The generate string will be in the format R#C#, R#, C#, T.
An example for a range of cells is "R1C1:R10C20" or "R5C5".
An example for a range of rows is "R1:R10" or "R6".
An example for a range of columns is "C1:C10" or "C7".
An example for a table range is "T".
ToString(IFormatProvider)
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public string ToString(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | provider | The System.IFormatProvider to use to format the value. Is ignored. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
ToString(String)
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
ToString(String, IFormatProvider)
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | The format. |
System.IFormatProvider | formatProvider | The System.IFormatProvider to use to format the value. Is ignored. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
UnionRange(GridRangeInfo)
Creates a GridRangeInfo that represents the union of itself and another range.
Declaration
public GridRangeInfo UnionRange(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | A range to union. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
UnionRange(GridRangeInfo, GridRangeInfo)
Creates a GridRangeInfo that represents the union of two ranges.
Declaration
public static GridRangeInfo UnionRange(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | A range to union. |
GridRangeInfo | r2 | A range to union. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Operators
Equality(GridRangeInfo, GridRangeInfo)
Returns a value that represents whether the specified ranges are equal.
Declaration
public static bool operator ==(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | A range to check. |
GridRangeInfo | r2 | A range to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if both the ranges are equal; otherwise, false. |
Inequality(GridRangeInfo, GridRangeInfo)
Returns a value that represents whether the specified ranges are not equal.
Declaration
public static bool operator !=(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | A range to check. |
GridRangeInfo | r2 | A range to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if both the ranges are not equal; otherwise, false. |