jsPDF-AutoTable icon indicating copy to clipboard operation
jsPDF-AutoTable copied to clipboard

Linebreaks in header working but height of header not increasing

Open ankur2728 opened this issue 11 years ago • 5 comments

Linebreak is allowing Headers to break in the next line but height of the header does not increase. Please let me know the urgent fix. If it requires much time to fix, then please let me know how can i set the width of each column. I am using HTML table to export it into pdf. Please assist as soon as possible.

Thanks

ankur2728 avatar Jun 16 '15 16:06 ankur2728

It works in the example I set up here. Can you post the code you are using where it doesn't work? To set custom column widths you would have to loop over the columns extracted by the autoTableHtmlToJson function and create an array of objects on this format:

var columns = [
    {title: "ID", key: "id", width: 100},
    {title: "Name", key: "name", width: 200},
    ...
];

simonbengtsson avatar Jun 16 '15 23:06 simonbengtsson

Hi..i am.able to download file in IE11. Headers height is not increasing in ie 11 . It is working in chrome and firefox. As the resuly broken characters are hiding. So thinking of adjusting with custom width.

Thanks

ankur2728 avatar Jun 17 '15 19:06 ankur2728

Nothing special in code..simple html table with no css applied..used simple code given in your samples

ankur2728 avatar Jun 17 '15 19:06 ankur2728

Hi, I agree with ankur2728: the line height calculation of headers doesn't always work correctly. Reason: splitTextToSize() takes the current font style into account, when it decides to split a text line. The default output function for header cells (renderHeaderCell) uses a bold font style, which also needs to be set before calculating the rowHeight value. This effect only occures if the text would fit into the cell when a normal font style is set, but does not fit when the style is set to bold. See also changes in pull request https://github.com/someatoms/jsPDF-AutoTable/pull/46

hhurz avatar Jun 24 '15 14:06 hhurz

This should now be fixed in version 2.0.

simonbengtsson avatar Aug 24 '15 20:08 simonbengtsson