Class Ptg
This class is the base class for each token of a formula.
Inheritance
Implements
Namespace: Syncfusion.XlsIO.Parser.Biff_Records.Formula
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public abstract class Ptg : Object, ICloneable
Constructors
Ptg()
Default constructor.
Declaration
protected Ptg()
Ptg(DataProvider, Int32, ExcelVersion)
Creates token using data from an array of bytes.
Declaration
protected Ptg(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. |
Properties
IsOperation
Read-only. True if this ptg represents operation ptg.
Declaration
public virtual bool IsOperation { get; }
Property Value
Type |
---|
System.Boolean |
TokenCode
Gets / sets. Code of the token.
Declaration
public virtual FormulaToken TokenCode { get; set; }
Property Value
Type |
---|
FormulaToken |
Methods
Clone()
Declaration
public object Clone()
Returns
Type |
---|
System.Object |
CompareArrays(Ptg[], Ptg[])
Compares two token arrays.
Declaration
public static bool CompareArrays(Ptg[] arrTokens1, Ptg[] arrTokens2)
Parameters
Type | Name | Description |
---|---|---|
Ptg[] | arrTokens1 | The first array to compare. |
Ptg[] | arrTokens2 | The second array to compare. |
Returns
Type | Description |
---|---|
System.Boolean | True if arrays are equal; otherwise false. |
CompareContent(Ptg)
Compares tokens content.
Declaration
protected int CompareContent(Ptg token)
Parameters
Type | Name | Description |
---|---|---|
Ptg | token | Token to compare with this one. |
Returns
Type | Description |
---|---|
System.Int32 | 0 if tokens are equal. |
CompareTo(Ptg)
Compares this token to the specified one.
Declaration
public int CompareTo(Ptg token)
Parameters
Type | Name | Description |
---|---|---|
Ptg | token | Token to compare with. |
Returns
Type | Description |
---|---|
System.Int32 | 0 if tokens are equal. |
ConvertPtgToNPtg(IWorkbook, Int32, Int32)
Converts tokens from regular formula into tokens from shared formula.
Declaration
public virtual Ptg ConvertPtgToNPtg(IWorkbook parent, int iRow, int iColumn)
Parameters
Type | Name | Description |
---|---|---|
IWorkbook | parent | Represents parent workbook. |
System.Int32 | iRow | Represents row index. |
System.Int32 | iColumn | Represents column index. |
Returns
Type | Description |
---|---|
Ptg | Formula token. |
ConvertSharedToken(IWorkbook, Int32, Int32)
Declaration
public virtual Ptg ConvertSharedToken(IWorkbook parent, int iRow, int iColumn)
Parameters
Type | Name | Description |
---|---|---|
IWorkbook | parent | |
System.Int32 | iRow | |
System.Int32 | iColumn |
Returns
Type |
---|
Ptg |
GetSize(ExcelVersion)
Returns size of the tokens array.
Declaration
public abstract int GetSize(ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
ExcelVersion | version | Excel version - defines resulting size. |
Returns
Type | Description |
---|---|
System.Int32 | Size of the tokens array. |
GetString16Bit(Byte[], Int32)
Gets string from byte array, length of string is set in 16 bit value.
Declaration
public static string GetString16Bit(byte[] data, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | Data array which contains string. |
System.Int32 | offset | Offset to the string data. |
Returns
Type | Description |
---|---|
System.String | Parsed string. |
GetString16Bit(Byte[], Int32, out Int32)
Gets string from byte array and returns it's length in iFullLength parameter.
Declaration
public static string GetString16Bit(byte[] data, int offset, out int iFullLength)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | Data array which contains string. |
System.Int32 | offset | Offset to the string data. |
System.Int32 | iFullLength | Length of the string in bytes. |
Returns
Type | Description |
---|---|
System.String | Parsed string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When data array is smaller than the string that should be in it. |
IndexToCode(FormulaToken, Int32)
Converts index to token code.
Declaration
public static FormulaToken IndexToCode(FormulaToken baseToken, int index)
Parameters
Type | Name | Description |
---|---|---|
FormulaToken | baseToken | |
System.Int32 | index |
Returns
Type |
---|
FormulaToken |
InfillPTG(DataProvider, ref Int32, ExcelVersion)
Infill PTG structure.
Declaration
public virtual 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. |
Offset(Int32, Int32, WorkbookImpl)
Moves token by iRowOffset to the right and iColumnOffset to the left. (Updates formula token after copy operation.)
Declaration
public virtual 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 | Updated token. |
Offset(Int32, Int32, Int32, Int32, Rectangle, Int32, Rectangle, out Boolean, WorkbookImpl)
Adjusts the location of the token by the specified amount. Returns adjusted token. (Updates formula token after move operation.)
Declaration
public virtual 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 | Index of the sheet where formula is located. |
System.Int32 | iTokenRow | Zero-based row index which this token is located. |
System.Int32 | iTokenColumn | Zero-based column index where this token is located. |
System.Int32 | iSourceSheetIndex | Index of the source worksheet in move range operation. |
Rectangle | rectSource | Rectangle that was moved. |
System.Int32 | iDestSheetIndex | Index of the destination worksheet in move range operation. |
Rectangle | rectDest | Location were range was moved. |
System.Boolean | bChanged | Indicates whether token was changed during move operation. |
WorkbookImpl | book | Parent workbook. |
Returns
Type | Description |
---|---|
Ptg | Adjusted token. |
RectangleContains(Rectangle, Int32, Int32)
Declaration
public static bool RectangleContains(Rectangle rect, int iRow, int iColumn)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rect | |
System.Int32 | iRow | |
System.Int32 | iColumn |
Returns
Type |
---|
System.Boolean |
ToByteArray(ExcelVersion)
Converts token to byte array.
Declaration
public virtual byte[] ToByteArray(ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
ExcelVersion | version | Excel version - defines resulting array format and size. |
Returns
Type | Description |
---|---|
System.Byte[] | Array of bytes representing this token. |
ToString()
Converts token to a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of the token. |
ToString(FormulaUtil)
Converts token to the string.
Declaration
public virtual string ToString(FormulaUtil formulaUtil)
Parameters
Type | Name | Description |
---|---|---|
FormulaUtil | formulaUtil | Formula util. |
Returns
Type | Description |
---|---|
System.String | String representation of the token. |
ToString(FormulaUtil, Int32, Int32, Boolean)
Converts token to a string.
Declaration
public virtual string ToString(FormulaUtil formulaUtil, int iRow, int iColumn, bool bR1C1)
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. |
Returns
Type | Description |
---|---|
System.String | String representation of this token. |
ToString(FormulaUtil, Int32, Int32, Boolean, NumberFormatInfo)
Declaration
public virtual string ToString(FormulaUtil formulaUtil, int row, int col, bool bR1C1, NumberFormatInfo numberFormat)
Parameters
Type | Name | Description |
---|---|---|
FormulaUtil | formulaUtil | Formula util. |
System.Int32 | row | |
System.Int32 | col | |
System.Boolean | bR1C1 | Indicates whether R1C1 notation must be used. |
System.Globalization.NumberFormatInfo | numberFormat |
Returns
Type |
---|
System.String |
ToString(FormulaUtil, Int32, Int32, Boolean, NumberFormatInfo, Boolean)
Declaration
public virtual string ToString(FormulaUtil formulaUtil, int row, int col, bool bR1C1, NumberFormatInfo numberFormat, bool isForSerialization)
Parameters
Type | Name | Description |
---|---|---|
FormulaUtil | formulaUtil | Formula util. |
System.Int32 | row | |
System.Int32 | col | |
System.Boolean | bR1C1 | Indicates whether R1C1 notation must be used. |
System.Globalization.NumberFormatInfo | numberFormat | |
System.Boolean | isForSerialization |
Returns
Type |
---|
System.String |
ToString(FormulaUtil, Int32, Int32, Boolean, NumberFormatInfo, Boolean, IWorksheet)
Converts and returns the string
Declaration
public virtual string ToString(FormulaUtil formulaUtil, int row, int col, bool bR1C1, NumberFormatInfo numberInfo, bool isForSerialization, IWorksheet sheet)
Parameters
Type | Name | Description |
---|---|---|
FormulaUtil | formulaUtil | |
System.Int32 | row | |
System.Int32 | col | |
System.Boolean | bR1C1 | |
System.Globalization.NumberFormatInfo | numberInfo | |
System.Boolean | isForSerialization | |
IWorksheet | sheet |
Returns
Type |
---|
System.String |
ToString(Int32, Int32, Boolean)
Converts token to a string.
Declaration
public virtual string ToString(int row, int col, bool bR1C1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | Zero-based row index of the cell that contains this token. |
System.Int32 | col | Zero-based row index of the cell that contains this token. |
System.Boolean | bR1C1 | Indicates whether R1C1 notation should be used. |
Returns
Type |
---|
System.String |