首页 > Windows开发 > 详细

FastReport调用Delphi中的自定义函数(人民币大写金额)mtm

时间:2018-03-18 11:32:26      阅读:480      评论:0      收藏:0      [点我收藏+]

1. 在 FormCreate 中向FastReprot添加函数 (fPrint)窗口

procedure TfPrint.FormCreate(Sender: TObject);

  frxReport1.AddFunction(‘function MoneySpeechC(pMoney: Currency): String;‘,‘Myfunction‘,‘人民币大写金额转换函数‘);

end;

 

2. 在FastReport用户函数事件中添加 OnUserFunction

技术分享图片
function TfPrint.frxReport1UserFunction(const MethodName: string; var Params: Variant): Variant;
begin

  if UpperCase(MethodName) = UpperCase(‘MoneySpeechC‘) then
     Result := MoneySpeechC(Params[0]);

end;
技术分享图片

 

3.     在FastReport , memo6 的 OnAfterData 事件中插入如下代码

技术分享图片
procedure Memo6OnAfterData(Sender: TfrxComponent);
begin

   //-------
   memo6.text := MoneySpeechC(memo6.Value);
   
end;
技术分享图片

FastReport调用Delphi中的自定义函数(人民币大写金额)mtm

原文:https://www.cnblogs.com/westsoft/p/8594402.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!