【发布时间】:2018-06-18 13:53:20
【问题描述】:
我正在尝试为我的表格添加宽度,但由于某种原因我得到以下错误:
Component.html:187 ERROR TypeError: Cannot set property '_minWidth' of undefined at DocMeasure.measureTable (pdfmake.js:4487)
at pdfmake.js:4012
at StyleContextStack.auto (pdfmake.js:6069)
at DocMeasure.measureNode (pdfmake.js:3999)
at DocMeasure.measureVerticalContainer (pdfmake.js:4216)
at pdfmake.js:4006
at StyleContextStack.auto (pdfmake.js:6069)
at DocMeasure.measureNode (pdfmake.js:3999)
at DocMeasure.measureDocument (pdfmake.js:3992)
at LayoutBuilder.tryLayoutDocument (pdfmake.js:3120)
at LayoutBuilder.layoutDocument (pdfmake.js:3107)
at PdfPrinter.createPdfKitDocument (pdfmake.js:2383)
at Document._createDoc (pdfmake.js:105)
at Document.getBuffer (pdfmake.js:243)
at Document.getBlob (pdfmake.js:233)
问题行
widths: ['auto', 'auto', 'auto', 'auto'],
我的文档定义
var docDefinition = {
content: [
{text: 'Section A: Facilities and Ambience', style: 'sectionStyling'},
{
style: 'tableExample',
table: {
widths: ['auto', 'auto', 'auto', 'auto'],
body: [
['col1', 'col2', 'col3', 'col4', 'col5'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-'],
['some text', '1', '1', '100%', '-']
]
}
}
],
background: function () {
return [
{
image: 'watermark',
width: 200,
alignment : 'center',
margin: [0, 325, 0, 0]
}
];
},
images: {
watermark: 'data:image/base64....'
},
styles: {
sectionStyling: {
fontSize: 18,
color: 'blue',
bold: true,
alignment: 'right',
margin: [0, 190, 0, 80]
},
subheader: {
fontSize: 14
},
superMargin: {
margin: [20, 0, 40, 0],
fontSize: 15
}
},
defaultStyle: {
alignment: 'justify'
}
};
我试过了(以下都没有):
widths: ['auto', 'auto', 'auto', 'auto'],
widths: ['auto', 'auto', 'auto'],
widths: [100, '*', 200, '*'],
It works if I just remove the widths line.
【问题讨论】:
标签: javascript json angular pdfmake