File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 44
44
* [ 设置工作簿应用程序属性] ( workbook.md#SetAppProps )
45
45
* [ 获取工作簿应用程序属性] ( workbook.md#GetAppProps )
46
46
* [ 设置文档属性] ( workbook.md#SetDocProps )
47
- * [ 获取文档属性] ( workbook.md#GetDocProps )
47
+ * [ 获取文档属性] ( workbook.md#GetDocProps )
48
+ * [ 设置文档自定义属性] ( workbook.md#SetDocCustomProps )
49
+ * [ 获取文档自定义属性] ( workbook.md#GetDocCustomProps )
48
50
* [ 设置计算属性] ( workbook.md#SetCalcProps )
49
51
* [ 获取计算属性] ( workbook.md#GetCalcProps )
50
52
* [ 保护工作簿] ( workbook.md#ProtectWorkbook )
Original file line number Diff line number Diff line change @@ -1006,6 +1006,39 @@ func (f *File) GetDocProps() (*DocProperties, error)
1006
1006
1007
1007
获取工作簿的核心属性。
1008
1008
1009
+ ## 设置文档自定义属性 {#SetDocCustomProps}
1010
+
1011
+ ` ` ` go
1012
+ func (f *File) SetDocCustomProps(name string, value interface{}) error
1013
+ ` ` `
1014
+
1015
+ 设置工作簿的自定义属性,name 为 Key ,value 为设置的具体值。value 支持的类型如下:
1016
+
1017
+ 类型 | 描述
1018
+ ---|---
1019
+ float64 | 浮点型
1020
+ string | 字符串
1021
+ bool | 布尔型
1022
+ time.Time | 时间类型
1023
+
1024
+ 例如:
1025
+
1026
+ ` ` ` go
1027
+ err := f.SetDocCustomProps("string", "v1.0.0")
1028
+ err := f.SetDocCustomProps("string", "v2.0.0")
1029
+ err := f.SetDocCustomProps("bool", true)
1030
+ err := f.SetDocCustomProps("float64", 1.0)
1031
+ err := f.SetDocCustomProps("date", time.Now())
1032
+ ` ` `
1033
+
1034
+ ## 获取文档自定义属性 {#GetDocCustomProps}
1035
+
1036
+ ` ` ` go
1037
+ props, err := f.GetDocCustomProps()
1038
+ ` ` `
1039
+
1040
+ 获取工作簿的所有自定义属性。props 类型为` map[string]interface{}` ,其中 map 的 key 为自定义属性的名称,value 为自定义属性的值。
1041
+
1009
1042
## 设置计算属性 {#SetCalcProps}
1010
1043
1011
1044
` ` ` go
You can’t perform that action at this time.
0 commit comments