Hi,
Is there a way to specify cell padding left or cell padding right on cetain cells, for example:
body: [
[
{ text: 'cell1', },
{ text: 'cell2', paddingLeft: 25 },
{ text: 'cell3', paddingLeft: 50 },
]
]
Any help is appreciated,
Thanks
Have almost the same question! @arsinawaz do you find some solutions?
@vladPovalii i have a work around by creating another table inside the cell wiht no borders and give the needing amount of padding as width of the first column in inner table, check the code below of the inner table:
{
table: {
widths: [25 * parseInt(e.getAttribute("rowLevel")), '*'],
body: [
[ '', {
text: e.innerText,
style: e.nodeName.toLowerCase()
}
]
]
},
layout: 'noBorders'
}
oh, I have found solution. For each cell you can specify a style, with padding settings
var dd = {
content: [
{ text: 'Tables', style: 'header' },
{
style: 'tableExample',
table: {
body: [
[{text: 'Column 1', style: "atata"}, 'Column 2'],
['One value goes here', 'Another one here']
]
}
}
],
styles: {
atata: {
margin: [20, 0, 0, 10]
},
tableExample: {
margin: [0, 5, 0, 15]
}
}
}
Taking @vladPovalii 's example, a little easier to read and with an inline example
```
var dd = {
content: [
{ text: 'Tables', style: 'header' },
{
style: 'tableExample',
table: {
body: [
[ {text: 'Column 1', style: "atata"}, 'Column 2' ],
[ 'One value goes here', 'Another one here' ],
[
'Another one here',
{ text: 'Inline example HERE', margin: 30 },
],
]
}
}
],
styles: {
atata: { margin: [20, 0, 0, 10] },
tableExample: { margin: [0, 5, 0, 15] }
}
}
Most helpful comment
oh, I have found solution. For each cell you can specify a style, with padding settings
var dd = { content: [ { text: 'Tables', style: 'header' }, { style: 'tableExample', table: { body: [ [{text: 'Column 1', style: "atata"}, 'Column 2'], ['One value goes here', 'Another one here'] ] } } ], styles: { atata: { margin: [20, 0, 0, 10] }, tableExample: { margin: [0, 5, 0, 15] } } }