summaryrefslogtreecommitdiff
path: root/comment_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-03-05 14:48:34 +0800
committerxuri <xuri.me@gmail.com>2022-03-05 14:48:34 +0800
commitf0cb29cf6668ab96992b1e48278d9f5b1f9e4976 (patch)
tree3bcc69e973d070edf0d3a0f7764bb7e91d7774ca /comment_test.go
parent129052ae7db0fd2c59b1ea9158df0e75450cad42 (diff)
This closes #1162, improve the compatibility with alternate content
Preserve alternate content in the workbook, worksheet, and drawingML
Diffstat (limited to 'comment_test.go')
-rw-r--r--comment_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/comment_test.go b/comment_test.go
index 952763d..01f1e42 100644
--- a/comment_test.go
+++ b/comment_test.go
@@ -12,6 +12,7 @@
package excelize
import (
+ "encoding/xml"
"path/filepath"
"strings"
"testing"
@@ -38,7 +39,7 @@ func TestAddComments(t *testing.T) {
}
f.Comments["xl/comments2.xml"] = nil
- f.Pkg.Store("xl/comments2.xml", []byte(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Excelize: </author></authors><commentList><comment ref="B7" authorId="0"><text><t>Excelize: </t></text></comment></commentList></comments>`))
+ f.Pkg.Store("xl/comments2.xml", []byte(xml.Header+`<comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Excelize: </author></authors><commentList><comment ref="B7" authorId="0"><text><t>Excelize: </t></text></comment></commentList></comments>`))
comments := f.GetComments()
assert.EqualValues(t, 2, len(comments["Sheet1"]))
assert.EqualValues(t, 1, len(comments["Sheet2"]))