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

Merged rows not updated correctly with RemoveRow #1749

Closed
neclepsio opened this issue Dec 11, 2023 · 1 comment
Closed

Merged rows not updated correctly with RemoveRow #1749

neclepsio opened this issue Dec 11, 2023 · 1 comment
Labels
bug Something isn't working
Projects

Comments

@neclepsio
Copy link

neclepsio commented Dec 11, 2023

Description

Merged rows not updated correctly with RemoveRow, as per the following reproducer.

Steps to reproduce the issue:

package main

import (
	"github.com/xuri/excelize/v2"
)

func main() {
	f := excelize.NewFile()
	defer f.Close()

	// create three rows, two of which have merged cells
	f.MergeCell("Sheet1", "A1", "D1")
	f.SetCellStr("Sheet1", "A1", "Merged cells 1")

	f.MergeCell("Sheet1", "A2", "D2")
	f.SetCellStr("Sheet1", "A2", "Merged cells 2")

	f.SetCellStr("Sheet1", "A3", "Non")
	f.SetCellStr("Sheet1", "B3", "merged")
	f.SetCellStr("Sheet1", "C3", "cells")

	// duplicate the three rows
	f.DuplicateRowTo("Sheet1", 1, 4)
	f.DuplicateRowTo("Sheet1", 2, 5)
	f.DuplicateRowTo("Sheet1", 3, 6)

	// rows 1, 2, 4, 5 are merged now; 3 and 6 are not
	f.RemoveRow("Sheet1", 4)

	// BUG
	// should be: rows 1, 2, 4 merged; 3 and 5 not merged
	// is: rows 1, 2, 5 merged; 3 and 4 not merged

	f.SaveAs("Book1.xlsx")
}

Describe the results you received:

Rows 1, 2, 5 merged; 3 and 4 not merged.

Describe the results you expected:

Rows 1, 2, 4 merged; 3 and 5 not merged.

Output of go version:

go version go1.21.4 windows/amd64

Excelize version or commit ID:

v2.8.1-0.20231209040829-7b3dd03947bd
@xuri xuri added bug Something isn't working in progress Working in progress labels Dec 12, 2023
@xuri xuri added this to Bugfix in v2.8.1 Dec 12, 2023
CooolNv added a commit to CooolNv/excelize that referenced this issue Dec 12, 2023
@xuri xuri closed this as completed in 284345e Dec 13, 2023
@xuri
Copy link
Member

xuri commented Dec 13, 2023

Thanks for your issue. This issue has been fixed, please upgrade to the master branch code, and this patch will be released in the next version.

@xuri xuri removed the in progress Working in progress label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
v2.8.1
Bugfix
Development

No branches or pull requests

2 participants