我试图使用jsPDF从html表生成pdf . 由于不支持rowspan,我试图覆盖drawCell函数,如官方github中的示例所示:https://github.com/simonbengtsson/jsPDF-AutoTable/blob/master/examples/examples.js#L258 . 这是代码:

`
    drawCell: function (cell, data) {
        let rowspan = null;
        let text = '';
        if(cell.raw !== undefined){
          rowspan = cell.raw.getAttribute('rowspan');
          text = cell.raw.innerText;
        }
        if (rowspan === null || cell.raw === undefined) {
          rowspan = 1;
        }
        console.log(cell);
        doc.rect(cell.x, cell.y, data.table.width, cell.height * rowspan, 'S');
        doc.autoTableText(text, cell.x + cell.width / 2, cell.y + cell.height * rowspan / 2, {
          halign: 'center',
          valign: 'middle'
        });
        return false;
      }
    });

`这就是结果:
enter image description here