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

Header cell alignment via CSS is ignored

Open bes1002t opened this issue 5 years ago • 5 comments

My CSS code for the header seems to be ignored, when generating the PDF using doc.autoTable({ html: '#my_id table', useCss: true })

The CSS (less) code is quite simple:

table {
    width: 100%;
    height: auto;
    display: block;

    th, td {
        text-align: center;
        width: 100%;
        padding: 8px;
    }
}

THis is how it looks like on my Page: table_correct

This is how it looks like in the PDF: table_wrong

bes1002t avatar Feb 11 '21 11:02 bes1002t

My header columns text are not aligned properly if the table has more data image

Its is not aligned properly is there any text-wrap property available

SathishRavichandran avatar Apr 28 '22 12:04 SathishRavichandran

I'm seeing similar behavior to this in which text wrap breaks in the middle of words instead of between words. This issue appears to be going on a year without response. Any updates?

eighties8 avatar Apr 06 '23 22:04 eighties8

If you create a PR adding support for it @bhamscott I can review it promptly.

simonbengtsson avatar Apr 07 '23 05:04 simonbengtsson

If you create a PR adding support for it @bhamscott I would review it promptly.

Thanks! I've had a brief look through the code but I don't yet see an obvious refactor to resolve this. Have you done any work on this to suggest a viable approach?

I have offered a suggested approach to fix the issue in the issue thread I started. Take a look and perhaps we can discuss it there. I'm willing to give it a shot if you think its doable and can perhaps give me some direction based on your prior work here.

eighties8 avatar Apr 07 '23 13:04 eighties8

@SathishRavichandran @eighties8 What are your thoughts about this?

width algorithm v3 vs v4

mmghv avatar May 05 '24 15:05 mmghv