Interface LightCellsDataProvider
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Represents Data provider for saving large spreadsheet files in light weight mode.
public interface LightCellsDataProvider
Remarks
When saving a workbook by this mode, Aspose.Cells.LightCellsDataProvider.StartSheet(System.Int32) will be checked when saving every worksheet in the workbook.
For one sheet, if Aspose.Cells.LightCellsDataProvider.StartSheet(System.Int32) gives true, then all data and properties to be saved for rows/cells of this sheet
will be provided by the implementation of this interface.
In the first place, Aspose.Cells.LightCellsDataProvider.NextRow will be called to get the next row index to be saved.
If a valid row index is returned(the row index must be in ascending order for the rows to be saved),
then a Row object representing this row will be provided by Aspose.Cells.LightCellsDataProvider.StartRow(Aspose.Cells.Row) for the implementation to set its properties.
For one row, Aspose.Cells.LightCellsDataProvider.NextCell will be checked firstly.
If a valid column index be returned(the column index must be in ascending order for all cells of current row),
then a Cell object representing this cell will be provided by Aspose.Cells.LightCellsDataProvider.StartCell(Aspose.Cells.Cell) for implementation to set its data and properties.
After Aspose.Cells.LightCellsDataProvider.StartCell(Aspose.Cells.Cell) the cell will be saved directly to the resultant spreadsheet file.
Then the next cell will be checked and processed.
Please note, user should only update values and properties for current Row/Cell object provided by corresponding method.
Because the cells data is written to the resultant file in streaming manner, most of other objects may have been written
to the resultant file, or have been gathered and written some global data for them. So when user updating other objects
while saving cells data, those operations may be not able to affect the saved data. Or even worse, those operations may
cause inconsistent data be save to the resultant file and finally make the file corrupted.
So, for all other objects such as shapes, column width and styles, conditional formattings, …etc.,
please do not operate them in any methods of this implementation.
Instead, please manage them and adjust them to the final state before calling “Save” method of the Workbook.
Methods
IsGatherString()
Checks whether the current string value of cell needs to be gathered into a global pool.
bool IsGatherString()
Returns
true if string value need to be gathered into a global pool for the resultant file.
Remarks
Gathering string values will take advantage only when there are many duplicated string values for the cells provided by this implementation. In this situation gathering string will save much memory and generate smaller resultant file. If there are many string values for the cells provided by LightCellsDataProvider but few of them are same, gathering string will cost more memory and time and has no advantage for the resultant file.
NextCell()
Gets next cell to be saved.
int NextCell()
Returns
column index of the next cell to be saved. -1 means the end of current row data has been reached and no further cell of current row to be saved.
Remarks
It will be called at the beginning of saving one cell.
NextRow()
Gets the next row to be saved.
int NextRow()
Returns
the next row index to be saved. -1 means the end of current sheet data has been reached and no further row of current sheet to be saved.
Remarks
It will be called at the beginning of saving a row and its cells data(before Aspose.Cells.LightCellsDataProvider.StartRow(Aspose.Cells.Row)).
StartCell(Cell)
Starts to save data of one cell.
void StartCell(Cell cell)
Parameters
cell
Cell
Cell object for implementation to fill data. Its column index is the returned value of latest call of Aspose.Cells.LightCellsDataProvider.NextCell. If the cell has been initialized in the inner cells model, the existed cell object will be used. Otherwise a temporary Cell object will be used for implementation to fill data.
StartRow(Row)
Starts to save data of one row.
void StartRow(Row row)
Parameters
row
Row
Row object for implementation to fill data. Its row index is the returned value of latest call of Aspose.Cells.LightCellsDataProvider.NextRow. If the row has been initialized in the inner cells model, the existing row object will be used. Otherwise a temporary Row object will be used for implementation to fill data.
Remarks
It will be called at the beginning of saving a row and its cells data. If current row has some custom properties such as height, style, …etc., implementation should set those properties to given Row object here.
StartSheet(int)
Starts to save a worksheet.
bool StartSheet(int sheetIndex)
Parameters
sheetIndex
int
index of current sheet to be saved.
Returns
true if this provider will provide data for the given sheet; false if given sheet should use its normal data model(Cells).
Remarks
It will be called at the beginning of saving a worksheet during saving a workbook.
If the provider needs to refer to sheetIndex
later
in startRow(Row) or startCell(Cell) method,
that is, if the process needs to know which worksheet is being processed,
the implementation should retain the sheetIndex
value here.