Git Product home page Git Product logo

Comments (5)

mmghv avatar mmghv commented on June 27, 2024

The styles options are not respected because useCss is set to true thus the CSS styles are used rather than the provided style options.

Although you commented out the CSS styles, the table still has CSS styles, even if you set padding: unset CSS rule, it will get parsed to 0px padding so cellPadding won't be respected.

When using cssStyle: true you should use CSS rules to style your table, if you want padding add padding in the CSS.

from jspdf-autotable.

vasilvalkov avatar vasilvalkov commented on June 27, 2024

Well, it is not the style options that are not respected. Only cellPadding is not respected. If I add this style fillColor: [100, 0, 100] to bodyStyles, it will be respected and applied, but cellPadding will not.

from jspdf-autotable.

mmghv avatar mmghv commented on June 27, 2024

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 to false, and theme to 'plain' and add the styles you want.

  useCss: false,
  theme: 'plain',

from jspdf-autotable.

vasilvalkov avatar vasilvalkov commented on June 27, 2024

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.
The only escape hatch I found so far that worked for me is borrowed from this SO answer where they used the didParseCell hook to override any styles using style options.

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on June 27, 2024

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.

from jspdf-autotable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.