IcCube报表横向打印问题:自定义打印参数未生效如何解决?
问题描述
使用IcCube Reporting V8,通过ic3-reporting-api创建了包含横向布局的主题,基于该布局的报表在界面显示横向正常。添加两个打印按钮分别设置pageOrientation为landscape、layoutId为自定义布局ID,但调试发现打印参数未被识别:pageOrientation仍为portrait,layoutId仍为undefined。
相关代码配置
创建主题的布局代码
}, { layoutConfigId: 'My. A4 (Landscape) Layout', pageSize: { type: "known", name: "A4", }, pageOrientation: "landscape", pageMargin: { sizeUnits: "cm", ...
打印按钮配置
action, action@appNotificationType, action@appNotificationPayload Générer un PDF landscape,print-report,"{"paperSizeName":"A4","pageOrientation":"landscape","fileName":"Tableau de bord Salle A Landscape (@{DateSelected:asCaption}).pdf"}" Générer un PDF layoutId,print-report,"{"paperSizeName":"A4","layoutId":"My. A4 (Landscape) Layout","fileName":"Tableau de bord Salle A Landscape (@{DateSelected:asCaption}).pdf"}"
调试打印参数信息
01:31:05.276 [General] print options Object { inBrowser: false, withState: true, appUrl: "https://localhost:44361/icCube/report/editor", appLocalUrl: "dft", appCustomizationUrl: "-", timeoutS: 300, debugWaitingTimeS: 900, layoutId: undefined, fitToPage: true, fileName: "Tableau de bord Salle A Landscape (2021 nov.).pdf", … }
解决方案
问题根源在于打印按钮的CSV配置中,JSON payload的双引号未正确转义。CSV格式要求字段内的双引号必须用双引号进行转义,否则JSON解析失败,参数无法被正确读取。
修改后的打印按钮配置如下:
action, action@appNotificationType, action@appNotificationPayload Générer un PDF landscape,print-report,"{""paperSizeName"":""A4"",""pageOrientation"":""landscape"",""fileName"":""Tableau de bord Salle A Landscape (@{DateSelected:asCaption}).pdf""}" Générer un PDF layoutId,print-report,"{""paperSizeName"":""A4"",""layoutId"":""My. A4 (Landscape) Layout"",""fileName"":""Tableau de bord Salle A Landscape (@{DateSelected:asCaption}).pdf""}"
验证要点
修改后重新调试打印参数,应能看到pageOrientation变为landscape,layoutId正确填充为My. A4 (Landscape) Layout。额外可通过以下方式确认:
- 查看浏览器控制台的网络请求,确认打印接口的参数已正确传递
- 确保自定义布局ID与主题中定义的
layoutConfigId完全一致,注意大小写和特殊字符
内容的提问来源于stack exchange,提问作者Bertrand Miot
相关产品推荐
相关产品推荐

