1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| procedure TForm1.rechercheClick(Sender: TObject);
function FindString(const ATarget: String; AColStart: Integer = 1; AColEnd: Integer = -1): Boolean;
var
i, j: Integer;
begin
Result := False;
for i:= 1 to F1Book1.LastRow do
begin
if AColStart <= 0 then
AColStart := 1;
if AColEnd <= 0 then
AColEnd := F1Book1.LastColForRow[i];
for j := AColStart to AColEnd do
begin
if SameText(F1Book1.TextRC[i, j], ATarget) then
begin
F1Book1.TopRow := i;
F1Book1.LeftCol := j;
F1Book1.SetSelection(i,j,i,j);
F1Book1.Row := i;
F1Book1.Col := j;
Result := True;
Exit;
end;
end;
end;
end;
begin
if FindString(edit1.Text, 1, 1) then
with f1book1 do
showmessage(Format('A: %s, B: %s, C: %s, D: %s, E: %s, F: %s', [textRc[Row,1], textRc[Row,2], textRc[Row,3], textRc[Row,4], textRc[Row,5], textRc[Row,6]]);
end; |
Partager