Documentation ¶
Index ¶
- func ExportExcel(file *xlsx.File, sheetName string, vals interface{}, cformats ...CustomFormat) (err error)
- func ImportExcel(data []byte, sheetName string, targets interface{}, cparses ...CustomParse) (err error)
- type CustomFormat
- type CustomParse
- type FormatFn
- type FormatFnMap
- type ParseFn
- type ParseFnMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportExcel ¶
func ExportExcel(file *xlsx.File, sheetName string, vals interface{}, cformats ...CustomFormat) (err error)
导出 excel
sheetName: 表格名称
vals: 已定义 excel:"xx" 字段的结构数组数据
cformats: 自定义格式化函数
示例:
type Test struct { Test string `json:"test" excel:"header(测试);index(1)"` UserName string `json:"user_name" excel:"header(学员);index(0)"` }
| 学员 | 测试 | | ----------- | ----------- | | 学员数据1 | 测试数据2 | | 学员数据2 | 测试数据2 |
func ImportExcel ¶
func ImportExcel(data []byte, sheetName string, targets interface{}, cparses ...CustomParse) (err error)
导入excel
Types ¶
type CustomFormat ¶
type CustomParse ¶
type FormatFnMap ¶
type ParseFnMap ¶
Click to show internal directories.
Click to hide internal directories.