是否有任何选项可以填充列背景颜色fillColor: '#dedede'
?
fillColor在表格单元中工作得很好,同时它不适用于列:(
<script src="https://rawgit.com/bpampuch/pdfmake/master/build/vfs_fonts.js"></script>
<script src="https://rawgit.com/yelouafi/pdfmake/master/build/pdfmake.js"></script>
<script>
function print(argument) {
// open the PDF in a new window
pdfMake.createPdf(docDefinition).open();
}
</script>
<button onclick="print()" style="display:block; margin: 10px auto;padding: 20px 50px;">Print</button>
<hr>
<script>
var docDefinition = {
content: [
'This paragraph fills full width, as there are no columns. Next paragraph however consists of three columns', {
columns: [{
// auto-sized columns have their widths based on their content
width: 'auto',
text: 'First column',
fontSize: 30,
fillColor: '#dedede'
}, {
// star-sized columns fill the remaining space
// if there's more than one star-column, available width is divided equally
width: '*',
text: 'Second column'
}, {
// fixed width
width: 100,
text: 'Third column'
}, {
// percentage width
width: '10%',
text: 'Last column'
}],
// optional space between columns
columnGap: 10
},
'This paragraph goes below all columns and has full width'
]
};
</script>