Update the README and documentation for the data validation functions
This commit is contained in:
parent
4957ee9abc
commit
3b2b8ca8d6
|
@ -13,7 +13,7 @@
|
|||
|
||||
## Introduction
|
||||
|
||||
Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Go version 1.16 or later. The full docs can be seen using go's built-in documentation tool, or online at [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) and [docs reference](https://xuri.me/excelize/).
|
||||
Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Go version 1.16 or later. There are some [incompatible changes](https://github.com/golang/go/issues/61881) in the Go 1.21.0, the Excelize library can not working with that version normally, if you are using the Go 1.21.x, please upgrade to the Go 1.21.1 and later version. The full docs can be seen using go's built-in documentation tool, or online at [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) and [docs reference](https://xuri.me/excelize/).
|
||||
|
||||
## Basic Usage
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
## 简介
|
||||
|
||||
Excelize 是 Go 语言编写的用于操作 Office Excel 文档基础库,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档,并提供流式读写函数,用于处理包含大规模数据的工作簿。可应用于各类报表平台、云计算、边缘计算等系统。使用本类库要求使用的 Go 语言为 1.16 或更高版本,完整的使用文档请访问 [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) 或查看 [参考文档](https://xuri.me/excelize/)。
|
||||
Excelize 是 Go 语言编写的用于操作 Office Excel 文档基础库,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档,并提供流式读写函数,用于处理包含大规模数据的工作簿。可应用于各类报表平台、云计算、边缘计算等系统。使用本类库要求使用的 Go 语言为 1.16 或更高版本,请注意,Go 1.21.0 中存在[不兼容的更改](https://github.com/golang/go/issues/61881),导致 Excelize 基础库无法在该版本上正常工作,如果您使用的是 Go 1.21.x,请升级到 Go 1.21.1 及更高版本。完整的使用文档请访问 [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) 或查看 [参考文档](https://xuri.me/excelize/)。
|
||||
|
||||
## 快速上手
|
||||
|
||||
|
|
|
@ -112,7 +112,12 @@ func (dv *DataValidation) SetInput(title, msg string) {
|
|||
dv.Prompt = &msg
|
||||
}
|
||||
|
||||
// SetDropList data validation list.
|
||||
// SetDropList data validation list. If you type the items into the data
|
||||
// validation dialog box (a delimited list), the limit is 255 characters,
|
||||
// including the separators. If your data validation list source formula is
|
||||
// over the maximum length limit, please set the allowed values in the
|
||||
// worksheet cells, and use the SetSqrefDropList function to set the reference
|
||||
// for their cells.
|
||||
func (dv *DataValidation) SetDropList(keys []string) error {
|
||||
formula := strings.Join(keys, ",")
|
||||
if MaxFieldLength < len(utf16.Encode([]rune(formula))) {
|
||||
|
@ -162,9 +167,12 @@ func (dv *DataValidation) SetRange(f1, f2 interface{}, t DataValidationType, o D
|
|||
// SetSqrefDropList provides set data validation on a range with source
|
||||
// reference range of the worksheet by given data validation object and
|
||||
// worksheet name. The data validation object can be created by
|
||||
// NewDataValidation function. For example, set data validation on
|
||||
// Sheet1!A7:B8 with validation criteria source Sheet1!E1:E3 settings, create
|
||||
// in-cell dropdown by allowing list source:
|
||||
// NewDataValidation function. There are limits to the number of items that
|
||||
// will show in a data validation drop down list: The list can show up to show
|
||||
// 32768 items from a list on the worksheet. If you need more items than that,
|
||||
// you could create a dependent drop down list, broken down by category. For
|
||||
// example, set data validation on Sheet1!A7:B8 with validation criteria source
|
||||
// Sheet1!E1:E3 settings, create in-cell dropdown by allowing list source:
|
||||
//
|
||||
// dv := excelize.NewDataValidation(true)
|
||||
// dv.Sqref = "A7:B8"
|
||||
|
|
|
@ -1302,7 +1302,7 @@ func (f *File) extractProtection(xf xlsxXf, s *xlsxStyleSheet, style *Style) {
|
|||
}
|
||||
}
|
||||
|
||||
// GetStyle get style details by given style index.
|
||||
// GetStyle provides a function to get style definition by given style index.
|
||||
func (f *File) GetStyle(idx int) (*Style, error) {
|
||||
var style *Style
|
||||
f.mu.Lock()
|
||||
|
|
Loading…
Reference in New Issue