と を使用して、テーブルに基づいて PDF ドキュメントを作成しjsPDF
ますAutoTable
。
var doc = new jsPDF('p', 'pt');
//columns and rows are arrays created from the table content
doc.autoTable(columns, rows, {
drawRow: function (row) {
if (row.index == rows.length - 1) {
console.log('last row');
//TODO
}
},
pageBreak: 'avoid',
headerStyles: {
fillColor: [239, 154, 154],
textColor: [0, 0, 0],
halign: 'center'
},
bodyStyles: {
halign: 'center'
},
margin: {top: 60},
theme: 'striped'
});
doc.save('table.pdf');
私がやろうとしているのは、最後のテーブル行に別の背景色を設定することです。上記のコードに示すように、最後の行がいつ描画されているかを検出できますが、それを変更することはできません。row.fillColor
RGB値を使用して設定しようとしましたが、効果がないようです。
私も例を見ましたが、その問題に役立つものは何も見つかりませんでした。何か案は?