When adding columns or rows and formulas need to be adjusted, the inner parentheses got cut out therefore resulting in corrupted formula
Steps to reproduce the issue:
Heres example programm
package main
import (
"fmt"
"github.com/xuri/excelize/v2"
)
func main() {
f := excelize.NewFile()
defer func() {
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
// Create a new sheet.
index, err := f.NewSheet("Sheet2")
if err != nil {
fmt.Println(err)
return
}
// Set value of a cell.
f.SetCellFormula("Sheet2", "A2", "(1-0.5)/2")
f.InsertCols("Sheet2", "A", 1)
// Set active sheet of the workbook.
f.SetActiveSheet(index)
// Save spreadsheet by the given path.
if err := f.SaveAs("Book1.xlsx"); err != nil {
fmt.Println(err)
}
}
Describe the results you received:=1-0,5/2Describe the results you expected:=(1-0,5)/2Output of go version:
go version go1.21.3 darwin/arm64
Excelize version or commit ID:
2.8.1
Environment details (OS, Microsoft Excel™ version, physical, etc.):
MacOS
Thanks for your issue. This bug has been fixed. Please upgrade to the master branch code by go get -u github.com/xuri/excelize/v2@master, and this patch will be released in the next version.
Description
When adding columns or rows and formulas need to be adjusted, the inner parentheses got cut out therefore resulting in corrupted formula
Steps to reproduce the issue: Heres example programm
Describe the results you received:
=1-0,5/2
Describe the results you expected:=(1-0,5)/2
Output ofgo version
:Excelize version or commit ID:
Environment details (OS, Microsoft Excel™ version, physical, etc.): MacOS