Pdfmake: Cell padding on specific cells

Created on 13 Oct 2016  路  4Comments  路  Source: bpampuch/pdfmake

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

feature request table

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] } } }

All 4 comments

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] }
}
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jkd003 picture jkd003  路  3Comments

svenyonson picture svenyonson  路  3Comments

MathLavallee picture MathLavallee  路  3Comments

Christian24 picture Christian24  路  3Comments

dgrice picture dgrice  路  3Comments