diff options
author | xuri <xuri.me@gmail.com> | 2018-07-13 17:40:47 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2018-07-13 17:40:47 +0800 |
commit | 79dfe1c3070b3c4af14a40acaa5bd8cb477acd3e (patch) | |
tree | 6f980b68b9b2ac097f4d3a7e2f6cb3d7be756c6a | |
parent | 58a7b23d11ef36156af6f694a1753715df8ae2fc (diff) |
GoDoc updated.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | README_zh.md | 2 | ||||
-rw-r--r-- | chart.go | 2 | ||||
-rw-r--r-- | comment.go | 4 | ||||
-rw-r--r-- | lib.go | 9 | ||||
-rw-r--r-- | picture.go | 2 | ||||
-rw-r--r-- | styles.go | 2 | ||||
-rw-r--r-- | table.go | 2 |
8 files changed, 18 insertions, 7 deletions
@@ -11,7 +11,7 @@ ## Introduction -Excelize is a library written in pure Go and providing a set of functions that allow you to write to and read from XLSX files. Support reads and writes XLSX file generated by Microsoft Excel™ 2007 and later. Support save file without losing original charts of XLSX. This library needs Go version 1.8 or later. The full API docs can be seen using go's built-in documentation tool, or online at [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) and [Chinese translation](https://xuri.me/excelize/zh_cn). +Excelize is a library written in pure Go and providing a set of functions that allow you to write to and read from XLSX files. Support reads and writes XLSX file generated by Microsoft Excel™ 2007 and later. Support save file without losing original charts of XLSX. This library needs Go version 1.8 or later. The full API docs can be seen using go's built-in documentation tool, or online at [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) and [docs reference](https://xuri.me/excelize/). ## Basic Usage diff --git a/README_zh.md b/README_zh.md index ef149b0..49680d1 100644 --- a/README_zh.md +++ b/README_zh.md @@ -11,7 +11,7 @@ ## 简介 -Excelize 是 Go 语言编写的用于操作 Office Excel 文档类库,基于 ECMA-376 Office OpenXML 标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的 XLSX 文档。相比较其他的开源类库,Excelize 支持写入原本带有图片(表)、透视表和切片器等复杂样式的文档,还支持向 Excel 文档中插入图片与图表,并且在保存后不会丢失文档原有样式,可以应用于各类报表系统中。使用本类库要求使用的 Go 语言为 1.8 或更高版本,完整的 API 使用文档请访问 [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) 或查看 [中文翻译](https://xuri.me/excelize/zh_cn)。 +Excelize 是 Go 语言编写的用于操作 Office Excel 文档类库,基于 ECMA-376 Office OpenXML 标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的 XLSX 文档。相比较其他的开源类库,Excelize 支持写入原本带有图片(表)、透视表和切片器等复杂样式的文档,还支持向 Excel 文档中插入图片与图表,并且在保存后不会丢失文档原有样式,可以应用于各类报表系统中。使用本类库要求使用的 Go 语言为 1.8 或更高版本,完整的 API 使用文档请访问 [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) 或查看 [参考文档](https://xuri.me/excelize/)。 ## 快速上手 @@ -352,7 +352,9 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) { // minimum // // reverse_order: Specifies that the categories or values on reverse order (orientation of the chart). The reverse_order property is optional. The default value is false. +// // maximum: Specifies that the fixed maximum, 0 is auto. The maximum property is optional. The default value is auto. +// // minimum: Specifies that the fixed minimum, 0 is auto. The minimum property is optional. The default value is auto. // // Set chart size by dimension property. The dimension property is optional. The default width is 480, and height is 290. @@ -15,11 +15,11 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { Author: "Author:", Text: " ", } - err := json.Unmarshal([]byte(formatSet), &format) + err := json.Unmarshal(parseFormatSet(formatSet), &format) return &format, err } -// GetComments retrievs all comments and returns a map +// GetComments retrieves all comments and returns a map // of worksheet name to the worksheet comments. func (f *File) GetComments() (comments map[string]*xlsxComments) { comments = map[string]*xlsxComments{} @@ -164,3 +164,12 @@ func getCellColRow(cell string) (col, row string) { return cell, "" } + +// parseFormatSet provides a method to convert format string to []byte and +// handle empty string. +func parseFormatSet(formatSet string) []byte { + if formatSet != "" { + return []byte(formatSet) + } + return []byte("{}") +} @@ -26,7 +26,7 @@ func parseFormatPictureSet(formatSet string) (*formatPicture, error) { XScale: 1.0, YScale: 1.0, } - err := json.Unmarshal([]byte(formatSet), &format) + err := json.Unmarshal(parseFormatSet(formatSet), &format) return &format, err } @@ -2407,7 +2407,7 @@ func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) { // // The criteria parameter is used to set the criteria by which the cell data // will be evaluated. It has no default value. The most common criteria as -// applied to {'type': 'cell'} are: +// applied to {"type":"cell"} are: // // between | // not between | @@ -16,7 +16,7 @@ func parseFormatTableSet(formatSet string) (*formatTable, error) { TableStyle: "", ShowRowStripes: true, } - err := json.Unmarshal([]byte(formatSet), &format) + err := json.Unmarshal(parseFormatSet(formatSet), &format) return &format, err } |