我做了一个自定义行,想把它放在表格标题上方。我怎样才能做到这一点?查看自定义行,我从示例中得到了这个,有人可以帮我吗?这是我的代码:
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;
}
}
});