Class RefPtg
This token contains an unsigned 16-bit integer value in the range from 0 to 65535.
Inherited Members
Namespace: Syncfusion.XlsIO.Parser.Biff_Records.Formula
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
[Token(FormulaToken.tRef3)]
[Token(FormulaToken.tRef1)]
[Token(FormulaToken.tRef2)]
public class RefPtg : Ptg, ICloneable, IRangeGetterToken, IRangeGetter, IToken3D, IRectGetter
Constructors
RefPtg()
Default constructor: To prevent user from creating tokens without arguments and to allow descendants to do this.
Declaration
public RefPtg()
RefPtg(DataProvider, Int32, ExcelVersion)
Creates token using data from array of bytes.
Declaration
public RefPtg(DataProvider provider, int offset, ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
DataProvider | provider | Object that provides access to the data. |
System.Int32 | offset | Offset to the token data. |
ExcelVersion | version | Excel version that was used to infill data provider. |
RefPtg(RefPtg)
Declaration
public RefPtg(RefPtg twin)
Parameters
Type | Name | Description |
---|---|---|
RefPtg | twin |
RefPtg(Int32, Int32, Byte)
Creates token by coordinates and options.
Declaration
public RefPtg(int iRowIndex, int iColIndex, byte options)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | Row index. |
System.Int32 | iColIndex | Column index. |
System.Byte | options | Options. |
RefPtg(Int32, Int32, String, String, Boolean)
Constructs reference by its string representation.
Declaration
public RefPtg(int iCellRow, int iCellColumn, string strRow, string strColumn, bool bR1C1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCellRow | Row index of the cell that contains formula to parse. |
System.Int32 | iCellColumn | Column index of the cell that contains formula to parse. |
System.String | strRow | String representation of the row. |
System.String | strColumn | String representation of the column. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation was used. |
RefPtg(String)
Constructs reference by its string representation.
Declaration
public RefPtg(string strCell)
Parameters
Type | Name | Description |
---|---|---|
System.String | strCell | String representation of the reference. |
Fields
ColumnBitMask
Bit mask for column options.
Declaration
public const byte ColumnBitMask = 64
Field Value
Type | Description |
---|---|
System.Byte |
DEF_CLOSE_BRACKET
Closing bracket for relative indexes in R1C1 notation.
Declaration
public const char DEF_CLOSE_BRACKET = ']'
Field Value
Type | Description |
---|---|
System.Char |
DEF_OPEN_BRACKET
Opening bracket for relative indexes in R1C1 notation.
Declaration
public const char DEF_OPEN_BRACKET = '['
Field Value
Type | Description |
---|---|
System.Char |
DEF_R1C1_COLUMN
Starting column character in R1C1 notation.
Declaration
public const string DEF_R1C1_COLUMN = "C"
Field Value
Type | Description |
---|---|
System.String |
DEF_R1C1_ROW
Starting row character in R1C1 notation.
Declaration
public const string DEF_R1C1_ROW = "R"
Field Value
Type | Description |
---|---|
System.String |
RowBitMask
Bit mask for row options.
Declaration
public const byte RowBitMask = 128
Field Value
Type | Description |
---|---|
System.Byte |
Properties
ColumnIndex
Gets / sets index to column (0..255) or column offset (-128..127).
Declaration
public virtual int ColumnIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsColumnIndexRelative
Gets / sets True if column index is relative.
Declaration
public virtual bool IsColumnIndexRelative { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRowIndexRelative
Gets / sets True if row index is relative.
Declaration
public virtual bool IsRowIndexRelative { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Options
Options.
Declaration
protected byte Options { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
RowIndex
Gets / sets. Index to row (0..65535) or row offset (-32768..32767).
Declaration
[CLSCompliant(false)]
public virtual int RowIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
CodeToIndex()
Converts token code to index (inverse operation to IndexToCode).
Declaration
public virtual int CodeToIndex()
Returns
Type | Description |
---|---|
System.Int32 | Reference index. |
CodeToIndex(FormulaToken)
Converts token code to index (inverse operation to IndexToCode).
Declaration
public static int CodeToIndex(FormulaToken token)
Parameters
Type | Name | Description |
---|---|---|
FormulaToken | token | Token code (should be one of tRef1, tRef2, tRef3). |
Returns
Type | Description |
---|---|
System.Int32 | Reference index. |
ConvertPtgToNPtg(IWorkbook, Int32, Int32)
Converts tokens from regular formula into tokens from shared formula.
Declaration
public override Ptg ConvertPtgToNPtg(IWorkbook parent, int iRow, int iColumn)
Parameters
Type | Name | Description |
---|---|---|
IWorkbook | parent | Parent workbook. |
System.Int32 | iRow | Represents first row from cells range of shared formula.Zero-base. |
System.Int32 | iColumn | Represents first column from cells range of shared formula.Zero-based. |
Returns
Type | Description |
---|---|
Ptg | New token for shared formula. |
Overrides
ConvertToError()
Converts current token into error token.
Declaration
public virtual Ptg ConvertToError()
Returns
Type | Description |
---|---|
Ptg | Created token. |
Get3DToken(Int32)
Converts current token to the 3D token.
Declaration
public virtual Ptg Get3DToken(int iSheetReference)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iSheetReference | Reference to the worksheet. |
Returns
Type | Description |
---|---|
Ptg | Created token. |
GetA1ColumnIndex(String, out Boolean)
Returns column index of the cell.
Declaration
public static int GetA1ColumnIndex(string columnName, out bool bRelative)
Parameters
Type | Name | Description |
---|---|---|
System.String | columnName | String representation of the column. |
System.Boolean | bRelative | Indicates whether resulting column index is relative. |
Returns
Type | Description |
---|---|
System.Int32 | Column index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When parsed column index is greater than 255. |
GetA1RowIndex(String, out Boolean)
Returns row index of the cell.
Declaration
public static int GetA1RowIndex(string strRowName, out bool bRelative)
Parameters
Type | Name | Description |
---|---|---|
System.String | strRowName | String representation of the row. |
System.Boolean | bRelative | Indicates whether row index is relative. |
Returns
Type | Description |
---|---|
System.Int32 | Row index. |
GetCellName(Int32, Int32, Int32, Int32, Boolean, Boolean, Boolean)
Returns string representation of the cell.
Declaration
[CLSCompliant(false)]
public static string GetCellName(int iCurCellRow, int iCurCellColumn, int row, int column, bool bRowRelative, bool bColumnRelative, bool bR1C1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCurCellRow | Row index of the cell that contains token. |
System.Int32 | iCurCellColumn | Column index of the cell that contains token. |
System.Int32 | row | Index of cell row. |
System.Int32 | column | Index of cell column. |
System.Boolean | bRowRelative | True if row is relative. |
System.Boolean | bColumnRelative | True if column is relative. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation must be used for string conversion. |
Returns
Type | Description |
---|---|
System.String | String representation of the cell address. |
GetColumnIndex(Int32, String, Boolean, out Boolean)
Returns column index of the cell.
Declaration
public static int GetColumnIndex(int iCellColumn, string columnName, bool bR1C1, out bool bRelative)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCellColumn | Column index of the cell that contains token. |
System.String | columnName | String representation of the column. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation is used. |
System.Boolean | bRelative | Indicates whether resulting column index is relative. |
Returns
Type | Description |
---|---|
System.Int32 | Column index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When parsed column index is greater than 255. |
GetCorrespondingErrorCode()
Gets corresponding error code.
Declaration
public virtual FormulaToken GetCorrespondingErrorCode()
Returns
Type | Description |
---|---|
FormulaToken | Corresponding error code. |
GetR1C1CellName(Int32, Int32, Int32, Int32, Boolean, Boolean)
Gets string representation of the cell in R1C1 notation.
Declaration
public static string GetR1C1CellName(int iCurRow, int iCurColumn, int row, int column, bool bRowRelative, bool bColumnRelative)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCurRow | Row index of the cell that contains token. |
System.Int32 | iCurColumn | Column index of the cell that contains token. |
System.Int32 | row | Cell row index. |
System.Int32 | column | Cell column index. |
System.Boolean | bRowRelative | Indicates whether row is relative. |
System.Boolean | bColumnRelative | Indicates whether column is relative. |
Returns
Type | Description |
---|---|
System.String | String representation of the cell in R1C1 notation. |
GetR1C1Index(Int32, String, out Boolean)
Parses row or column index in R1C1 notation.
Declaration
public static int GetR1C1Index(int iIndex, string strValue, out bool bRelative)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iIndex | Row or column index of the cell that contains reference. |
System.String | strValue | String to parse. |
System.Boolean | bRelative | Indicates whether index is relative. |
Returns
Type | Description |
---|---|
System.Int32 |
GetR1C1Name(Int32, String, Int32, Boolean)
Converts row or column index into string representation using R1C1 notation.
Declaration
public static string GetR1C1Name(int iCurIndex, string strStart, int iIndex, bool bIsRelative)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCurIndex | Row or column index of a cell that contains reference to convert. |
System.String | strStart | Starting character. |
System.Int32 | iIndex | End index. |
System.Boolean | bIsRelative | Indicates whether index is relative. |
Returns
Type | Description |
---|---|
System.String | String representation of row or column index using R1C1 notation. |
GetRange(IWorkbook, IWorksheet)
Returns range represented by the token that implements this interface.
Declaration
public IRange GetRange(IWorkbook book, IWorksheet sheet)
Parameters
Type | Name | Description |
---|---|---|
IWorkbook | book | Workbook that contains range. |
IWorksheet | sheet | Worksheet that contains range. |
Returns
Type | Description |
---|---|
IRange | Range represented by the token. |
GetRCCellName(Int32, Int32)
Return string representation of the cell in RC format. RC format is format in which set only shifts from start row to other one.
Declaration
public static string GetRCCellName(int column, int row)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | column | Index of cell column. |
System.Int32 | row | Index of cell row. |
Returns
Type | Description |
---|---|
System.String | String representation of the cell address. |
GetRectangle()
Returns rectangle represented by the token that implements this interface. All coordinates are zero-based.
Declaration
public Rectangle GetRectangle()
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Rectangle represented by the token. |
GetRowIndex(Int32, String, Boolean, out Boolean)
Returns row index of the cell.
Declaration
public static int GetRowIndex(int iCellRow, string strRowName, bool bR1C1, out bool bRelative)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCellRow | Row index of the cell that contains token. |
System.String | strRowName | String representation of the row. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation is used. |
System.Boolean | bRelative | Indicates whether row index is relative. |
Returns
Type | Description |
---|---|
System.Int32 | Row index. |
GetSize(ExcelVersion)
Read-only. Size of the record.
Declaration
public override int GetSize(ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
ExcelVersion | version |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
IndexToCode(Int32)
Converts reference index to token code.
Declaration
public static FormulaToken IndexToCode(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Reference index. |
Returns
Type | Description |
---|---|
FormulaToken | Token code. |
InfillPTG(DataProvider, ref Int32, ExcelVersion)
Infill PTG structure.
Declaration
public override void InfillPTG(DataProvider provider, ref int offset, ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
DataProvider | provider | Represents storage. |
System.Int32 | offset | Offset in storage. |
ExcelVersion | version | Excel version that was used to infill data provider. |
Overrides
IsRelative(Byte, Byte)
Returns True if bit specified by mask is set to 1; otherwise False.
Declaration
public static bool IsRelative(byte Options, byte mask)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | Options | Options byte where bits will be checked. |
System.Byte | mask | Bit mask that should be used for checking. |
Returns
Type | Description |
---|---|
System.Boolean | True if bit specified by mask is set to 1. |
MoveIntoDifferentSheet(RefPtg, Int32, Rectangle, Int32, Int32, Int32, WorkbookImpl)
Moves token into different worksheet.
Declaration
protected virtual Ptg MoveIntoDifferentSheet(RefPtg result, int iSourceSheetIndex, Rectangle rectSource, int iDestSheetIndex, int iRowOffset, int iColOffset, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
RefPtg | result | Token to move |
System.Int32 | iSourceSheetIndex | Source sheet index. |
System.Drawing.Rectangle | rectSource | Source rectangle. |
System.Int32 | iDestSheetIndex | Destination sheet index. |
System.Int32 | iRowOffset | Row offset. |
System.Int32 | iColOffset | Column offset. |
WorkbookImpl | book | Parent workbook. |
Returns
Type | Description |
---|---|
Ptg | Modified token. |
Offset(Int32, Int32, WorkbookImpl)
Creates token and modifies it row and column indexes.
Declaration
public override Ptg Offset(int iRowOffset, int iColumnOffset, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowOffset | Row offset. |
System.Int32 | iColumnOffset | Column offset. |
WorkbookImpl | book | Parent workbook. |
Returns
Type | Description |
---|---|
Ptg | Modified token. |
Overrides
Offset(Int32, Int32, Int32, Int32, Rectangle, Int32, Rectangle, out Boolean, WorkbookImpl)
Returns modified token after move operation.
Declaration
public override Ptg Offset(int iCurSheetIndex, int iTokenRow, int iTokenColumn, int iSourceSheetIndex, Rectangle rectSource, int iDestSheetIndex, Rectangle rectDest, out bool bChanged, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCurSheetIndex | Current sheet index. |
System.Int32 | iTokenRow | Parent cell row index. |
System.Int32 | iTokenColumn | Parent cell column index. |
System.Int32 | iSourceSheetIndex | Source sheet index. |
System.Drawing.Rectangle | rectSource | Source rectangle. |
System.Int32 | iDestSheetIndex | Destination sheet index. |
System.Drawing.Rectangle | rectDest | Destination rectangle. |
System.Boolean | bChanged | Indicates whether token was changed. |
WorkbookImpl | book | Parent workbook. |
Returns
Type | Description |
---|---|
Ptg |
Overrides
SetCell(Int32, Int32, String, String, Boolean)
Sets internal fields appropriate to specified row and column.
Declaration
protected void SetCell(int iCellRow, int iCellColumn, string strRow, string strColumn, bool bR1C1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCellRow | Row index of the cell that contains this token. |
System.Int32 | iCellColumn | Column index of the cell that contains this token. |
System.String | strRow | String that contains row name. |
System.String | strColumn | String that contains column name. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation is used. |
SetCellA1(String, String)
Sets internal fields appropriate to specified row and column.
Declaration
protected void SetCellA1(string strColumn, string strRow)
Parameters
Type | Name | Description |
---|---|---|
System.String | strColumn | String that contains column name. |
System.String | strRow | String that contains row name. |
SetCellR1C1(Int32, Int32, String, String)
Sets internal fields appropriate to specified row and column.
Declaration
protected void SetCellR1C1(int iCellRow, int iCellColumn, string column, string row)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCellRow | Row index of the cell that contains this token. |
System.Int32 | iCellColumn | Column index of the cell that contains this token. |
System.String | column | String that contains column name. |
System.String | row | String that contains row name. |
SetRelative(Byte, Byte, Boolean)
If value is True, then it sets all bits specified by mask in Options to 1; otherwise clears them, return new value.
Declaration
public static byte SetRelative(byte Options, byte mask, bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | Options | Options byte where bits will be set. |
System.Byte | mask | Bit mask that should be used for checking. |
System.Boolean | value | Flag for operation. |
Returns
Type | Description |
---|---|
System.Byte | Return Options with bit specified by mask set to value. |
ToByteArray(ExcelVersion)
Converts token to array of bytes.
Declaration
public override byte[] ToByteArray(ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
ExcelVersion | version |
Returns
Type | Description |
---|---|
System.Byte[] | Array of bytes that represents the token. |
Overrides
ToString()
Converts token to a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of the token. |
Overrides
ToString(FormulaUtil, Int32, Int32, Boolean, NumberFormatInfo, Boolean)
Converts token to a string.
Declaration
public override string ToString(FormulaUtil formulaUtil, int iRow, int iColumn, bool bR1C1, NumberFormatInfo numberFormat, bool isForSerialization)
Parameters
Type | Name | Description |
---|---|---|
FormulaUtil | formulaUtil | Formula util. |
System.Int32 | iRow | Zero-based row index of the cell that contains this token. |
System.Int32 | iColumn | Zero-based row index of the cell that contains this token. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation should be used. |
System.Globalization.NumberFormatInfo | numberFormat | |
System.Boolean | isForSerialization |
Returns
Type | Description |
---|---|
System.String | String representation of this token. |
Overrides
UpdateRectangle(Rectangle)
Declaration
public Ptg UpdateRectangle(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rectangle |
Returns
Type | Description |
---|---|
Ptg |