FastReport4932 + Delphi7 封装DLL.docx
《FastReport4932 + Delphi7 封装DLL.docx》由会员分享,可在线阅读,更多相关《FastReport4932 + Delphi7 封装DLL.docx(12页珍藏版)》请在冰点文库上搜索。
FastReport4932+Delphi7封装DLL
FastReport4.9.32+Delphi7封装DLL
1在盘点清单项目里添加一个新DLL项目,命名为“frxFastReport”
2新项目中添加接口单元(uIFrtFastReport)、及实现单元(uFrtFastReport),一个Form窗口(uRPDesigner)。
文件结构如下图。
3frmRPDesigner窗口的组件清单。
4接口文件的详细代码如下:
定义了两过程:
一个是显示报表(ShowReport),一个是设计报表(DesignReport).
5接口的实现:
6fr3DM(TdataModule)单元在本例中没有被使用,可使用去掉。
8frxFastReport.DLL项目源文件中添加:
二、EXE程式调用DLL
1ListTagPrint.exe程式调用frxFastReport.dll
在EXE项目中的主FORM中引用引用接口单元文件(uIFrxFastReport.pas)。
打印按钮事件代码:
EXE的主窗体关闭,释放资源。
效果图:
计划窗口:
简单报表完成了。
异常提示:
ProjectTagListPrint.exeraisedexceptionclassEconvertErrorwithmessage‘CannotassignaTfieldListtoaTstringList’.Processestopped.UseSteporRuntocontinue.
解决方式:
1)修改frxDBSet.pas原代码文件,把“FDS.GetFieldNames(List);”注释掉。
添加两行“fori:
=0toFDS.FieldCount-1doList.Add(FDS.Fields[i].FullName)”
重新编辑frxFastReport.DLL项目。