From 90bdd3632f16244583525e580fa3edd42361db68 Mon Sep 17 00:00:00 2001 From: xuri Date: Thu, 18 Oct 2018 10:23:08 +0800 Subject: [PATCH] Fix the issue caused by missing tradition to strict conversion for `sharedStringsReader()`, relate issue #276 --- comment.go | 4 ++-- excelize_test.go | 4 ---- rows.go | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/comment.go b/comment.go index 2bfd785d..9031aad4 100644 --- a/comment.go +++ b/comment.go @@ -182,7 +182,7 @@ func (f *File) addDrawingVML(commentID int, drawingVML, cell string, lineCount, c, ok := f.XLSX[drawingVML] if ok { d := decodeVmlDrawing{} - _ = xml.Unmarshal([]byte(c), &d) + _ = xml.Unmarshal(namespaceStrictToTransitional(c), &d) for _, v := range d.Shape { s := xlsxShape{ ID: "_x0000_s1025", @@ -252,7 +252,7 @@ func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) { c, ok := f.XLSX[commentsXML] if ok { d := xlsxComments{} - _ = xml.Unmarshal([]byte(c), &d) + _ = xml.Unmarshal(namespaceStrictToTransitional(c), &d) comments.CommentList.Comment = append(comments.CommentList.Comment, d.CommentList.Comment...) } comments.CommentList.Comment = append(comments.CommentList.Comment, cmt) diff --git a/excelize_test.go b/excelize_test.go index b24e45bd..9f738f33 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -135,10 +135,6 @@ func TestOpenFile(t *testing.T) { if err != nil { t.Log(err) } - _, err = xlsx.WriteToBuffer() - if err != nil { - t.Error(err) - } } func TestAddPicture(t *testing.T) { diff --git a/rows.go b/rows.go index 5c384c8f..b6336331 100644 --- a/rows.go +++ b/rows.go @@ -249,7 +249,7 @@ func (f *File) sharedStringsReader() *xlsxSST { if len(ss) == 0 { ss = f.readXML("xl/SharedStrings.xml") } - _ = xml.Unmarshal([]byte(ss), &sharedStrings) + _ = xml.Unmarshal(namespaceStrictToTransitional(ss), &sharedStrings) f.SharedStrings = &sharedStrings } return f.SharedStrings