I have tried this link for getting multiple headers
download() {
var columns = ["ID", "Country", "Rank", "Capital"];
var data = [
[1, "Denmark", 7.526, "Copenhagen"],
[2, "Switzerland", 7.509, "Bern"]
];
var pdfsize = 'a0';
var doc = new jsPDF('l', 'pt','a0');
doc.autoTable(columns, data, {
theme : 'grid',
styles: {
halign: 'right'
},
headerStyles: {
fillColor: [33, 150, 243],
halign:'center',
lineWidth: 1,
lineColor: [221, 221, 221]
},
columnStyles:{
0: {columnWidth: 266}
},
margin : {
top : 100
}
});
var columns2= ["ID","Rank", "Country","Rank", "ID", "Rank","ID", "Capital"];
doc.autoTable(columns2, data, {
theme : 'grid',
styles: {
halign: 'right'
},
headerStyles: {
halign:'center',
lineWidth: 1,
lineColor: [221, 221, 221]
},
margin : {
top : 120
},
columnStyles:{
0: {halign:'left'}
},
});
doc.save('table.pdf'); };
}
这是我为jspdf-autotable尝试过的代码。我需要这样的多个标题表。我需要两个标题如何将这些标题映射到一起你能不能请我这个。我无法映射这些标题,如下图所示。
答案 0 :(得分:0)
在v3中,开箱即用地支持多个标头和colspans / rowspans,因此无需黑客。