-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
wip: Add support for tables #1577
base: master
Are you sure you want to change the base?
Conversation
- Enable defining sizes using any units (defaulting to Points) - This also allows us to define sizes based on the current font context i.e. em's - The new public `sizeToPoint` method allows users to also interact with these sizes to generate the correct point sizes
- Tables support cell customization (including colors) - Add handy alias for pages to define the contentWidth and contentHeight
I've just noticed @blikblum had added some visual test for pdfmake, was there any indication as to if we were wanting the table interface to be similar to pdfmakes? |
Great feature! Tables are really the one thing I was missing in await doc.table({
rows: 2,
height: 100,
width: 10 + 20 + 30,
cellWidth: [10, 20, 30],
})
.row([
{
value: 'A',
cellWidth: 10,
width: 10,
},
{
value: 'B',
cellWidth: 20,
width: 20,
},
{
value: 'C',
cellWidth: 30,
width: 30,
},
])
.row([
'D',
'E',
'F'
]) |
No way to do column width atm but there is colspan support |
@MatthijsReyers originally I implemented the table logic to follow along with how HTML tables are generated, but I'm thinking of rewriting the table generation logic to follow more along with the pdfmake approach, allowing us to define column widths instead of number of columns (with auto support of course). |
What kind of change does this PR introduce?
doc.table()
supportChecklist:
Resolves #29
Builds off #1576 (allowing a cell to set a temporary font inside the context of its contents, reverting back after)