Javascript jsPDF自动表格:字体样式;斜体字;对于特定行
我正在使用jsPDF自动表格插件创建pdf。 我有以下表格结构:Javascript jsPDF自动表格:字体样式;斜体字;对于特定行,javascript,jspdf,jspdf-autotable,Javascript,Jspdf,Jspdf Autotable,我正在使用jsPDF自动表格插件创建pdf。 我有以下表格结构: <table id="TableTest" class="MainTable"> <tbody> <tr> <th>Vorgang</th> <th></th> <th style="width:80px; " >nicht<br/>relevant</th>
<table id="TableTest" class="MainTable">
<tbody>
<tr>
<th>Vorgang</th>
<th></th>
<th style="width:80px; " >nicht<br/>relevant</th>
<th>in<br/>ordnung</th>
</tr>
<tr>
<td rowspan="2">1.</td>
<td>Durchsicht der Schaltgerätekombination</td>
<td rowspan="2">
</td>
<td rowspan="2">
</td>
</tr>
<tr>
<td>Inspection of the power switchgear and controlgear assemblies</td>
</tr>
</tbody>
字体样式属性会更改,但文本在pdf中不是斜体。
我做错了什么?您可以使用
doc.setFontStyle('italic')代码>您可以使用doc.setFontStyle('italic')代码>
doc.autoTable
({
head: [['Vorgang', ' ', 'Geprüft']],
body: allelements,
startY: 60,
font: 'times',
styles:
{
fontSize: 7,
minCellHeight: 3,
cellWidth: 'wrap'
},
willDrawCell: function(cell, data)
{
if(cell.row.cells[1].text[0] == "Inspection of the power switchgear and controlgear assemblies"){
cell.cell.styles.fontStyle = "italic";
console.log(cell);
}
},
headStyles:
{
fillColor: [55,55,55]
},
theme: "grid" //plain grid (oder freilassen)
});
doc.save('EFPruefprotokoll.pdf');