Pdfmake: Any option to change color of table border ?

Created on 2 Mar 2015  路  6Comments  路  Source: bpampuch/pdfmake

Is there any solution available to change table cell border color ?

Most helpful comment

Example from http://pdfmake.org/playground.html

layout: {
                                                        hLineWidth: function(i, node) {
                                                                return (i === 0 || i === node.table.body.length) ? 2 : 1;
                                                        },
                                                        vLineWidth: function(i, node) {
                                                                return (i === 0 || i === node.table.widths.length) ? 2 : 1;
                                                        },
                                                        hLineColor: function(i, node) {
                                                                return (i === 0 || i === node.table.body.length) ? 'black' : 'gray';
                                                        },
                                                        vLineColor: function(i, node) {
                                                                return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray';
                                                        },
                                                        // paddingLeft: function(i, node) { return 4; },
                                                        // paddingRight: function(i, node) { return 4; },
                                                        // paddingTop: function(i, node) { return 2; },
                                                        // paddingBottom: function(i, node) { return 2; }
                        }

All 6 comments

Example from http://pdfmake.org/playground.html

layout: {
                                                        hLineWidth: function(i, node) {
                                                                return (i === 0 || i === node.table.body.length) ? 2 : 1;
                                                        },
                                                        vLineWidth: function(i, node) {
                                                                return (i === 0 || i === node.table.widths.length) ? 2 : 1;
                                                        },
                                                        hLineColor: function(i, node) {
                                                                return (i === 0 || i === node.table.body.length) ? 'black' : 'gray';
                                                        },
                                                        vLineColor: function(i, node) {
                                                                return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray';
                                                        },
                                                        // paddingLeft: function(i, node) { return 4; },
                                                        // paddingRight: function(i, node) { return 4; },
                                                        // paddingTop: function(i, node) { return 2; },
                                                        // paddingBottom: function(i, node) { return 2; }
                        }

@jthoenes can this not be controlled on a cell by cell basis?

exactly like in the code above. Make your function react on the i param and you're there.

@jthoenes That's for the table as a whole, not controllable for each individual cell is it? Like how you can control what borders are visible or hidden per item?

Say I have a single cell somewhere in the table and I need the right vertical border to be 2 pixels. How can I achieve that with the above example.

@jthoenes @douglasg14b: I'm also interested how this can be done? I tried to loop through the nodes, rows and cells but this doesn't make sense or?

Hi, Did anyone face the same problem?
CaptureDash

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmatesic picture dmatesic  路  3Comments

SummerSonnet picture SummerSonnet  路  3Comments

kumarandena picture kumarandena  路  3Comments

sayjeyhi picture sayjeyhi  路  3Comments

davidyeiser picture davidyeiser  路  3Comments