advisr-io / excel4node

Node module to allow for easy Excel file creation
MIT License
128 stars 21 forks source link

Set cell backgrounds by createStyle not working #88

Open lRoberth opened 10 months ago

lRoberth commented 10 months ago

Describe the bug Set cell backgrounds by createStyle not working

To Reproduce Run next code `var style = workbook.createStyle({ font: { color: '#FF0800', size: 12 }, numberFormat: '$#,##0.00; ($#,##0.00); -' });

var style2 = workbook.createStyle({ fill: { type: 'pattern', pattern: 'solid', fgColor: '#f20202', // Foreground color bgColor: '#f20202', // Background color }, font: { color: '#10c8c8', size: 10, } });

worksheet2.cell(1,1).string("#").style(style2); worksheet2.cell(1,2).string("Full Legal Name").style(style); worksheet2.cell(1,3).string("Job Title").style(style2); worksheet2.cell(1,4).string("Market").style(style2); worksheet2.cell(1,5).string("Location Type").style(style2); worksheet2.cell(1,6).string("Termination Date").style(style2);

workbook.write('Excel.xlsx');`

This will not apply red colors to the cell at style2, it keeps it white.

Expected behavior Color should be applied to cell

Environment (please complete the following information):

Additional context There are no environment errors