diff options
author | Harris <mike.harris@cerner.com> | 2019-08-07 16:26:13 -0500 |
---|---|---|
committer | Harris <mike.harris@cerner.com> | 2019-08-09 08:12:08 -0500 |
commit | acd76425c2ee55c45a51cf7f71c8a6187a09f507 (patch) | |
tree | 1e6f35871372f5753da9ff9671fb94541f20d49f /xmlSharedStrings.go | |
parent | e07581e980444b64bc15fce328ff07736ac9dbf6 (diff) |
Handle multi row inline strings
The inline string struct is actually the same
as the shared strings struct, reuse it.
Note that Go version 1.10 is required.
Fixes #462
Diffstat (limited to 'xmlSharedStrings.go')
-rw-r--r-- | xmlSharedStrings.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go index 3fcf3d5..48d4464 100644 --- a/xmlSharedStrings.go +++ b/xmlSharedStrings.go @@ -9,7 +9,10 @@ package excelize -import "encoding/xml" +import ( + "encoding/xml" + "strings" +) // xlsxSST directly maps the sst element from the namespace // http://schemas.openxmlformats.org/spreadsheetml/2006/main. String values may @@ -33,6 +36,17 @@ type xlsxSI struct { R []xlsxR `xml:"r"` } +func (x xlsxSI) String() string { + if len(x.R) > 0 { + var rows strings.Builder + for _, s := range x.R { + rows.WriteString(s.T) + } + return rows.String() + } + return x.T +} + // xlsxR directly maps the r element from the namespace // http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have // not checked this for completeness - it does as much as I need. |