页面树结构
转至元数据结尾
转至元数据起始

该宏示例在 V10.5上 验证通过

提示:本文档的示例代码仅适用于本文档中的示例报表/场景。若实际报表/场景与示例代码无法完全适配(如使用功能不一致,或多个宏代码冲突等),需根据实际需求开发代码。

示例说明

在透视分析的导出按钮中,提供多个导出选项,如HTML、EXCEL、CVS等。有时候希望只保留某一些选项,可通过宏代码控制实现。

使用宏之前的效果:

使用宏后的效果:

版本及客户端说明

1.smartbi版本:最新版本

2.客户端:PC

3.浏览器:IE11、谷歌浏览器(Chrome)、火狐浏览器(Firefox)

设置方法

1.创建业务主题 

2.创建透视分析报表

3.进入宏界面

在浏览器的“分析展现”节点下,选中新建的透视分析,右键选择 编辑宏 进入报表宏界面。

 

4.创建客户端宏

在报表宏界面新建客户端模块。在弹出的新建模块对话框中,选择对象为INSIGHT、事件为onRender、并把下面宏代码复制到代码编辑区域。

宏类型

类型

对象

事件

ClientSide

INSIGHT

onRender


宏代码

function main(insight) {
    insight._initExportMenu_new = insight.initExportMenu;
    insight.initExportMenu = function() {
        var DropDownBox = jsloader.resolve("freequery.control.DropDownBox");
        if (!this.exportMenu) {
            this.exportMenu = new DropDownBox(document.body);
            //this.exportMenu.insertItem("TXT", "TXT");
            //this.exportMenu.insertItem("CSV", "CSV");
            //this.exportMenu.insertItem("MHT", "HTML");
            this.exportMenu.insertItem("PDF", "PDF");
            this.exportMenu.insertItem("WORD", "WORD");
          
            }
           //this.exportMenu.insertItem("EXCEL2007", "EXCEL");
            this.exportMenu.onCloseUp.subscribe(this.doExportMenuCloseUp, this);
        }
    
    insight.old_doExport = insight.doExport;
    insight.doExport = function() {
        this.old_doExport();
        this.exportMenu.panel.style.height = "";
        //上面是高度自适应
    }
}

资源下载

资源:migrate.xml


提示:本文档的示例代码仅适用于本文档中的示例报表/场景。若实际报表/场景与示例代码无法完全适配(如使用功能不一致,或多个宏代码冲突等),需根据实际需求开发代码。

示例说明

在透视分析的导出按钮中,提供多个导出选项,如HTML、EXCEL、CVS等。有时候希望只保留某一些选项,可通过宏代码控制实现。

使用宏之前的效果:

使用宏后的效果:

版本及客户端说明

1.smartbi版本:最新版本

2.客户端:PC

3.浏览器:IE11、谷歌浏览器(Chrome)、火狐浏览器(Firefox)

设置方法

1.创建业务主题 

2.创建透视分析报表

3.进入宏界面

在浏览器的“分析展现”节点下,选中新建的透视分析,右键选择 编辑宏 进入报表宏界面。

 

4.创建客户端宏

在报表宏界面新建客户端模块。在弹出的新建模块对话框中,选择对象为INSIGHT、事件为onRender、并把下面宏代码复制到代码编辑区域。

宏类型

类型

对象

事件

ClientSide

INSIGHT

onRender


宏代码

function main(insight) {
    insight._initExportMenu_new = insight.initExportMenu;
    insight.initExportMenu = function() {
        var DropDownBox = jsloader.resolve("freequery.control.DropDownBox");
        if (!this.exportMenu) {
            this.exportMenu = new DropDownBox(document.body);
            //this.exportMenu.insertItem("TXT", "TXT");
            //this.exportMenu.insertItem("CSV", "CSV");
            //this.exportMenu.insertItem("MHT", "HTML");
            this.exportMenu.insertItem("PDF", "PDF");
            this.exportMenu.insertItem("WORD", "WORD");
          
            }
           //this.exportMenu.insertItem("EXCEL2007", "EXCEL");
            this.exportMenu.onCloseUp.subscribe(this.doExportMenuCloseUp, this);
        }
    
    insight.old_doExport = insight.doExport;
    insight.doExport = function() {
        this.old_doExport();
        this.exportMenu.panel.style.height = "";
        //上面是高度自适应
    }
}

资源下载

资源:migrate.xml