20
0
This commit is contained in:
Liu Ming 2017-06-12 10:31:26 +08:00
parent 79987c0cd7
commit 3daf1f6acf
2 changed files with 16 additions and 7 deletions

View File

@ -2,11 +2,11 @@
[![GoDoc](https://godoc.org/github.com/extrame/xls?status.svg)](https://godoc.org/github.com/extrame/xls)
Pure Golang xls library writen by [MinkTech(chinese)](http://www.mink-tech.com).
Pure Golang xls library writen by [Rongshu Tech(chinese)](http://www.rongshu.tech).
Thanks for contributions from Tamás Gulácsi.
Thanks for contributions from Tamás Gulácsi, sergeilem.
**English User please mailto** [Liu Ming](mailto:liuming@mink-tech.com)
**English User please mailto** [Liu Ming](mailto:liuming@rongshu.tech)
This is a xls library writen in pure Golang. Almostly it is translated from the libxls library in c.

17
col.go
View File

@ -4,7 +4,8 @@ import (
"fmt"
"math"
"strconv"
"time"
"github.com/extrame/goyymmdd"
)
//content type
@ -49,14 +50,14 @@ func (xf *XfRk) String(wb *WorkBook) string {
if len(wb.Xfs) > idx {
fNo := wb.Xfs[idx].formatNo()
if fNo >= 164 { // user defined format
if fmt := wb.Formats[fNo]; fmt != nil {
if formatter := wb.Formats[fNo]; formatter != nil {
i, f, isFloat := xf.Rk.number()
if !isFloat {
f = float64(i)
}
fmt.Println(formatter.str, "======")
t := timeFromExcelTime(f, wb.dateMode == 1)
return t.Format(time.RFC3339) //TODO it should be international and format as the describled style
return yymmdd.Format(t, formatter.str)
}
// see http://www.openoffice.org/sc/excelfileformat.pdf
} else if 14 <= fNo && fNo <= 17 || fNo == 22 || 27 <= fNo && fNo <= 36 || 50 <= fNo && fNo <= 58 { // jp. date format
@ -64,6 +65,7 @@ func (xf *XfRk) String(wb *WorkBook) string {
if !isFloat {
f = float64(i)
}
fmt.Println(fNo)
t := timeFromExcelTime(f, wb.dateMode == 1)
return t.Format("2006.01") //TODO it should be international
}
@ -85,6 +87,13 @@ func (rk RK) number() (intNum int64, floatNum float64, isFloat bool) {
}
return
}
//+++ add lines from here
if multiplied != 0 {
isFloat = true
floatNum = float64(val) / 100
return
}
//+++end
return int64(val), 0, false
}