我创建了一个自定义行,并希望将其放在表头上方。 我怎么能这样做? see custom row ,我从示例中得到了这个,有人可以帮助我吗?在这里我的代码:
doc.autoTable(columns, rows, {
theme : 'grid',
styles: {
halign: 'right'
},
headerStyles: {
fillColor: [33, 150, 243],
halign:'center'
},
margin : {
top : 100
},
columnStyles:{
0: {halign:'left'}
},
createdCell: function(cell, data) {
if (data.row.index === 0 || data.row.index === 3 ||data.row.index === 6 ||data.row.index === 9
|| data.row.index === 12 || data.row.index === 13 || data.row.index === 14) {
cell.styles.fontStyle = 'bold';
cell.styles.fillColor = [255,251,204];
}
},
drawRow: function (row, data) {
// Colspan
doc.setFontStyle('bold');
doc.setFontSize(20);
if (row.index === 0) {
doc.setTextColor(200, 0, 0);
doc.rect(data.settings.margin.left, row.y, data.table.width, 20, 'S');
doc.autoTableText("Raportage Handelsregister", data.settings.margin.left + data.table.width / 2, row.y + row.height / 2, {
halign: 'center',
valign: 'middle',
});
data.cursor.y += 20;
}
}
});