未验证 提交 8ce48b85 编写于 作者: xurime's avatar xurime 提交者: GitHub

Merge pull request #647 from heiy/master

escape html tag
......@@ -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"}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册