我似乎无法弄清楚如何解决标题问题。
TesterTitle 测试标题在单词中间被拆分,有没有办法不拆分单词?
或者设置列的最小宽度?
https://jsfiddle.net/fdgxk60y/32/
我需要向此问题添加代码以满足堆栈溢出要求...
startY: 20,
headerStyles: {fillColor: [51, 122, 183]},
theme: 'grid',
margin: {horizontal: 7},
styles: {overflow: 'linebreak'},
columnStyles: {text: {columnWidth: 'auto'}},
虽然不能指定最小宽度,但可以指定宽度。这符合您的要求吗?
columnStyles: {text: {columnWidth: 'auto'}, longTitle: {columnWidth: 100}}
或
columnStyles: {text: {columnWidth: 'auto'}, longTitle: {columnWidth: 'wrap'}}
或
styles: {columnWidth: 'wrap'}
columnStyles: {text: {columnWidth: 'auto'}}`
我遇到了同样的问题,并仅使用以下 headStyle 修复了它:
headStyles: { cellWidth: 'wrap' },
例:
autoTable(
doc, {
headStyles: {
cellWidth: 'wrap'
},
columns,
body
})
以下是您可以使用的其他样式: https://github.com/simonbengtsson/jsPDF-AutoTable#styling-options