TXLSForwardReader class
TXLSForwardReader presents one projected, callback-driven surface for classic XLS, modern XLSX, ODS, CSV, and TSV input without constructing a complete workbook object model; it adapts the same row cursor backends used by TXLSRowCursor so push and pull reads share format, projection, and formula semantics
Input format
TXLSForwardFormat selects automatic detection or forces XLS, XLSX, ODS, CSV, or TSV parsing
ReadFile opens a named source and ReadStream reads from the caller's current stream position while restoring that position on return
Projection and row bounds
IncludeColumn adds a one-based column to the constant-time projection set, ClearColumnProjection restores all-column output, and HasColumnProjection reports whether pushdown is active
FirstRow and LastRow apply one-based row bounds before value conversion and callback dispatch, allowing parsers to stop after the requested interval
Callbacks and value conversion
| OnSheet | Receives each worksheet name and may skip a sheet or abort the complete read |
| OnCell | Receives the row, column, style index, normalized cached value, formula presence, and formula-text availability for every projected cell |
| IncludeFormulaText | Keeps formula presence and cached values while optionally suppressing formula-text accumulation |
| DetectDates | Uses workbook number formats to identify date and time values |
| DetectTextTypes | Converts CSV and TSV fields to supported scalar types where unambiguous |
| PreserveRichText | Retains formatted runs and phonetic payload where the source format supports them |
| ValueSeparator | Overrides the text-field separator when format detection is not appropriate |
HasFormula is false for ordinary values, while FormulaTextAvailable is true only when Formula contains reliable text; classic XLS reports cached formula results with unavailable formula text because the forward path does not decompile BIFF tokens
Completion state
CellCount reports dispatched cells and Aborted distinguishes caller cancellation from normal completion
ClassicBytesRead reports the total bytes consumed by the classic XLS (BIFF) parser and ClassicPeakBufferedBytes the peak buffered bytes it held at once; both are read-only diagnostics for the classic XLS path
PeakRowBufferedBytes reports the largest estimated logical-row working set retained by the shared backend, and SheetPassesStarted counts worksheet passes that became active; a sheet rejected by OnSheet does not open its worksheet part or increment the count
Sheet indexes delivered through OnSheet and OnCell are consistently one-based for every supported format
Example
Reader := TXLSForwardReader.Create;
try
Reader.FirstRow := 2;
Reader.IncludeColumn(1);
Reader.IncludeColumn(5);
Reader.OnSheet := ReadSheet;
Reader.OnCell := ReadCell;
Reader.ReadFile('large-input.xlsx', xffAuto);
finally
Reader.Free;
end;
Choosing a streaming API
Use TXLSForwardReader when one application path must accept several callback-driven formats, TXLSDirectReader for XLSX-specific layout and parallel worksheet events, or TXLSRowCursor when the same shared decoding semantics are needed through pull-driven row iteration