-
-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] cellPadding not respected for unstyled table #1020
Comments
The styles options are not respected because Although you commented out the CSS styles, the table still has CSS styles, even if you set When using |
Well, it is not the style options that are not respected. Only |
You will find that some styles may apply like fillColor because the background color is none, but most won't because CSS styles will override it, so this isn't a bug really. If you want to style the table yourself with style options, set useCss: false,
theme: 'plain', |
I want both of them - CSS and style options - and assumed that style options override CSS, but it appears to be the opposite. I create the PDF from dynamic tables that bring their own styles I want to keep, like fonts, colors, etc. But I also want to have equal styles for all tables like the cell padding. |
I think it also make sense that options override html parsing. But as mentioned above right now the plugin might override some values either incorrectly. |
When I create a PDF using the
html
property and the theme styles turned off,cellPadding
values are ignored when calculating column widths. The result is cells contents touches together like this:Here is a minimal reproduction in CodePen. I've commented out all the styles and in the HTML rendered table there is a small gut between columns (probably added by the browser), but when I export this to PDF this gut is gone and table looks like in the above picture.
In the reproduction I've set
cellPadding: { left: 1, right: 1 }
in allstyles
,bodyStyles
, andheadStyles
, and also in thewillDrawCell
hook - all with no effect.Here are the versions I use
in my real project
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.7.1",
in the CodePen
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.8.1",
The text was updated successfully, but these errors were encountered: