From f7bd0729c65fc82305328f7ac8fbaf329d1075c0 Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 1 Jul 2020 22:41:29 +0800 Subject: Resolve #32, fix missing leading/leading spaces when working with SST --- xmlSharedStrings.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xmlSharedStrings.go') diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go index eac1672..d5fe4a7 100644 --- a/xmlSharedStrings.go +++ b/xmlSharedStrings.go @@ -38,7 +38,7 @@ type xlsxSST struct { // level - then the string item shall consist of multiple rich text runs which // collectively are used to express the string. type xlsxSI struct { - T string `xml:"t,omitempty"` + T *xlsxT `xml:"t,omitempty"` R []xlsxR `xml:"r"` } @@ -53,7 +53,10 @@ func (x xlsxSI) String() string { } return rows.String() } - return x.T + if x.T != nil { + return x.T.Val + } + return "" } // xlsxR represents a run of rich text. A rich text run is a region of text @@ -69,7 +72,7 @@ type xlsxR struct { type xlsxT struct { XMLName xml.Name `xml:"t"` Space xml.Attr `xml:"space,attr,omitempty"` - Val string `xml:",innerxml"` + Val string `xml:",chardata"` } // xlsxRPr (Run Properties) specifies a set of run properties which shall be -- cgit v1.2.1