Documentation
¶
Index ¶
- func CloseExcel(f *excelize.File)
- func ExportToExcel[T any](dst io.Writer, data []T) error
- func GetTplSheetFieldIndex(file *excelize.File, model any, fieldRowNum int) (string, map[string]string, error)
- func ReadExcelRow(excelFile *excelize.File, sheetName []string, sheetIndex []int, ...) error
- type HasSheetName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportToExcel ¶
ExportToExcel 将结构体切片导出为 Excel
func GetTplSheetFieldIndex ¶
func GetTplSheetFieldIndex(file *excelize.File, model any, fieldRowNum int) (string, map[string]string, error)
GetTplSheetFieldIndex 获取模板字段 读取excel里面指定sheet的数据,并提取某一列的所有字段所在的位置。
func ReadExcelRow ¶
func ReadExcelRow(excelFile *excelize.File, sheetName []string, sheetIndex []int, excludeSheet []string, dataRow int, dataCol int, call func(sheetName string, tmp map[string]any) error, fieldRowNum ...int) error
ReadExcelRow 读取excel 指定或者每个sheet的数据,并通过回调函数方式进行处理 excelFile *excelize.File excel文件 sheetName []string sheet名称集合,如果不填就是读取所有sheet sheetIndex []int sheet索引集合,如果不填就是读取所有sheet,注意,这里需要从0开始 dataRow int 数据行数,从第几行开始读取有效数据 dataCol int 数据列数,保证每行有效数据有多少列 call func(sheetName string,tmp map[string]any) error 回调函数,用于自定义处理每列数据 fieldRowNum ...int 字段行数,默认为第一行, 从1开始。
Types ¶
type HasSheetName ¶
type HasSheetName interface {
SheetName() string
}
Click to show internal directories.
Click to hide internal directories.