用jsPDF渲染表格 [英] rendering tables with jsPDF

查看:136
本文介绍了用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渲染表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆