我只想在我的评论栏中使用溢出:“换行符”选项这是我的代码
var columns = [
{ title: "Date", dataKey: "date" },
{ title: "User", dataKey: "user" },
{ title: "Issue", dataKey: "issue" },
{ title: "Hours", dataKey: "hours" },
{ title: "Comment", dataKey: "comment" }
];
var rows = [];
for (let i = 0; i < this.reports.length; i++) {
var element = {
date: 5,
user: 5,
issue: 3,
hours: 2,
comment:"dsfsudihfusidfhsyudfyhdysuyfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
};
rows.push(element);
}
var options = {
overflow: "linebreak"
}
var doc = new jsPDF();
doc.autoTable(columns, rows, {
startY: doc.autoTable.previous.finalY + 15,
margin: { horizontal: 7 },
bodyStyles: { valign: 'top' },
styles: { overflow: 'linebreak', columnWidth: 'wrap' },
columnStyles: { text: { columnWidth: 'auto' } }
});
doc.save('table.pdf');
我从他们的示例文件中复制了这个解决方案https://github.com/simonbengtsson/jsPDF-AutoTable/blob/master/examples/examples.js