JSPdf autotable header border

8.5k views Asked by At

How to create border in Header? I am using jspdf autotable to create table but cannot find any idea to apply border to header. Is there any hook that can be used to create header border?

2

There are 2 answers

2
Simon Bengtsson On BEST ANSWER

You can use the header styles:

doc.autotable(columns, data, {
    headerStyles: {
        lineWidth: 1,
        lineColor: [255, 0, 0]
    }
});
0
Fernando Flores On

As of today (version 3.5.25) the property name is headStyles and still different border widths is not supported.

Example:

    autoTable(doc, {
        headStyles: {
            lineWidth: 0.5, // 1 is too thick for me
            lineColor: [255, 0, 0] // Or gray level single value from 0-255
        }
    })

I use the imported method version (autoTable) in TypeScript.