温馨提示
本文档的示例代码仅适用于本文档中的示例报表/场景。若实际报表/场景与示例代码无法完全适配(如使用功能不一致,或多个宏代码冲突等),需根据实际需求开发代码。
示例说明
在组合分析的导出按钮中,提供多个导出选项,如HTML、EXCEL、CVS等。有时候希望只保留某一些选项,可通过宏代码控制实现。
版本及客户端说明
1.smartbi版本:最新版本
2.客户端:PC
3.浏览器:IE11、谷歌浏览器(Chrome)、火狐浏览器(Firefox)
设置方法
1.创建业务主题
2.创建透视分析报表
3.进入宏界面
在浏览器的资源定制节点下,选中新建的透视分析,右键选择 编辑宏 进入报表宏界面。
4.创建客户端宏
在报表宏界面新建客户端模块。在弹出的新建模块对话框中,选择对象为simpleReport、事件为onRender、并把下面宏代码复制到代码编辑区域。
宏类型
类型 | 对象 | 事件 |
---|---|---|
ClientSide | simpleReport | onRender |
宏代码
function main(simpleReport, simpleReportContext) { if(!simpleReport._initExportMenu_new){ simpleReport._initExportMenu_new = simpleReport.initExportMenu; simpleReport.initExportMenu = function() { // debugger; simpleReport._initExportMenu_new(); this.exportMenu.removeItem("TXT"); //屏蔽CSV this.exportMenu.removeItem("CSV"); //屏蔽CSV this.exportMenu.removeItem("MHT"); //屏蔽HTML this.exportMenu.removeItem("PNG"); //屏蔽PNG this.exportMenu.removeItem("PDF"); //屏蔽PDF this.exportMenu.removeItem("WORD"); //屏蔽WORD var t = this; setTimeout(function() { // 异步插入到最后的也要异步删除 t.exportMenu.removeItem('DATAPACKAGE'); }, 0); } } //debugger; if(!simpleReport.old_doExport){ simpleReport.old_doExport = simpleReport.doExport; simpleReport.doExport = function(ev) {debugger; this.old_doExport(ev); debugger; this.exportMenu.panel.style.height = ""; //上面是高度自适应 } } }