Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operators greaterThanOrEqual and lessThanOrEqual are not taken into account in ConditionalFormat for cell type #608

Closed
echarlus opened this issue Apr 8, 2020 · 0 comments

Comments

@echarlus
Copy link
Contributor

echarlus commented Apr 8, 2020

When setting up conditional format for type "cell" and using a >= or <= criteria, the value parameter is not taken into account and therefore the conditional style does not work

Steps to reproduce the issue:

  1. Create a conditional style format like this :
    if pctOKStyle, err = cg.workbook.NewConditionalStyle({"font":{"bold":true, "color":"#38761D"}}); err != nil {
    log.Printf("Failed to create OKStyle : %v", err)
    }
    if pctNOKStyle, err = cg.workbook.NewConditionalStyle({"font":{"color":"#FF9900"}}); err != nil {
    log.Printf("Failed to create NOKStyle : %v", err)
    }
    pctFormat := fmt.Sprintf([{"type":"cell","criteria":">","format":%d,"value":"0"},{"type":"cell","criteria":"<=","format":%d,"value":"0"}], pctNOKStyle, pctOKStyle)

if err := workbook.SetConditionalFormat(detailsSheet, "A1:A38"), pctFormat); err != nil {
log.Printf("Failed to set conditional format on col %s : %v", c, err)
}

Describe the results you received:
for cells with values <=0 , the font color is not changed

Describe the results you expected:

One should see orange font when cell value is >0 and green font when <=0
However, the green format is never applied

Output of go version:
go version go1.14.1 darwin/amd64

Excelize version or commit ID:
Commit ID:
66d0272

Environment details (OS, Microsoft Excel™ version, physical, etc.):
Mac OS 10.15.4 / Excel 16.16.20

echarlus added a commit to O-CELL/excelize that referenced this issue Apr 8, 2020
@echarlus echarlus mentioned this issue Apr 8, 2020
9 tasks
xuri pushed a commit that referenced this issue Apr 8, 2020
@xuri xuri closed this as completed Apr 8, 2020
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants