ソースを参照

Handle number formats out of built-in range exception by returning raw value, relate issue #50.

Ri Xu 8 年 前
コミット
66349f8ec0
2 ファイル変更5 行追加1 行削除
  1. 5 1
      cell.go
  2. BIN
      test/Workbook1.xlsx

+ 5 - 1
cell.go

@@ -66,7 +66,11 @@ func (f *File) formattedValue(s int, v string) string {
 	}
 	var styleSheet xlsxStyleSheet
 	xml.Unmarshal([]byte(f.readXML("xl/styles.xml")), &styleSheet)
-	return builtInNumFmtFunc[styleSheet.CellXfs.Xf[s].NumFmtID](styleSheet.CellXfs.Xf[s].NumFmtID, v)
+	ok := builtInNumFmtFunc[styleSheet.CellXfs.Xf[s].NumFmtID]
+	if ok != nil {
+		return ok(styleSheet.CellXfs.Xf[s].NumFmtID, v)
+	}
+	return v
 }
 
 // GetCellFormula provides function to get formula from cell by given sheet

BIN
test/Workbook1.xlsx