[英]JsPDF, jsPDF-AutoTable wrapping row texts needed with overflow hidden
[英]jsPDF-AutoTable : Font-style "italic" for a specific row
我正在使用 jsPDF-AutoTable 插件來創建 pdf。 我有以下表結構:
<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>
帶有文本“電源開關設備和控制設備組件的檢查”的 td 應具有字體樣式“斜體”。 因此我嘗試了以下代碼:
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');
font-style 屬性更改,但 pdf 中的文本不是斜體。 我做錯了什么?
您可以使用doc.setFontStyle('italic');
在反應中,內聯樣式有效。 style={{ fontStyle: 'italic' }}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.