HotXLS Docs

CreateLoadedCellCursor method

Creates a pull cursor over stored cells in a loaded classic XLS workbook, with an option to include independently styled blanks

Syntax

function CreateLoadedCellCursor: IXLSLoadedCellCursor; overload;
function CreateLoadedCellCursor(
  AIncludeStoredBlanks: Boolean): IXLSLoadedCellCursor; overload;

Traversal order and cost

The cursor visits worksheets in collection order, then cells by ascending row and column

SheetIndex, Row, and Col are one-based public coordinates

Traversal follows allocated classic sparse-storage branches directly, so cursor state remains constant and does not allocate arrays sized to the worksheet row or column limits

The parameterless overload skips blanks and preserves the existing value-and-formula traversal contract

Pass True to include stored blank cells whose cell XF differs from the inherited row, column, or worksheet format

Inherited formatting alone does not materialize or emit a blank coordinate

Snapshot fields

FieldMeaning
SheetIndex / SheetNameOwning worksheet identity at the time of capture
Row / ColOne-based cell coordinates
StyleIndexClassic XF style index
Kind (TXLSLoadedCellKind)xlckText, xlckNumber, xlckDateTime, xlckBoolean, xlckFormula, or xlckBlank
ValueOwned Variant value captured for the current cell
FormulaFormula text for formula cells, otherwise an empty string

Strings and Variants in TXLSLoadedCellSnapshot are owned values and do not expose internal cell objects

For formula cells, Value follows the classic workbook's normal value-access semantics, including calculation when required

For xlckBlank, Value is Unassigned, Formula is empty, and StyleIndex identifies the stored cell XF

State and invalidation

State (type TXLSLoadedCellCursorState) is xlccBeforeFirst until the first successful MoveNext, xlccActive while Current is available, and xlccEof after traversal completes

Reading Current before the first cell or after EOF raises EXLSLoadedCellCursorState

Creating or deleting stored cells, adding, deleting, or moving worksheets, or replacing the workbook model invalidates the cursor

The next MoveNext or Current call then raises EXLSLoadedCellCursorInvalidated

Changing an existing cell value, formula, or format does not invalidate the cursor, and an already captured snapshot remains unchanged

Example

Cursor := Workbook.CreateLoadedCellCursor;
while Cursor.MoveNext do
begin
  Cell := Cursor.Current;
  Memo1.Lines.Add(Format('%s!R%dC%d = %s',
    [Cell.SheetName, Cell.Row, Cell.Col, VarToStr(Cell.Value)]));
end;

See also