securedeveloper / react-data-export

Export dataset in react.
https://securedeveloper.github.io/react-data-export/
MIT License
179 stars 198 forks source link

FEATURE: Make header cell stylable. #88

Open egertaia opened 6 years ago

egertaia commented 6 years ago

My reason:

I Would like for it to be possible to actually style the header cells.

Steps to reproduce:

Make style passable into the header cell. Currently: image Possibility:

function getHeaderCell(v, cellRef, ws, style) {
    var cell = {};

    var headerCellStyle = {font: {bold: true}};
    cell.v = v;
    cell.t = 's';
    if(style && style !== undefined){
        cell.s = style;
    } else {
        cell.s = headerCellStyle;
   } 
    ws[cellRef] = cell;
}

And usage is, that you pass in col.style without typechecking, if it is not set, it is undefined, thus defaultstyle (perhaps rename headerCellStyle to defaultStyle) will be applied. As I can't get the whole package to submit the pull request currently, i typed this out on a mobile. I'm sorry if it is not understandable.

Lib Version: Latest