Skip to content

Commit

Permalink
Fixed the problem of generating wrong formula caused by RemoveCol
Browse files Browse the repository at this point in the history
  • Loading branch information
houjianxin.rupert committed Apr 18, 2024
1 parent 3e636ae commit 48fb4a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions datavalidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ var (
`&`, `&`,
`<`, `&lt;`,
`>`, `&gt;`,
`"`, "&quot;",
)
formulaUnescaper = strings.NewReplacer(
`&amp;`, `&`,
`&lt;`, `<`,
`&gt;`, `>`,
"&quot;", `"`,
)
// dataValidationTypeMap defined supported data validation types.
dataValidationTypeMap = map[DataValidationType]string{
Expand Down
2 changes: 1 addition & 1 deletion datavalidation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestDataValidation(t *testing.T) {
assert.NotEqual(t, "", dv.Formula1,
"Formula1 should not be empty for valid input %v", listValid)
}
assert.Equal(t, `"A&lt;,B&gt;,C"",D ,E',F"`, dv.Formula1)
assert.Equal(t, `"A&lt;,B&gt;,C&quot;,D ,E',F"`, dv.Formula1)
assert.NoError(t, f.AddDataValidation("Sheet1", dv))

dataValidations, err = f.GetDataValidations("Sheet1")
Expand Down

0 comments on commit 48fb4a5

Please sign in to comment.