extrame / xls

Pure Golang xls library
Apache License 2.0
331 stars 210 forks source link

数字转字符串出现BUG啊 #2

Closed sorawa closed 9 years ago

sorawa commented 9 years ago

goroutine 1 [running]: github.com/extrame/xls.(_XfRk).String(0x10ba5f08, 0x10b581e0, 0x0, 0x0) d:/go/bin/project/src/github.com/extrame/xls/col.go:46 +0x1c9 github.com/extrame/xls.(_MulrkCol).String(0x10b96160, 0x10b581e0, 0x0, 0x0, 0x0)

    d:/go/bin/project/src/github.com/extrame/xls/col.go:104 +0xb8

main.main() D:/go/bin/project/bin/xlseample.go:26 +0x3e8 exit status 2

code:

func main() { if xlFile, err := xls.Open("Book1.xls", "utf-8"); err == nil { if sheet1 := xlFile.GetSheet(0); sheet1 != nil { fmt.Print("Total Lines ", sheet1.MaxRow, sheet1.Name) for i := 0 ; i < int(sheet1.MaxRow) ; i++ { fmt.Printf("row %v point %v \n",i,sheet1.Rows[uint16(i)]) if sheet1.Rows[uint16(i)] == nil { continue } col1 := sheet1.Rows[uint16(i)].Cols[0] col2 := sheet1.Rows[uint16(i)].Cols[1] fmt.Printf("\ncol1 %v \nCol2 %v \n",col1.String(xlFile),col2) }

    }
}

}

extrame commented 9 years ago

请提供样本xls和输出结果

sorawa commented 9 years ago

http://pan.baidu.com/s/1bnpzDcr

传到baidu上了,github上传不了

func main() { if xlFile, err := xls.Open("Book1.xls", "utf-8"); err == nil { if sheet1 := xlFile.GetSheet(0); sheet1 != nil { fmt.Print("Total Lines ", sheet1.MaxRow, sheet1.Name) for i := 0 ; i < int(sheet1.MaxRow) ; i++ { fmt.Printf("row %v point %v \n",i,sheet1.Rows[uint16(i)]) if sheet1.Rows[uint16(i)] == nil { continue } col1 := sheet1.Rows[uint16(i)].Cols[0] col2 := sheet1.Rows[uint16(i)].Cols[1] fmt.Printf("\ncol1 %v \nCol2 %v \n",col1.String(xlFile),col2)
} } }

}

当我使用 col1.String(xlFile) 时就报错了 如果不使用col1.String(xlFile) 就正常,但是没办法获取到文档里的字符

extrame commented 9 years ago

fixed