Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jsPDF自动表格:字体样式;斜体字;对于特定行_Javascript_Jspdf_Jspdf Autotable - Fatal编程技术网

Javascript jsPDF自动表格:字体样式;斜体字;对于特定行

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>

我正在使用jsPDF自动表格插件创建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>
字体样式属性会更改,但文本在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');