Javascript 导出为PDF格式的表显示了混乱的数据
我使用这个插件将jquery和php填充的表中的行导出到PDF: 表结构:Javascript 导出为PDF格式的表显示了混乱的数据,javascript,php,jquery,pdf,Javascript,Php,Jquery,Pdf,我使用这个插件将jquery和php填充的表中的行导出到PDF: 表结构: <table class="table table-bordered table-striped" id="export"> <colgroup> <col width="40" /> <col width="*" /> <col width="*" /> <col width="*" /> <co
<table class="table table-bordered table-striped" id="export">
<colgroup>
<col width="40" />
<col width="*" />
<col width="*" />
<col width="*" />
<col width="*" />
</colgroup>
<thead>
<tr style="cursor:default;">
<th align="center" style="text-align:center;">No</th>
<th align="left" style="text-align:left;">Nama Usahawan</th>
<th align="left" style="text-align:left;">Nama Peniagaan</th>
<th align="left" style="text-align:left;">SSM No</th>
<th align="left" style="text-align:left;">Kluster Perniagaan</th>
<th align="left" style="text-align:left;">Created Date</th>
<th align="left" style="text-align:left;">District</th>
</tr>
</thead>
<tbody id="TBodyList">
<tr>
<td colspan="5" align="left" style="text-align:left;"> </td>
</tr>
</tbody>
</table>
以下是表格的显示方式:
摆脱colgroup,看看它是否看起来像better@dandavis,删除colgroup不会进行任何更改
<a href="#" target="_blank" onClick ="$('#export').tableExport({type:'pdf',escape:'false'});">[EXPORT TO PDF]</a> - refer to detail report!
<script type="text/javascript" src="<?php echo $BaseUrl; ?>js/tableExport.js"></script>
<script type="text/javascript" src="<?php echo $BaseUrl; ?>js/jquery.base64.js"></script>
<script type="text/javascript" src="<?php echo $BaseUrl; ?>js/jspdf/libs/sprintf.js"></script>
<script type="text/javascript" src="<?php echo $BaseUrl; ?>js/jspdf/jspdf.js"></script>
<script type="text/javascript" src="<?php echo $BaseUrl; ?>js/jspdf/libs/base64.js"></script>
$.fn.extend({
tableExport: function(options) {
var defaults = {
separator: ',',
ignoreColumn: [],
tableName:'export',
type:'pdf',
pdfFontSize:8,
pdfLeftMargin:5,
escape:'true',
htmlContent:'false',
consoleLog:'false'
};
});