<κλάση header="doc-nav" aria-label="Πλοήγηση τεκμηρίωσης">
Τεκμηρίωση HotXLS
<κλάση nav="doc-links">
Περιεχόμενα
Αρχική
Επισκόπηση
IXLSWorkbook
<κλάση div="nav topic-quick-nav" aria-label="Topic shortcuts">
Αρχική
Περιεχόμενα
TXLSWorksheet
WriteCells μέθοδος
<κλάση div="indent">
<κλάση div="txt">
Fills a classic XLS worksheet range by calling application code for each cell value
Σύνταξη
<κλάση pre="code">
type
TXLSCellWriteEvent = procedure(
Sender: TObject;
SheetIndex, Row, Col: Integer;
var Value: Variant;
var Skip: Boolean;
var Cancel: Boolean) of object;
function WriteCells(ARange: WideString; Callback: TXLSCellWriteEvent): Integer; overload;
function WriteCells(ARow1, ACol1, ARow2, ACol2: Integer; Callback: TXLSCellWriteEvent): Integer; overload;
Παρατηρήσεις
<κλάση div="indent">
<κλάση div="txt">
The string overload accepts an A1-style range such as A1:C100. The numeric overload uses 1-based row and column indexes. Ranges are normalized when the start row or column is greater than the end row or column
<κλάση div="txt">
Cells are requested in row-major order. Set Value in the callback to write the current cell. Set Skip to True to leave the current cell unchanged. Set Cancel to True to stop after the current callback. The return value is the number of cells written
<κλάση div="txt">
This method writes into the loaded worksheet model. It is a compact callback-based writing helper, not a file-streaming save mode
Παράδειγμα
<κλάση pre="code">
procedure TForm1.WriteCell(Sender: TObject; SheetIndex, Row, Col: Integer;
var Value: Variant; var Skip: Boolean; var Cancel: Boolean);
begin
if Col = 3 then
begin
Skip := True;
Exit;
end;
Value := Format('R%dC%d', [Row, Col]);
if Row >= 1000 then
Cancel := True;
end;
Written := Workbook.Sheets[1].WriteCells('A1:D2000', WriteCell);
See Also
<κλάση div="indent">
<κλάση div="txt">
TXLSWorksheet.ForEachCellμέθοδος
κλάση TXLSWorksheet
TXLSWorksheet.Rangeιδιότητα
TXLSWorksheet.RCRangeιδιότητα
<κλάση footer="reference-footer">Copyright © 2010-2026 losLab Software