Class RecordTable
Implements a two-dimensional table that holds an SFArrayList of rows. Each row is an SFArrayList of objects.
Inheritance
Implements
Namespace: Syncfusion.XlsIO.Implementation.Collections
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public class RecordTable : Object, ICloneable, IDisposable
Remarks
This is a memory efficient way to represent a table where values can remain empty. Only rows that actually contain data will allocate an SFArrayList and the array only holds as many objects as the specific row contains columns.
When you access data that are out of range, an empty () object will be returned. If you set data that are out of range, an exception will be thrown. If you set data for a row that is empty, the row will be allocated before the value is stored.
SFTable provides methods that let you insert, remove or rearrange columns or m_arrRows in the table.
Properties
AppImplementation
Return parent Application object. Read-only.
Declaration
public ApplicationImpl AppImplementation { get; }
Property Value
Type |
---|
ApplicationImpl |
Application
Return parent Application object. Read-only.
Declaration
public IApplication Application { get; }
Property Value
Type |
---|
IApplication |
FirstRow
Returns zero-based index of the first created row.
Declaration
public int FirstRow { get; }
Property Value
Type |
---|
System.Int32 |
Item[Int32, Int32]
Gets / sets an element at the specified coordinates in the SFTable.
Declaration
public object this[int rowIndex, int colIndex] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The zero-based row index. |
System.Int32 | colIndex | The zero-based column index. |
Property Value
Type |
---|
System.Object |
Remarks
If you query for an element and the coordinates are out of range, an empty (null) object will be returned.
If you set an element and the the coordinates are out of range, an exception is thrown.
LastRow
Returns zero-based index of the last created row.
Declaration
public int LastRow { get; }
Property Value
Type |
---|
System.Int32 |
RowCount
Gets the number of rows contained in the SFTable. Read-only.
Declaration
public int RowCount { get; set; }
Property Value
Type |
---|
System.Int32 |
Rows
Returns the SFArrayList from all rows.
Declaration
public ArrayListEx Rows { get; }
Property Value
Type |
---|
ArrayListEx |
SharedFormulas
Returns List with shared formulas. Read-only.
Declaration
public Dictionary<long, SharedFormulaRecord> SharedFormulas { get; }
Property Value
Type |
---|
System.Collections.Generic.Dictionary<System.Int64, SharedFormulaRecord> |
Workbook
Returns parent workbook. Read-only.
Declaration
public WorkbookImpl Workbook { get; }
Property Value
Type |
---|
WorkbookImpl |
Methods
AccessRow(Int32)
Updates first and last row indexes.
Declaration
public void AccessRow(int iRowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | Zero-based index of the created row. |
AddSharedFormula(Int32, Int32, SharedFormulaRecord)
Adds shared formula to record table.
Declaration
public void AddSharedFormula(int row, int column, SharedFormulaRecord shared)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | Row index of the cell containing shared formula description. |
System.Int32 | column | Column index of the cell containing shared formula description. |
SharedFormulaRecord | shared | Shared formula record to add. |
CacheAndRemove(Rectangle, Int32, Int32, ref Int32, ref Int32, Boolean)
Caches and removes specified rectangle from the table.
Declaration
public RecordTable CacheAndRemove(Rectangle rectSource, int iDeltaRow, int iDeltaColumn, ref int iMaxRow, ref int iMaxColumn, bool bInsert)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectSource | Source rectangle. |
System.Int32 | iDeltaRow | Row delta to add to the resulting table. |
System.Int32 | iDeltaColumn | Column delta to add to the resulting table. |
System.Int32 | iMaxRow | Output maximum zero-based row index. |
System.Int32 | iMaxColumn | Output maximum zero-based column index. |
System.Boolean | bInsert | Boolean flag to indicate if a row is moved or inserted. |
Returns
Type | Description |
---|---|
RecordTable | Cached table. |
Clear()
Removes all elements from the SFTable.
Declaration
public void Clear()
Clone()
Creates a deep copy of the RecordTable.
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System.Object | A deep copy of the RecordTable. |
Contains(Int32, Int32)
Indicates whether an element is at the specified coordinates in the SFTable.
Declaration
public bool Contains(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The zero-based row index. |
System.Int32 | colIndex | The zero-based column index. |
Returns
Type | Description |
---|---|
System.Boolean | true if an element exists at the specified coordinates in the SFTable; false otherwise. |
ContainsRow(Int32)
Determines whether collection contains row.
Declaration
public bool ContainsRow(int iRowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | Zero-based row index. |
Returns
Type | Description |
---|---|
System.Boolean | True if the collection contains at least one element with specified row index; otherwise, False. |
CopyCells(RecordTable, SSTDictionary, SSTDictionary, Dictionary<Int32, Int32>, Dictionary<String, String>, Dictionary<Int32, Int32>, Dictionary<Int32, Int32>, Dictionary<Int32, Int32>)
Copies cells from another worksheet.
Declaration
public void CopyCells(RecordTable sourceCells, SSTDictionary sourceSST, SSTDictionary destSST, Dictionary<int, int> hashExtFormatIndexes, Dictionary<string, string> hashWorksheetNames, Dictionary<int, int> dicNameIndexes, Dictionary<int, int> dicFontIndexes, Dictionary<int, int> dictExternSheet)
Parameters
Type | Name | Description |
---|---|---|
RecordTable | sourceCells | Source cells collection to copy cells from. |
SSTDictionary | sourceSST | Source SST dictionary. |
SSTDictionary | destSST | Destination SST dictionary. |
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | hashExtFormatIndexes | Dictionary with new extended format indexes. |
System.Collections.Generic.Dictionary<System.String, System.String> | hashWorksheetNames | Dictionary with new worksheet names. |
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | dicNameIndexes | Dictionary with new name indexes. |
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | dicFontIndexes | Dictionary with new font indexes. |
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | dictExternSheet |
CreateCellCollection(Int32, Int32, ExcelVersion)
Creates a collection of cells for a row.
Declaration
public virtual RowStorage CreateCellCollection(int iRowIndex, int height, ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | Zero-based row index. |
System.Int32 | height | Row height. |
ExcelVersion | version | Excel version. |
Returns
Type | Description |
---|---|
RowStorage | An SFArrayList or derived object for the cell collection. |
Dispose()
Declaration
public void Dispose()
EnsureSize(Int32)
Ensures that array will be able to handle desired number of rows.
Declaration
public void EnsureSize(int iSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iSize |
ExtractRanges(BiffReader, Boolean, SSTDictionary, WorksheetImpl, IDecryptor)
Extracts ranges from the reader.
Declaration
public void ExtractRanges(BiffReader reader, bool bIgnoreStyles, SSTDictionary sst, WorksheetImpl sheet, IDecryptor decryptor)
Parameters
Type | Name | Description |
---|---|---|
BiffReader | reader | Reader to extract ranges from. |
System.Boolean | bIgnoreStyles | Indicates whether to ignore styles. |
SSTDictionary | sst | SSTDictionary of the parent workbook. |
WorksheetImpl | sheet | Parent worksheet. |
IDecryptor | decryptor | Object used to decrypt encrypted records. |
ExtractRangesFast(IndexRecord, BiffReader, Boolean, SSTDictionary, WorksheetImpl)
Extracts ranges from the reader.
Declaration
public bool ExtractRangesFast(IndexRecord index, BiffReader reader, bool bIgnoreStyles, SSTDictionary sst, WorksheetImpl sheet)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.XlsIO.Parser.Biff_Records.IndexRecord | index | Index record |
BiffReader | reader | Reader to extract ranges from. |
System.Boolean | bIgnoreStyles | Indicates whether to ignore styles. |
SSTDictionary | sst | SSTDictionary of the parent workbook. |
WorksheetImpl | sheet | Parent worksheet. |
Returns
Type | Description |
---|---|
System.Boolean | True if parsing was succeeded (this doesn't guarantees records correctness). |
Finalize()
Object finalizer.
Declaration
protected override void Finalize()
Find(IRange, Byte, Boolean, Boolean, WorkbookImpl)
Returns found values or null.
Declaration
public List<long> Find(IRange range, byte findValue, bool bErrorCode, bool bIsFindFirst, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
IRange | range | Storage range. |
System.Byte | findValue | Value for finding. |
System.Boolean | bErrorCode | Indicates whether we should look for error code or boolean value. |
System.Boolean | bIsFindFirst | If findfirst - true then returns range; otherwise - array with all found values. |
WorkbookImpl | book | Parent workbook. |
Returns
Type |
---|
System.Collections.Generic.List<System.Int64> |
Find(IRange, Double, ExcelFindType, Boolean, WorkbookImpl)
Returns found values or null.
Declaration
public List<long> Find(IRange range, double findValue, ExcelFindType flags, bool bIsFindFirst, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
IRange | range | Storage range. |
System.Double | findValue | Value for finding. |
ExcelFindType | flags | If true - finds first value; otherwise - all values. |
System.Boolean | bIsFindFirst | If findfirst - true then returns range; otherwise - array with all found values. |
WorkbookImpl | book | Parent workbook. |
Returns
Type |
---|
System.Collections.Generic.List<System.Int64> |
Find(IRange, String, ExcelFindType, ExcelFindOptions, Boolean, WorkbookImpl)
Returns found values or null.
Declaration
public List<long> Find(IRange range, string findValue, ExcelFindType flags, ExcelFindOptions findOptions, bool bIsFindFirst, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
IRange | range | Storage range. |
System.String | findValue | Value to find. |
ExcelFindType | flags | If true - finds first value; otherwise - all values. |
ExcelFindOptions | findOptions | Way to find the value. |
System.Boolean | bIsFindFirst | If findfirst - true then returns range; otherwise - array with all found values. |
WorkbookImpl | book | The book. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Int64> | List with cell indexes that contains specified value. |
Find(IRange, String, ExcelFindType, Boolean, WorkbookImpl)
Returns found values or null.
Declaration
public List<long> Find(IRange range, string findValue, ExcelFindType flags, bool bIsFindFirst, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
IRange | range | Storage range. |
System.String | findValue | Value for finding. |
ExcelFindType | flags | If true - finds first value; otherwise - all values. |
System.Boolean | bIsFindFirst | If findfirst - true then returns range; otherwise - array with all found values. |
WorkbookImpl | book | Parent workbook. |
Returns
Type |
---|
System.Collections.Generic.List<System.Int64> |
Find(Dictionary<Int32, Object>)
Declaration
public List<long> Find(Dictionary<int, object> dictIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.Int32, System.Object> | dictIndexes |
Returns
Type |
---|
System.Collections.Generic.List<System.Int64> |
GetArrayRecord(ICellPositionFormat)
Extracts Array record from the collection.
Declaration
public ArrayRecord GetArrayRecord(ICellPositionFormat cell)
Parameters
Type | Name | Description |
---|---|---|
ICellPositionFormat | cell | Cell that contains array-entered formula. |
Returns
Type | Description |
---|---|
ArrayRecord | ArrayRecord if there is one; null if cell doesn't contain array-entered formula. |
GetBoolValue(Int32, Int32)
Gets bool value by row or column indexes. Without check input parameters.
Declaration
public int GetBoolValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.Int32 | If found - returns value; otherwise - 0. |
GetCellType(Int32, Int32, Boolean)
Gets cell type from current column.
Declaration
public WorksheetImpl.TRangeValueType GetCellType(int row, int column, bool bNeedFormulaSubType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | Indicates row. |
System.Int32 | column | Indicates column. |
System.Boolean | bNeedFormulaSubType | Indicates is need to indentify formula sub type. |
Returns
Type | Description |
---|---|
WorksheetImpl.TRangeValueType | Returns cell type. |
GetErrorValue(Int32, Int32)
Gets error value by row or column indexes. Without check input parameters.
Declaration
public string GetErrorValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.String | If found - returns value; otherwise - null. |
GetFormulaBoolValue(Int32, Int32)
Gets formula bool value by row or column indexes. Without check input parameters.
Declaration
public int GetFormulaBoolValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.Int32 | If found - returns value; otherwise - 0. |
GetFormulaErrorValue(Int32, Int32)
Gets formula error value by row or column indexes. Without check input parameters.
Declaration
public string GetFormulaErrorValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.String | If found - returns value; otherwise - null. |
GetFormulaNumberValue(Int32, Int32)
Gets formula number value by row or column indexes. Without check input parameters.
Declaration
public double GetFormulaNumberValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.Double | If found - returns value; otherwise - double.NaN. |
GetFormulaStringValue(Int32, Int32, SSTDictionary)
Gets string value by row or column indexes. Without check input parameters.
Declaration
public string GetFormulaStringValue(int iRow, int iCol, SSTDictionary sst)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
SSTDictionary | sst | Represents sst dictionary. |
Returns
Type | Description |
---|---|
System.String | If found - returns value; otherwise - null. |
GetFormulaValue(Int32, Int32)
Gets array of formula ptg.
Declaration
public Ptg[] GetFormulaValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
Ptg[] | If found - returns ptg array; otherwise - null. |
GetMaximumColumnIndex(Int32, Int32)
Returns maximum used column.
Declaration
public int GetMaximumColumnIndex(int iStartRow, int iEndRow)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iStartRow | Start row. |
System.Int32 | iEndRow | End row. |
Returns
Type | Description |
---|---|
System.Int32 | Maximum used column. |
GetMinimumColumnIndex(Int32, Int32)
Returns minimum used column.
Declaration
public int GetMinimumColumnIndex(int iStartRow, int iEndRow)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iStartRow | Start row. |
System.Int32 | iEndRow | End row. |
Returns
Type | Description |
---|---|
System.Int32 | Minimum used column. |
GetNumberValue(Int32, Int32)
Gets number value by row or column indexes. Without check input parameters.
Declaration
public double GetNumberValue(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.Double | If found - returns value; otherwise - double.NaN. |
GetOrCreateRow(Int32, Int32, Boolean, ExcelVersion)
Returns row from the collection or creates one if necessary.
Declaration
public RowStorage GetOrCreateRow(int rowIndex, int height, bool bCreate, ExcelVersion version)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Zero-based row index. |
System.Int32 | height | Row height. |
System.Boolean | bCreate | Indicates whether to create row if it doesn't exist. |
ExcelVersion | version | Excel version. |
Returns
Type | Description |
---|---|
RowStorage | Desired row object. |
GetStringValue(Int32, Int32, SSTDictionary)
Gets string value by row or column indexes. Without check input parameters.
Declaration
public string GetStringValue(int iRow, int iCol, SSTDictionary sst)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
SSTDictionary | sst | Represents sst dictionary. |
Returns
Type | Description |
---|---|
System.String | If found - returns value; otherwise - null. |
HasFormulaArrayRecord(Int32, Int32)
Indicates is contain formula array.
Declaration
public bool HasFormulaArrayRecord(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | Zero based row index. |
System.Int32 | iCol | Zero based column index. |
Returns
Type | Description |
---|---|
System.Boolean | If found return true; otherwise - false. |
HasFormulaRecord(Int32, Int32)
Indicates if there is formula record.
Declaration
public bool HasFormulaRecord(int iRow, int iCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iCol | One based column index. |
Returns
Type | Description |
---|---|
System.Boolean | Indicates whether formula record is contained. |
InsertIntoDefaultRows(Int32, Int32)
Declaration
public void InsertIntoDefaultRows(int iRowIndex, int iRowCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | |
System.Int32 | iRowCount |
MarkUsedReferences(Boolean[])
Sets items with used reference indexes to true.
Declaration
public void MarkUsedReferences(bool[] usedItems)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean[] | usedItems | Array to mark used references in. |
RemoveLastColumn(Int32)
Removes last column from the worksheet.
Declaration
public void RemoveLastColumn(int iColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iColumnIndex | Zero-based column index. |
RemoveRow(Int32)
Removes row from the worksheet.
Declaration
public void RemoveRow(int iRowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | Zero-based row index to remove. |
ReplaceSharedFormula(WorkbookImpl)
Replaces all shared formula with ordinary formula.
Declaration
public void ReplaceSharedFormula(WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
WorkbookImpl | book |
ReplaceSharedFormula(WorkbookImpl, Int32, Int32, SharedFormulaRecord)
Replaces all shared formula with ordinary formula.
Declaration
public void ReplaceSharedFormula(WorkbookImpl book, int row, int column, SharedFormulaRecord shared)
Parameters
Type | Name | Description |
---|---|---|
WorkbookImpl | book | |
System.Int32 | row | |
System.Int32 | column | |
SharedFormulaRecord | shared |
SetFormulaValue(Int32, Int32, Double, StringRecord)
Sets formula value. Use for setting FormulaError, FormulaBoolean, FormulaNumber, FormulaString values.
Declaration
public void SetFormulaValue(int iRow, int iColumn, double value, StringRecord strRecord)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRow | One based row index. |
System.Int32 | iColumn | One based column index. |
System.Double | value | Represents value for set. |
StringRecord | strRecord | Represents string record as formula string value. Can be null. |
SetRow(Int32, RowStorage)
Sets row.
Declaration
public void SetRow(int iRowIndex, RowStorage row)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iRowIndex | Zero-based row index to set. |
RowStorage | row | Row object to set. |
UpdateExtendedFormatIndex(Dictionary<Int32, Int32>)
This method should be called immediately after extended format removal.
Declaration
public void UpdateExtendedFormatIndex(Dictionary<int, int> dictFormats)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | dictFormats | Dictionary with updated extended formats. |
UpdateExtendedFormatIndex(Int32)
This method updates indexes to the extended formats after version change.
Declaration
public void UpdateExtendedFormatIndex(int maxCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxCount | New restriction for maximum possible XF index. |
UpdateExtendedFormatIndex(Int32[])
This method should be called immediately after extended format removal.
Declaration
public void UpdateExtendedFormatIndex(int[] arrFormats)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | arrFormats | Array with updated extended formats. |
UpdateFormula(Int32, Int32, Rectangle, Int32, Rectangle)
Updates formulas after copy operation.
Declaration
public void UpdateFormula(int iCurIndex, int iSourceIndex, Rectangle sourceRect, int iDestIndex, Rectangle destRect)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iCurIndex | Current worksheet index. |
System.Int32 | iSourceIndex | Source worksheet index. |
Rectangle | sourceRect | Source rectangle. |
System.Int32 | iDestIndex | Destination worksheet index. |
Rectangle | destRect | Destination rectangle. |
UpdateFormulaFlags()
Updates formulas after copy operation.
Declaration
public void UpdateFormulaFlags()
UpdateNameIndexes(WorkbookImpl, IDictionary<Int32, Int32>)
Updates indexes to named ranges.
Declaration
public void UpdateNameIndexes(WorkbookImpl book, IDictionary<int, int> dicNewIndex)
Parameters
Type | Name | Description |
---|---|---|
WorkbookImpl | book | Parent workbook. |
System.Collections.Generic.IDictionary<System.Int32, System.Int32> | dicNewIndex | New indexes. |
UpdateNameIndexes(WorkbookImpl, Int32[])
Updates indexes to named ranges.
Declaration
public void UpdateNameIndexes(WorkbookImpl book, int[] arrNewIndex)
Parameters
Type | Name | Description |
---|---|---|
WorkbookImpl | book | Parent workbook. |
System.Int32[] | arrNewIndex | New indexes. |
UpdateReferenceIndexes(Int32[])
Updates reference indexes.
Declaration
public void UpdateReferenceIndexes(int[] arrUpdatedIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | arrUpdatedIndexes | Array with updated indexes. |
UpdateStringIndexes(List<Int32>)
Updates string indexes.
Declaration
public void UpdateStringIndexes(List<int> arrNewIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Int32> | arrNewIndexes | List with new indexes. |