FastReport调用Delphi中的自定义函数

//定义一个函数;

function SmallToMoney(akey: real): string;

begin

  //'1234500'

end;

 

//此处为fastreport加载自定义函数以便引用

procedure Tprint_from.FormCreate(Sender: TObject);
begin
  frxReport1.AddFunction('function SmallToMoney(akey: real): string;', 'Myfunction', '函数功能说明');
end;

 

//为fastreport调用自定义函数。

function Tprint_from.frxReport1UserFunction(const MethodName: string;  var Params: Variant): Variant;
begin
   if UpperCase(MethodName) = UpperCase('SmallToMoney')  then  Result := SmallToMoney(Params[0]);
end;

posted @ 2017-05-04 23:32  佛也没辙  阅读(1203)  评论(0编辑  收藏  举报