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

DuplicateRow() causes the parentheses to be lost in the formula of the row being duplicated #1914

Closed
iciness opened this issue Jun 3, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists
Projects

Comments

@iciness
Copy link

iciness commented Jun 3, 2024

Description

DuplicateRow() causes the parentheses to be lost in the formula of the row being duplicated

Steps to reproduce the issue:

i := 2

for j := 0; j <= 10; j++ {	
	f.SetCellValue("Sheet2", "A"+strconv.Itoa(i), "1000")
	f.SetCellFormula("Sheet2", "B"+strconv.Itoa(i), "=(A"+strconv.Itoa(i)+"-800)*20%")
        f.DuplicateRow("Sheet2", i)
	i++
}

Describe the results you received:
After excel opens the file, the formula of A2 becomes = A2-800 * 20%
Book1.xlsx

Describe the results you expected:
The brackets in the formula are not lost

Output of go version:

go version go1.22.3 windows/amd64

Excelize version or commit ID:

v2.8.1

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

windows 11 pro 23H2 22631.3672
execl 2405 Build 16.0.17628.20006 64bit

@iciness iciness changed the title The brackets will be missing when setting up the arithmetic formula with brackets. DuplicateRow() causes the parentheses to be lost in the formula of the row being duplicated Jun 3, 2024
@xuri
Copy link
Member

xuri commented Jun 4, 2024

Thanks for your feedback. This problem was duplicated with issue #1861, and already has been fixed in commit 703b737. Please upgrade to the master branch code by got get -u github.com/xuri/excelize/v2@master, and this patch will be released in the next version. I closed this issue, if you have any questions, please let me know and you can reopen this anytime.

@xuri xuri closed this as completed Jun 4, 2024
@xuri xuri added the duplicate This issue or pull request already exists label Jun 4, 2024
@xuri xuri added this to Bugfix in v2.9.0 Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
Status: Bugfix
v2.9.0
Bugfix
Development

No branches or pull requests

2 participants