-
-
Notifications
You must be signed in to change notification settings - Fork 530
feat: support new table properties in PDF export #1475
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
table headers are not supported atm because they require modifying the run of the paragraph to make the cell's content bold.
Table paragraph color seems to not be working at the moment either, maybe to do with the inheritance of paragraph within a paragraph's color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rowspan & colspan change up how this layouting would work, I think we'd need to rewrite this completely to allow them to be supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pdfkit just merged this last week: foliojs/pdfkit#1577 which hopefully should solve a lot of edge cases related to tables.
I'm checking with the author of react-pdf: diegomura/react-pdf#3110
cell.props.textAlignment | ||
); | ||
})(), | ||
run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- you could add "bold" here as well for headers
My guess why it's not working might be because the children of the paragraph overwrite all the styles. You could break / log here to confirm:
If that's not the case, then maybe the styles don't inherit the nested runs and we'd need to find another way.
lmk if you need help with digging in further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, when I looked into it, I think it is because the children overwrite the styles. So would need to somehow spread that change to the children (like implementing a sort of inheritance).
This adds support for table cell text & background color, alignment, and header cells to the PDF export of tables.
One thing this does not support at the moment is rowspan & colspan tables, with the current approach it looks like it would take a good amount of work to get this to export properly