var
i: integer;
f: textfile;
tmp: string;
begin
tmp := '';
for i:=1 to 6 do
begin
if (FindComponent(Format('Label%d',[i]))<>nil) and (FindComponent(Format('Label%d',[i])) is TLabel) then
tmp := tmp+TLabel(FindComponent(Format('Label%d',[i]))).Caption+' ';
end;
tmp := LeftStr(tmp,Length(tmp)-1); //去掉最后一个多余空格
assignfile(f,'c:\aa.txt');
rewrite(f);
write(f,tmp);
closeFile(f);