Skip to content

Commit 59f6af2

Browse files
foxmederxuri
authored andcommitted
fix reading wrong string from xml such as below
<sheetData><row r="1"><c r="A1" s="1" t="s"><v>0</v></c><c r="B1" s="1" t="s"></c></row></sheetData>
1 parent 7363626 commit 59f6af2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

rows.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,12 @@ func (f *File) sharedStringsReader() *xlsxSST {
301301
func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) {
302302
switch xlsx.T {
303303
case "s":
304-
xlsxSI := 0
305-
xlsxSI, _ = strconv.Atoi(xlsx.V)
306-
if len(d.SI) > xlsxSI {
307-
return f.formattedValue(xlsx.S, d.SI[xlsxSI].String()), nil
304+
if xlsx.V != "" {
305+
xlsxSI := 0
306+
xlsxSI, _ = strconv.Atoi(xlsx.V)
307+
if len(d.SI) > xlsxSI {
308+
return f.formattedValue(xlsx.S, d.SI[xlsxSI].String()), nil
309+
}
308310
}
309311
return f.formattedValue(xlsx.S, xlsx.V), nil
310312
case "str":

0 commit comments

Comments
 (0)