1

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 Answers 2

7

You can use the header styles:

doc.autotable(columns, data, { headerStyles: { lineWidth: 1, lineColor: [255, 0, 0] } }); 
Sign up to request clarification or add additional context in comments.

2 Comments

Nice Simon!... but I've a question: What about if I want to only add the top and bottom borders?
Not supported by the library right now as far as I know.
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.