How to modify CSS of Header in export files and to add empty row after Header in Export?

1.8k Views Asked by At

I am using Datatable Buttons extension and I want to modify Header with background color ,bold text, and font color. I tried below code but not working

 format: {
         //this isn't working....
         header:  function (data, columnIdx) { console.log(data);
              data = '<b>'+data+'</b>';
              return data;
         }
    }

Also, How to add empty row after the header in xls or CSV? Thanks

1

There are 1 best solutions below

0
On

The format part is just to filter the data contents. If you want to change the styles then you have to work it under the

customize: function (doc)

Under this section you need to override the tableHeader style and so on like this:

doc.styles['tableHeader'] = {
                            bold: true,
                            fontSize: 11,
                            color: 'white',
                            fillColor: 'blue',
                            alignment: 'center'

                        };

That's it. Your table header style will be changed accordingly. Hope this helps