How to fill column background color for pdfmake with fillColor?

Mo. picture Mo. · Feb 27, 2015 · Viewed 13.6k times · Source

Is there any option to fill column background color with fillColor: '#dedede' ? fillColor works in tablecell very well at the same time it doesn't work for column :(

Answer

RandomUser picture RandomUser · Jun 10, 2015

I have not gotten apply background color to columns. I think the only option you have is to use tables.

Below this lines I have attached a simple code that you can paste directly at pdfmake playground in order to try it.

Good luck!

    var dd = {
    content: [
        'This paragraph fills full width, as there are no columns. Next paragraph however consists of three columns', 
        {
            style: 'section',
            table: {
                widths: [ '15%',  '*',  '35%'],
                body: [
                    [ 
                        {
                          text: 'first column',
                          fillColor: '#555555',
                          color: '#00FFFF',
                        },
                        {
                          text: 'second column',
                          color: '#555555',
                          fillColor: '#dedede'
                        },
                        {
                          text: 'third column',
                          fillColor: '#555555'
                        }
                    ]
                ]
            },
            layout: 'noBorders'
        }
    ],
    styles: {
        section: {
            fontSize: 9,
            color: '#FFFFFF',
            fillColor: '#2361AE',
            margin: [0, 15, 0, 5]
        }
    },
    defaultStyle: {
        alignment: 'center'
    }
}