GoDoc updated.

This commit is contained in:
xuri 2018-07-13 17:40:47 +08:00
parent 58a7b23d11
commit 79dfe1c307
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
8 changed files with 18 additions and 7 deletions

View File

@ -11,7 +11,7 @@
## Introduction ## 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 ## Basic Usage

View File

@ -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/)。
## 快速上手 ## 快速上手

View File

@ -352,7 +352,9 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
// minimum // 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. // 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. // 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. // 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. // Set chart size by dimension property. The dimension property is optional. The default width is 480, and height is 290.

View File

@ -15,11 +15,11 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) {
Author: "Author:", Author: "Author:",
Text: " ", Text: " ",
} }
err := json.Unmarshal([]byte(formatSet), &format) err := json.Unmarshal(parseFormatSet(formatSet), &format)
return &format, err 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. // of worksheet name to the worksheet comments.
func (f *File) GetComments() (comments map[string]*xlsxComments) { func (f *File) GetComments() (comments map[string]*xlsxComments) {
comments = map[string]*xlsxComments{} comments = map[string]*xlsxComments{}

9
lib.go
View File

@ -164,3 +164,12 @@ func getCellColRow(cell string) (col, row string) {
return cell, "" 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("{}")
}

View File

@ -26,7 +26,7 @@ func parseFormatPictureSet(formatSet string) (*formatPicture, error) {
XScale: 1.0, XScale: 1.0,
YScale: 1.0, YScale: 1.0,
} }
err := json.Unmarshal([]byte(formatSet), &format) err := json.Unmarshal(parseFormatSet(formatSet), &format)
return &format, err return &format, err
} }

View File

@ -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 // 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 // will be evaluated. It has no default value. The most common criteria as
// applied to {'type': 'cell'} are: // applied to {"type""cell"} are:
// //
// between | // between |
// not between | // not between |

View File

@ -16,7 +16,7 @@ func parseFormatTableSet(formatSet string) (*formatTable, error) {
TableStyle: "", TableStyle: "",
ShowRowStripes: true, ShowRowStripes: true,
} }
err := json.Unmarshal([]byte(formatSet), &format) err := json.Unmarshal(parseFormatSet(formatSet), &format)
return &format, err return &format, err
} }