帮助文档里面搜索到的宏代码,但是应用后没有效果
function main(spreadsheetReport) { // 获取报表客户名称参数,根据参数名称获取 var customerName = spreadsheetReport.getParameterValue("客户名称"); if (!spreadsheetReport.generateExportDialogProps0620) { spreadsheetReport.generateExportDialogProps0620 = spreadsheetReport.generateExportDialogProps; spreadsheetReport.generateExportDialogProps = function(typeId) { var data = this.generateExportDialogProps0620(typeId); // 自定义文件名 var customFileName = customerName + "_" + new Date().toISOString().slice(0, 10); data.items[0].value = customFileName; return data; }; } // 调试信息 console.log("Customer Name: " + customerName); console.log("Custom File Name: " + customFileName); } |