本文介绍了用jsPDF渲染表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用jsPDF渲染表,并且使用了,但是问题是,如果文本大于单元格边框,则该文本将超出单元格的范围.是否有一种简单的方法来截断文本或使单元格的高度更大以适合内部的所有文本?
I am trying to render a table using jsPDF and I used this code from here but the problem is if the text is bigger than the cell borders, it goes outside the cell. Is there an easy way to make the text truncate or make the cell bigger in height to fit all the text inside ?
$.each(table, function (i, row){
console.debug(row);
$.each(row, function (j, cell){
doc.cell(10, 50,120, 50, cell, i);
})
})
推荐答案
我发现jsPDF缺少对表格的总体支持,所以我做了一个插件.如果列的宽度超过页面的宽度,则它具有截断文本的功能.一探究竟! jspdf-AutoTable
I found that the support for tables overall is lacking in jsPDF so I made a plugin. It features truncate of text if the column widths exceeds the page width among other things. Check it out! jspdf-AutoTable
这篇关于用jsPDF渲染表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!