2016-04-08 11 views
1

Rowspan/colspan ile bir html tablom var. Bu html tablosunu pdf'ye aktarmak için jspdf ve jspdf-autotable kullanıyorum. Ancak kaydedilen pdf gerçek tabloda rowspan/colspan içermeyen bir tabloya sahiptir.Nasıl jspdf-autotable kullanarak colspan/rowspan yapmak için? Bulunduğum kod eklentisi html otomatik liman colspans ve rowspans için desteklemezJSPDF-Autotable colspan/rowpan issue

<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <title id='title'>HTML Page setup Tutorial</title> 
     <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script> 
<script src="https://rawgit.com/someatoms/jsPDF-AutoTable/master/dist/jspdf.plugin.autotable.js"></script> 

     <script type="text/javascript"> 
function myFunction() 
{ 

var doc = new jsPDF('p', 'pt'); 

    var res = doc.autoTableHtmlToJson(document.getElementById("my-table")); 
    doc.autoTable(res.columns, res.data, {startY: 40}); 
    doc.save("Report.pdf"); 
} 

</script> 
    </head> 
    <body> 
<table border='1' id="my-table"> 
<thead> 
<tr> 
     <th>A</th> 
     <th>B</th> 
     <th>C</th> 
</tr> 
</thead> 
<tbody> 
<tr> 
<td rowspan='2'>D</td> 
<td colspan='2'>$100</td> 

</tr> 
<tr> 
<td >E</td> 
<td >F</td> 

</tr> 
</tbody> 
</table> 
    <button type="button" onclick="myFunction()">Click Me!</button> 
    </body> 
</html> 

cevap

1

olduğunu. Ancak bunu manuel olarak yapabilirsiniz. Bu example (bir demo here) göz atın.