angular 直接打印预览
1.在项目 index.html 的头部引入 finereport 相关的 js 文件
<script type="text/javascript" src="/femisnsb/reportserver?op=emb&resource=finereport.js"></script>
注意上面的 femisnsb 是项目名称,编译后要拷贝到 java 项目中运行
2.在要使用的组件的 ts 文件中的组件注解外 @component
声明变量 declare var fr:any;
注意只能声明为 fr
3.在按钮点击事件中调用
usejs(){ alert("即将调用js直接打印"); const url = "http://localhost:8080/femisnsb/reportserver?reportlet=%e9%9d%a2%e6%96%99%e8%ae%a2%e5%8d%95%e5%8d%95%e6%8d%ae.cpt&mainid=43"; const ispopup = false; const config = {url:url,ispopup:ispopup}; fr.dourlpdfprint(config); }
上面的 ispopup 表示不弹出而是直接预览
总结
以上所述是小编给大家介绍的angular 中使用 finereport不显示报表直接打印预览,希望对大家有所帮助