function IsTextFile(FileName:string):boolean; var Fs:TFileStream; i,size:integer; IsTextFile:boolean; ByteData:Byte; begin if FileExists(FileName) then begin Fs:=TFileStream.Create(FileName,fmOpenRead); IsTextFile:=true; i:=0; size:=Fs.Size; While (i<size) and IsTextFile do begin Fs.Read(ByteData,1); IsTextFile:=ByteData<>0; inc(i) end; Fs.Free; Result:=IsTextFile end else Result:=false end;