From 59f6af21a378fdde21422a92b79a7b03bba313d4 Mon Sep 17 00:00:00 2001 From: foxmeder Date: Wed, 1 Apr 2020 15:38:37 +0800 Subject: [PATCH] fix reading wrong string from xml such as below 0 --- rows.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rows.go b/rows.go index 76dd0f0..d56c81c 100644 --- a/rows.go +++ b/rows.go @@ -301,10 +301,12 @@ func (f *File) sharedStringsReader() *xlsxSST { func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) { switch xlsx.T { case "s": - xlsxSI := 0 - xlsxSI, _ = strconv.Atoi(xlsx.V) - if len(d.SI) > xlsxSI { - return f.formattedValue(xlsx.S, d.SI[xlsxSI].String()), nil + if xlsx.V != "" { + xlsxSI := 0 + xlsxSI, _ = strconv.Atoi(xlsx.V) + if len(d.SI) > xlsxSI { + return f.formattedValue(xlsx.S, d.SI[xlsxSI].String()), nil + } } return f.formattedValue(xlsx.S, xlsx.V), nil case "str":