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

cell formula such as CONCATENATE referencing a DefinedName fails calculating #856

Closed
jaby opened this issue Jun 7, 2021 · 0 comments
Closed
Projects

Comments

@jaby
Copy link
Contributor

jaby commented Jun 7, 2021

Description

Here is an extension of the TestCalcWithDefinedName unit test to show the problem:

func TestCalcWithDefinedName(t *testing.T) {
  cellData := [][]interface{}{
    {"A1 value", "B1 value", nil},
  }
  f := prepareCalcData(cellData)
  assert.NoError(t, f.SetDefinedName(&DefinedName{Name: "defined_name1", RefersTo: "Sheet1!A1", Scope: "Workbook"}))
  assert.NoError(t, f.SetDefinedName(&DefinedName{Name: "defined_name1", RefersTo: "Sheet1!B1", Scope: "Sheet1"}))

  //....

  assert.NoError(t, f.SetCellFormula("Sheet1", "C1", "=CONCATENATE(\"<\",defined_name1,\">\")"))
  result, err = f.CalcCellValue("Sheet1", "C1")
  assert.NoError(t, err)
  assert.Equal(t, "<B1 value>", result, "=defined_name1")
}

Describe the results you received:

Error:      	Received unexpected error:
    invalid column name "defined_name1"

Describe the results you expected:

No error.

Output of go version:

go version go1.16.4 windows/amd64

Excelize version or commit ID:

commit id d932e62a127da177769ec3f35aae985ca0a516db

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

@xuri xuri closed this as completed in 2c90b3f Jun 7, 2021
@xuri xuri added this to Feature in v2.4.1 Jun 7, 2021
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v2.4.1
Feature
Development

No branches or pull requests

1 participant