Skip to content

Creating data bars MinValue and/or MaxValue not set correctly in EXCEL #1492

@usuallyvexed

Description

@usuallyvexed

Description

I am trying to use the conditional formatting feature and create some data bars, this partially works.
However, whenever I try to specify min and or max values, excelize does not appear to be converting the numeric values correctly.

Steps to reproduce the issue:

  1. Create a column if increasing numbers, 1-100.
  2. Use the following code to conditionally format the cells:
    err = ss.Excelize.SetConditionalFormat(sheetName, fmt.Sprintf("$AL$%d:$AL$%d", startRow, nodeRow-1),
    []excelize.ConditionalFormatOptions{
    {
    Type: "data_bar",
    Criteria: "=",
    MinType: "num",
    MinValue: "0",
    MaxType: "num",
    MaxValue: "100",
    BarColor: "#FF0000,
    },
    },
    )
  3. Go into EXCEL, select the range and then the HOME tab, Conditional Formatting, Manage Rules, then edit rule.

Describe the results you received:

For me the max value shows up as zero.

Describe the results you expected:

I was expecting the max value to be 100.

If I tried using a cell reference, the formatting of the cell reference in EXCEL was wrong as well, it would contain extraneous quotation marks(").

Output of go version:
go version go1.20.2 windows/amd64

(paste your output here)

Excelize version or commit ID:

github.com/xuri/excelize/v2 v2.7.0 // indirect

Environment details (OS, Microsoft Excel™ version, physical, etc.):

Windows 10
EXCEL 2013 part of the Microsoft Office 2013 bundle

databar-issue-reported-20230313

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions