<κλάση header="doc-nav" aria-label="Πλοήγηση τεκμηρίωσης"> Τεκμηρίωση HotXLS <κλάση nav="doc-links"> Περιεχόμενα Αρχική Επισκόπηση IXLSWorkbook <κλάση div="nav topic-quick-nav" aria-label="Topic shortcuts"> Αρχική Περιεχόμενα TXLSWorksheet

ForEachCell μέθοδος

<κλάση div="indent"> <κλάση div="txt"> Enumerates the loaded cells in a classic XLS worksheet and calls an application callback for each cell

Σύνταξη

<κλάση pre="code"> type TXLSCellReadEvent = procedure( Sender: TObject; SheetIndex, Row, Col: Integer; const Value: Variant; const Formula: WideString; var Cancel: Boolean) of object; function ForEachCell(Callback: TXLSCellReadEvent): Integer;

Παρατηρήσεις

<κλάση div="indent"> <κλάση div="txt"> ForEachCell walks only cells that exist in the loaded worksheet model. It does not scan every possible row and column in the sheet <κλάση div="txt"> Cells are visited in row-major order. SheetIndex, Row, and Col are 1-based public coordinates. Value is the current cell value. Formula contains the formula text for formula cells and is empty for ordinary value cells <κλάση div="txt"> Set Cancel to True in the callback to stop the scan early. The return value is the number of callbacks that were made

Παράδειγμα

<κλάση pre="code"> procedure TForm1.ReadCell(Sender: TObject; SheetIndex, Row, Col: Integer; const Value: Variant; const Formula: WideString; var Cancel: Boolean); begin Memo1.Lines.Add(Format('%d:%d = %s', [Row, Col, VarToStr(Value)])); if Row >= 1000 then Cancel := True; end; Visited := Workbook.Sheets[1].ForEachCell(ReadCell);

See Also

<κλάση div="indent"> <κλάση div="txt"> TXLSWorksheet.FindTextμέθοδος
TXLSWorksheet.ReplaceTextμέθοδος
TXLSWorksheet.WriteCellsμέθοδος
κλάση TXLSWorksheet
TXLSWorksheet.Cellsιδιότητα
TXLSWorksheet.UsedRangeιδιότητα <κλάση footer="reference-footer">Copyright © 2010-2026 losLab Software