var
vPath: string;
begin
vPath:=ExtractFilePath (Application.ExeName) ;
vPath :=vPath+'GoodsImage' ;
vPath:=format ( '%s\%s.jpg', [vPath,<ABQuery2."货品编码">]);
if ABFileExists(vPath) then
begin
Picture1.picture.LoadFromFile (vPath);
Picture1.visible:=true;
end
else
Picture1.visible:=false
ABFileExists为自己拓展函数
ABFrameworkFastReportU单元中:
UserFunction中增加
else if UpperCase(aMethodName) = UpperCase('ABFileExists') then
begin
Result := FileExists(aParams[0]);
end;
CreateUserFunc中增加
//增加判断文件是否存在的方法
AddFunction('function ABFileExists(aFileName:string):Boolean;','ABSysFunc',('判断文件是否存在'));