按钮点击事件JS:
var url = 'report?reportlets=';//定义url
//var todays=new Date();
var pars = '&format=excel&__filename__=横向BOM查询表';//设置导出格式和导出文件名称
var path = "${reportName}";//获取模板名称和路径
var FNUMBER1=_g().parameterEl.getWidgetByName('FNUMBER').getValue();
var FNUMBER2=FNUMBER1.replace(/\n/g,",");
var FNUMBER3=FNUMBER2.split(",");
//获取模板中参数值,以数组形式存储,每个参数值对应一个sheet
var json = [];
for (var i = 0; i < FNUMBER3.length; i++) {
var sheet = {
reportlet: path,
FNUMBER: FNUMBER3[i]
};
json.push(sheet);
}
jsonStr = encodeURIComponent(JSON.stringify(json));//对url进行encodeURIComponent编码
url += jsonStr;//给url添加模板参数
url += pars;//给url添加导出参数
window.open(url);sheet命名为对应单元格,