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

DeleteComment is no deletion marker #1789

Closed
baichachaa opened this issue Jan 23, 2024 · 3 comments · Fixed by #1790
Closed

DeleteComment is no deletion marker #1789

baichachaa opened this issue Jan 23, 2024 · 3 comments · Fixed by #1790
Labels
bug Something isn't working

Comments

@baichachaa
Copy link

After I deleted the comment, there was still the comment.
As you can see the code:

f.SetCellValue("Sheet1", "A2", 100)
f.AddComment("Sheet1", excelize.Comment{Cell: "A2", Text: "aaa"})
f.DeleteComment("Sheet1", "A2")

Snipaste_2024-01-23_21-04-31

go version: go1.21.3 windows/amd64
excelize version: 2.8.0

@xuri
Copy link
Member

xuri commented Jan 23, 2024

Thanks for your issue. Could you show us a complete, standalone example program or reproducible demo? I have tested with the following code and it works well.

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)
        }
    }()
    if err := f.SetCellValue("Sheet1", "A2", 100); err != nil {
        fmt.Println(err)
        return
    }
    if err := f.AddComment("Sheet1", excelize.Comment{Cell: "A2", Text: "aaa"}); err != nil {
        fmt.Println(err)
        return
    }
    if err := f.DeleteComment("Sheet1", "A2"); err != nil {
        fmt.Println(err)
        return
    }
    if err := f.SaveAs("Book1.xlsx"); err != nil {
        fmt.Println(err)
    }
}

@baichachaa
Copy link
Author

I used your code and it's still the same as I described.
Maybe it's an issue with WPS Office.
WPS Office Version: 12.1.0.16120

@xuri xuri added the bug Something isn't working label Jan 23, 2024
L4nn15ter added a commit to L4nn15ter/excelize that referenced this issue Jan 24, 2024
@xuri xuri linked a pull request Jan 24, 2024 that will close this issue
10 tasks
xuri pushed a commit that referenced this issue Jan 24, 2024
- Improve delete cell comment shape compatibility with KingSoft WPS
- Update unit test
@xuri
Copy link
Member

xuri commented Jan 24, 2024

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

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants