diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-05-05 19:15:39 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-05-05 19:15:39 +0800 |
commit | 66349f8ec039351770536b83b87c455543c0cf8a (patch) | |
tree | d23e1ebc5240da3ee3bfbdf448c79f1cca45150d | |
parent | 8fbab474443393b8b996487cf7ade300a72d2e07 (diff) |
Handle number formats out of built-in range exception by returning raw value, relate issue #50.
-rw-r--r-- | cell.go | 6 | ||||
-rw-r--r-- | test/Workbook1.xlsx | bin | 22922 -> 22954 bytes |
2 files changed, 5 insertions, 1 deletions
@@ -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 diff --git a/test/Workbook1.xlsx b/test/Workbook1.xlsx Binary files differindex 257ec27..909887a 100644 --- a/test/Workbook1.xlsx +++ b/test/Workbook1.xlsx |