From 99992214503c3e2135170b98448ac37af00bf2fa Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 1 Apr 2024 08:49:21 +0800 Subject: [PATCH] This closes #1865, unescape newline character in stream writer - Update dependencies module --- cell.go | 4 +++- go.sum | 8 -------- picture.go | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cell.go b/cell.go index e9b5730..3b712c6 100644 --- a/cell.go +++ b/cell.go @@ -505,7 +505,9 @@ func trimCellValue(value string, escape bool) (v string, ns xml.Attr) { } if escape { var buf bytes.Buffer - _ = xml.EscapeText(&buf, []byte(value)) + enc := xml.NewEncoder(&buf) + enc.EncodeToken(xml.CharData(value)) + enc.Flush() value = buf.String() } if len(value) > 0 { diff --git a/go.sum b/go.sum index 9c04edd..22aee20 100644 --- a/go.sum +++ b/go.sum @@ -13,20 +13,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xuri/efp v0.0.0-20231025114914-d1ff6096ae53 h1:Chd9DkqERQQuHpXjR/HSV1jLZA6uaoiwwH3vSuF3IW0= github.com/xuri/efp v0.0.0-20231025114914-d1ff6096ae53/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= -github.com/xuri/nfp v0.0.0-20230919160717-d98342af3f05 h1:qhbILQo1K3mphbwKh1vNm4oGezE1eF9fQWmNiIpSfI4= -github.com/xuri/nfp v0.0.0-20230919160717-d98342af3f05/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= -github.com/xuri/nfp v0.0.0-20240316161844-5bacf1a74267 h1:p0lQ21ogqdVWcdXpqSlD7gu/3whO1YWNiOaPJNBfunU= -github.com/xuri/nfp v0.0.0-20240316161844-5bacf1a74267/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 h1:hPVCafDV85blFTabnqKgNhDCkJX25eik94Si9cTER4A= github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= diff --git a/picture.go b/picture.go index a52bbc3..cc0c2b8 100644 --- a/picture.go +++ b/picture.go @@ -184,7 +184,7 @@ func (f *File) AddPicture(sheet, cell, name string, opts *GraphicOptions) error // types: EMF, EMZ, GIF, JPEG, JPG, PNG, SVG, TIF, TIFF, WMF, and WMZ. Note that // this function only supports adding pictures placed over the cells currently, // and doesn't support adding pictures placed in cells or creating the Kingsoft -// WPS Office embedded image cells.For example: +// WPS Office embedded image cells. For example: // // package main //