|
@@ -8,6 +8,7 @@
|
|
|
package xlsx
|
|
package xlsx
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "bytes"
|
|
|
"encoding/xml"
|
|
"encoding/xml"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"strconv"
|
|
"strconv"
|
|
@@ -451,7 +452,12 @@ type xlsxNumFmt struct {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (numFmt *xlsxNumFmt) Marshal() (result string, err error) {
|
|
func (numFmt *xlsxNumFmt) Marshal() (result string, err error) {
|
|
|
- return fmt.Sprintf(`<numFmt numFmtId="%d" formatCode="%s"/>`, numFmt.NumFmtId, numFmt.FormatCode), nil
|
|
|
|
|
|
|
+ formatCode := &bytes.Buffer{}
|
|
|
|
|
+ if err := xml.EscapeText(formatCode, []byte(numFmt.FormatCode)); err != nil {
|
|
|
|
|
+ return "", err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return fmt.Sprintf(`<numFmt numFmtId="%d" formatCode="%s"/>`, numFmt.NumFmtId, formatCode), nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// xlsxFonts directly maps the fonts element in the namespace
|
|
// xlsxFonts directly maps the fonts element in the namespace
|