excelize icon indicating copy to clipboard operation
excelize copied to clipboard

add function to remove or update comment in a cell

Open coreyzzp opened this issue 3 years ago • 7 comments

coreyzzp avatar May 26 '21 14:05 coreyzzp

when we try to add comment to a cell with comment, when open the excel file, the excel program will complain about 'there is an error occur, but we has recovery from it'

coreyzzp avatar May 26 '21 16:05 coreyzzp

Hi @coreyzzp, thanks for your feedback, could you provide any code and attachments to reproduce this issue?

xuri avatar May 27 '21 01:05 xuri

func TestCreateExcelAndUpdateComment(t *testing.T) {
	target := "test.xlsx"
	target2 := "test-after.xlsx"
	{
		var err error
		fd := excelize.NewFile()
		err = fd.AddComment("Sheet1", "A1", fmt.Sprintf(`{"author":"Excelize: ","text":"This is a comment" }`))
		require.Nil(t, err)
		err = fd.SaveAs(target)
		require.Nil(t, err)
		// here open test.xlsx is find
	}
	{
		fd, err := excelize.OpenFile(target)
		require.Nil(t, err)
		err = fd.AddComment("Sheet1", "A1", fmt.Sprintf(`{"author":"Excelize: ","text":"hello world"}`))
		require.Nil(t, err)
		err = fd.SaveAs(target2)
		require.Nil(t, err)
		// now open test-after.xlsx an error popup
	}
}

open test.xlsx image

open test-after.xlsx

image image

coreyzzp avatar May 27 '21 07:05 coreyzzp

it will be good to has a method to delete or update comment in a cell

coreyzzp avatar May 27 '21 07:05 coreyzzp

This lib doesn't support modify comment and set the comment repeatedly on one cell currently. I've add this feature support in the Roadmap.

xuri avatar May 27 '21 11:05 xuri

thx~

coreyzzp avatar May 27 '21 12:05 coreyzzp

find an article about "comments" and "notes": The difference between threaded comments and notes

Jonham avatar Jan 09 '22 03:01 Jonham

[WeOpen Star] I would like to help

FoeverA0 avatar Aug 10 '22 15:08 FoeverA0

[WeOpen Star] I would like to help

NaturalGao avatar Aug 14 '22 15:08 NaturalGao