1. 首页
  2. 移动开发
  3. 其他
  4. 帮助文档-报表工具FineReport与移动端app集成示例

帮助文档-报表工具FineReport与移动端app集成示例

上传者: 2018-12-25 16:48:37上传 PDF文件 565.93KB 热度 57次
用户有自己的app,希望把报表的移动端【本文中以FineReport移动端为例】功能集成到他们的app里面去,而不需要安装两个app。Android端和IOS端的集成接口是不一样的,下面我们分开详述如何实现。V Link Binary With Libraries (13 items)Name号lowe Chatsdk a凸凸白Fine Soft frameworkFoundation. frameworkUIKit frameworke CoreGraphicsframeworke JavaScriptCore frameworkeCoreLocationframeworksQuartzCore frameworkOpenGLES frameworkeSystemConfigurationframeworkSecurity framework○ libsqlite3.0.dyibe MessageUl frameworkDrag to reorder frameworks其中 Finesoft framework是 FineReport提供的资源文件,在解压文件夹的framework& bundle真机 Finesoft framework目录下同时,在项目中添加前面下载资源中的微信SDK和百度SDK,如下图v□ BaiduMapincAlibbaidumapapi. aAmapapi bundlev□ WeiXinSDKlibWe Chat SDK.ahwXApihh WXApiObjecthAAA3.集成使用 Fine Report App资源都导入配置完成之后,就需要集成App了,1OS端集成App有两种方式,一个是直接通过∪RL集成服务器上的模板,另外一个是通过发送用户名密码至服务器,验证通过之后,显示 FineReport目录树3.1直接URL集成直接URL集成报表,就是通过∪RL链接直接访问 Fine Report服务器上的报表在项目中使用 IFEntry View Controller加载报表,根据报表路径,服务器路径,预览类型创建 IFEntry View Controller对象引入头文件:#import 根据服务器地址和报表路径生成 IFEntry View Controller: IFEntry View ControllerentryVC [[IFEntry View Controller al-loc] initwith Path: path ServerUrl:url]reportPath:报表路径,如app/ DetaileddrilIA- phone. cpt;serverAl服务器地址,如http://192.168.1.100:8075/ebreport/reportserverview Type:预览类型,可选值有 IFEntry ViewTypePage(分页预览),IFEntryViewTypeWrite(填报预览),可选用,默认为分页预览;parameters:报表传递的参数,可选用如果上述四个接口全部使用,则其使用方法为:(id)initWithPath: (NSString *)reportPath serverUrl: (NSString *)serverUrlview Type: (IFEntry View Type)viewType parameters: (NSDictionary *)params比如说∪RL集成一张在线 app demo下的表单,直接预览,不传递参数,代码如下IFEntryViewController *entryVC =[[IFEntryViewController allo=] initnithpath:@app/sales/orders.frm"serverurl:@http://www.finereporthe8889/=pp/Re其详细使用情况可查看资源包中的 FRDemo示例3.2集成目录树查看模板集成目录树,就是指发送用户名密码至服务器验证之后,访问系统的目录树,查看系统下的所有模板。在项目中使用 IFEntry View Controller加载报表。其接口代码如下引入头文件#import #import 登录服务器[IFFrameUtils logInto: DEFAULT SERVERNAME scrvcrUrl: url withuscrnamc: username andPassword: password success: I//登录成功,加载目录树[IFFramcLtils loadRcport'Ircc: (NSMutablcArray *rcportsArray//加载成功,展示目录树IFFrareDirectoryviewController xdirectoryvc =[[IEErameDitoryView Controller alloc]sArray: reportsArray]se1f. navigationcontro⊥ er presentviewcontro⊥⊥er: directormvc animated: YES comple-tion: nilly failure:(NSString *)tt failure: (NSString *登录服务器的各个参数含义serverName:服务器名称,如Demo服务器serverUrl:服务器地址,如htp://192.1681.100:8075/ ebReport,/ Reportserverusername:用户名;password:密码;success:登录成功的回调函数(一般是加载目录树);failure:登录失败的回调函数。其各个参数的使用方法为:+(vod) loginto:( NSString*) serverNameserverUrl: (NSString *)serverUrl withUsername: (NSString *)usernameandPassword: (NSString *)password success: (void ()O)success failure: (void(A)(NSString *))failure;比如说集成在线 app demo工程的目录树,代码如下:import #import //登录服务器ils logInto: @ Dcmo服器scrv-crurl:a"http://www.fincrcporticlp.com:8889/app/rcportscrvcrwithUsername: @demo" andPassword: @"demo"success: I//登录成功,加载目录树[IFFrameUcils loadReportIree: (NSMutableArray *reportsArray)//加载成功,展示目录树IFFrarreDirectc-yViewController xdirectoryvc =[[IFFrameDircctoryVicwCon-rollcr alloc] initwithRcportsArray: rcportsArrayliself. navigationController presentviewContrcller: directoryvc animated: YES comple-tion: nil]failure: (NsString *)iy failure: (NSString x)t}1其详细使用情况可查看资源包中的 FRDemo_目录树示例4.注意事项1、需要配合FR8.0或者FR7.1.1版本使用;2、提供的示例 FRDemo只能在真机上运行,如需在模拟器上运行,请替换framework& bundle/模拟器中的 framework和 bundle文件;3、如果遇到百度地图的集成C文件冲突报错,可以将 other linker flags中的- all load改为-ObjC5. webview里打开原生报表如果集成的方式是从 webview上的htm元素事件触发,打开原生报表,那么需要自定义 Webview继承UⅣ Nebview,并重写-(BooL) webview:( UIWebview*)webViewhouldStartloadwith Request: NSURLRequestF)requestnavigationType:( UrWebview Type) navigationType方法来实现。原理就是分析u,如果u是报表类型,就用 Entry View Controller打开报表示例可见:(BOOL) webView:(UIWebView x)webView shouldstartLoadwithRequest:(NSURLRcqucst *)rcqucst navigationTypc:(UIWchVicwNavigacionT'ypc) navigaon Type Iif(navigationType ! UIWebViewNavigacionTypelinkClicked)iturn y三S;NSStrastra[[request url] absolutestring]NSMutablcDictionary *urlDict -[IFEramcUtile analyaisurl:urlString];if(lurlDict contain: KEY URL]) I/说明是普通超链IFWebViewController xtowebview =[[IFWebViewController alloc]nitNithUrl: [url Dict abjecttoWeoview.ti1e=@"链接";[self iF PushVC: toWebview animated: YES]y else I//说明是报表类型的超链I上 Entryvicvfypc vicw⊥ FEntryVicWT'ypcPf([lurlDict objectForKey: KEY OP isEqualTostring: KEY VIEWTYPE WRITE])(viewType IFEntryviewfypewriteiIFEntryViewCon-roller[[IFEntryloc] initwithPath: [urlfict objectrorKey: KEY PATIl] serverUrl: [urlDict objec=Forkey: SERVERURI KEY] viewType: viewTyrelientry.tite=ur⊥Dict[ KEY PATH」[self iFPushVC: entryvc animated: YES]re七 urn Ni6.测试FineReport提供一个Demo地址供测试服务器地址:www.finereporthelp.com:8889/app/Reportserver用户名:demo;密码:demo;可用报表路径:app/ Detailed DrillA-phone cptapp/para-phone cptapp/ Detailed Drill-pad cptapp/parapad cptapp/sales /sales. frmapp/sales/map. trmapp/sales/saleseffects frmapp/sales/TOP6-pad frmapp/sales/product. frmapp/sales/ SWOT. frmapp/sales/orders. frmapp/sales/abc. frm app/financial/Finace Statistic. frm app/Operations/area. frm集成1.资源准备准备好需要集成 FineReport App的 Android工程,并下载 FineReport提供的集成资源包下载 FineReport提供的集成资源包,将其解压,得到如下图所示几个文件名称▲libtandroi集成app使用说明.txt将解压出来的libs目录和res目录拷贝需要集成的 Android工程项目中,并将libs目录下的JAR包和 armeabi目录作为依赖库引用到 Android开发工程中,如下图:type filter textJava build path+ ResourceE LI braries\sr er and ExportTara Build PathJARs and class folders on the build pathTava CompilerPf1 E5Add丁A三中 Java Edi tor+]o1d android-supp ort-v4 iar -Androi dapp/ libAddE置 ternaProject Reference+fatg frmobile. jar-Androi dApp libsAdd variabRun debug settings+olghttpmime-4.2.1.jar-androida5. jar- Androi dApp /libsAdd libran+l-o1g Ixing jar- Androi dApp/libAdd class Ftem Library Lire]点 dd External D1aEdit
下载地址
用户评论