diff options
author | xuri <xuri.me@gmail.com> | 2020-06-08 19:02:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-08 19:02:50 +0800 |
commit | 8ce48b859a3803647a247a53b3c9fd49192fd4a7 (patch) | |
tree | e323788c54ff5473c9270c165403a56a24589dd2 /cell.go | |
parent | b6dd7648a142901655cc4f76cb7d3a6e73338c8f (diff) | |
parent | eb150c0c22749a11618a3e77ffc9ad0d58f11056 (diff) |
Merge pull request #647 from heiy/master
escape html tag
Diffstat (limited to 'cell.go')
-rw-r--r-- | cell.go | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -13,6 +13,7 @@ import ( "encoding/xml" "errors" "fmt" + "html" "reflect" "strconv" "strings" @@ -620,7 +621,7 @@ func (f *File) SetCellRichText(sheet, cell string, runs []RichTextRun) error { sst := f.sharedStringsReader() textRuns := []xlsxR{} for _, textRun := range runs { - run := xlsxR{T: &xlsxT{Val: textRun.Text}} + run := xlsxR{T: &xlsxT{Val: html.EscapeString(textRun.Text)}} if strings.ContainsAny(textRun.Text, "\r\n ") { run.T.Space = xml.Attr{Name: xml.Name{Space: NameSpaceXML, Local: "space"}, Value: "preserve"} } |