angular - 如何在pdfmake中动态创建列表
问题描述
我正在尝试在角度应用程序中使用pdfmake创建 pdf 中的问答列表。我按以下模式设置问答部分:
{
text:
this.questionService.questions.
Questions['sub-section']
[0].questions[0].details['question-alt-
description'] + '\n', bold: true
},
{
style: 'tableExample',
table: {
style: 'table1',
widths: ['*'],
body: [
[{ text :
this.questionService.qanda.find(x => x.ActId == 647).ActVal == '' ? '\n'
: this.questionService.qanda.find(x => x.ActId == 647).ActVal === "No" ?
'Function for dependent question' : 'This should not print the
dependent question' ,
}]
]
}
},
现在,情况是,如果我为上述问题选择否,则应该出现一个从属问题,否则它不应该出现。我尝试过的如下:
function builddependentquestion_1(data, columns) {
const body = [];
body.push([{
text : 'The question i want to print',
rowSpan: 1,
fillColor: '#ffffff',
bold: true,
border: [false, false, false, false]}
]);
return body;
}
function tabledependentquestion_1(data, columns) {
return {
table: {
body: builddependentquestion_1(data, columns)
}
};
}
我正在使用上述三元运算符中的函数,但它失败了。任何人都可以帮助解决这个问题。提前致谢。
解决方案
推荐阅读
- prolog - 如何在 Prolog 中总结多个列表
- python - 有没有办法根据一组条件在数据框中添加空行?
- amazon-web-services - AWS Kubernetes:将同一命名空间中的一组 Pod 部署到 Fargate,将其他 Pod 部署到 EC2 节点组?
- r - 在 R 中使用 ggplot2 绘制数据框
- windows - 我们如何在 Powershell 中的 HttpClient 对象上添加 DefaultRequestVersion?
- python - Pycurl 已安装在我的计算机上,但在 PyCharm 中无法识别或找到
- php - 如何在 laravel 8 中制作复杂的多态关系?
- node.js - WebStorm 出现问题,错误:EPERM:不允许操作
- python - 大熊猫在grouby之后按日期时间过滤
- java - Java如何模拟灯的开或关?