排除jsPDF AutoTable中的列 [英] Exclude Columns in jsPDF AutoTable

查看:198
本文介绍了排除jsPDF AutoTable中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具有使用jsPDF autoTable从表中排除pdf结果列的经验.

Has somebody experience excluding the columns in the pdf result from a Table using jsPDF autoTable..Would appriciate a little help.

推荐答案

无论如何,在深入研究API和示例之后.我找到了解决方案.带有autoTable的jsPDF对于初学者来说特别棘手,因此对于那些在不久的将来会遇到这种困境的人来说非常棘手.方法如下:

Anyway, after digging deep in the API and in the examples. I found a solution. jsPDF with autoTable is kinda tricky specially for beginners so for those who will bump in to this predicament in the near fututre. Here's how:

var tTB = document.getElementById("myTable");
var atTB = doc.autoTableHtmlToJson(tTB, true);
var cols = atTB.columns;
//here you are going to set which column you will truncate. Moreover, .splice(index number of the column(your start), the number of columns you will exclude)
cols.splice(4,1); 
doc.text("My Test Table", 40, 60);
doc.autoPrint();

欢呼!

这篇关于排除jsPDF AutoTable中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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