From 79dfe1c3070b3c4af14a40acaa5bd8cb477acd3e Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 13 Jul 2018 17:40:47 +0800 Subject: GoDoc updated. --- README.md | 2 +- README_zh.md | 2 +- chart.go | 2 ++ comment.go | 4 ++-- lib.go | 9 +++++++++ picture.go | 2 +- styles.go | 2 +- table.go | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 88a67f3..61ac2d6 100644 --- a/README.md +++ b/README.md @@ -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/)。 ## 快速上手 diff --git a/chart.go b/chart.go index 7ba1d91..41354f1 100644 --- a/chart.go +++ b/chart.go @@ -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. diff --git a/comment.go b/comment.go index bab7370..92dd71d 100644 --- a/comment.go +++ b/comment.go @@ -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{} diff --git a/lib.go b/lib.go index 4379be4..e1b0693 100644 --- a/lib.go +++ b/lib.go @@ -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("{}") +} diff --git a/picture.go b/picture.go index ab72fc8..04d5062 100644 --- a/picture.go +++ b/picture.go @@ -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 } diff --git a/styles.go b/styles.go index e2a1ae6..251e335 100644 --- a/styles.go +++ b/styles.go @@ -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 | diff --git a/table.go b/table.go index 941b52f..67f9be0 100644 --- a/table.go +++ b/table.go @@ -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 } -- cgit v1.2.1