jspdfjspdf-autotable

Linebreak on jspdf and autotables cutting header name


I can't seem to figure out how to fix the header issue.

The TesterTitle Test header gets split in the middle of a word, is there a way to not split a word apart?

Or set a minimum width for a column?

https://jsfiddle.net/fdgxk60y/32/

I need to add code to this question to meet stackoverflows requirement...

startY: 20,
headerStyles: {fillColor: [51, 122, 183]},
theme: 'grid',
margin: {horizontal: 7},
styles: {overflow: 'linebreak'},
columnStyles: {text: {columnWidth: 'auto'}},

Solution

  • Although you can't specify min width, you can specify width. Does this fit your requirement?

    columnStyles: {text: {columnWidth: 'auto'}, longTitle: {columnWidth: 100}}

    or

    columnStyles: {text: {columnWidth: 'auto'}, longTitle: {columnWidth: 'wrap'}}

    or

    styles: {columnWidth: 'wrap'}
    columnStyles: {text: {columnWidth: 'auto'}}`