Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Style not working properly in addConditionalFormattingRule #147

Closed
Greenns opened this issue Nov 15, 2017 · 1 comment
Closed

Style not working properly in addConditionalFormattingRule #147

Greenns opened this issue Nov 15, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@Greenns
Copy link

Greenns commented Nov 15, 2017

Hi,

BackgroundColor not working with addConditionalFormattingRule() but other style options work fine.

See gist : https://gist.github.com/Greenns/2c323fb366f84f577a60bb115871c063

For the same style:
first cell with addConditionalFormattingRule() and the second with cell().style():

Excel xml file does not have the bgcolor, only the font color is present

<Condition>
    <Value1>test!RC[16379]&lt;test!RC[16380]</Value1>
    <Format Style='font-size:12.0pt;color:#F00000;font-family:Calibri'/>
</Condition>
@natergj natergj added the bug label Nov 17, 2017
@natergj natergj self-assigned this Nov 17, 2017
@natergj natergj added this to the 1,3,1 milestone Nov 17, 2017
natergj added a commit that referenced this issue Nov 25, 2017
resolves issue 147: #147
@natergj
Copy link
Owner

natergj commented Nov 25, 2017

Fix has now been pushed to NPM with version 1.3.1

I did also need to make an update to the README. It looks like bgColor is required for conditional format fills. in your gist, you'll need to add that as the same color as your fgColor

var myStyle = wb.createStyle({
  font: {
    color:'#F00000',
  },
  fill: {
    type:'pattern',
    patternType:'solid',
    fgColor:'#FFFF00',
  },
});

becomes

var myStyle = wb.createStyle({
  font: {
    color:'#F00000',
  },
  fill: {
    type:'pattern',
    patternType:'solid',
    bgColor:'#FFFF00', // just add this
    fgColor:'#FFFF00',
  },
});

@natergj natergj closed this as completed Nov 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants