Documentation
¶
Index ¶
- Constants
- func DownLoadExcel(fileName string, res http.ResponseWriter, file *excelize.File)
- func ExportExcel(sheet, title, fields string, isGhbj, isIgnore bool, list interface{}, ...) (err error)
- func GetExcelColumnName(columnNumber int) string
- func ImportBySheet(f *excelize.File, dst interface{}, sheetName string, headIndex, startRow int) (err error)
- func ImportExcel(f *excelize.File, dst interface{}, headIndex, startRow int) (err error)
- func IsContain(items interface{}, item interface{}) bool
- func NormalDownLoad(fileName, sheet, title string, isGhbj bool, list interface{}, ...) error
- func NormalDynamicDownLoad(fileName, sheet, title, fields string, isGhbj, isIgnore bool, list interface{}, ...) error
- func NormalDynamicExport(list interface{}, sheet, title, fields string, isGhbj, isIgnore bool, ...) (file *excelize.File, err error)
- type Excel
- type ExcelTag
Constants ¶
View Source
const ( ExcelTagKey = "excel" Pattern = "name:(.*?);|index:(.*?);|width:(.*?);|needMerge:(.*?);|replace:(.*?);" )
Variables ¶
This section is empty.
Functions ¶
func DownLoadExcel ¶
func DownLoadExcel(fileName string, res http.ResponseWriter, file *excelize.File)
DownLoadExcel 下载
func ExportExcel ¶
func ExportExcel(sheet, title, fields string, isGhbj, isIgnore bool, list interface{}, changeHead map[string]string, e *Excel) (err error)
ExportExcel excel导出
func GetExcelColumnName ¶
GetExcelColumnName 根据列数生成 Excel 列名
func ImportBySheet ¶
func ImportBySheet(f *excelize.File, dst interface{}, sheetName string, headIndex, startRow int) (err error)
ImportBySheet 导入数据(读取指定sheet)sheetName Sheet名称
func ImportExcel ¶
ImportExcel 导入数据(单个sheet) 需要在传入的结构体中的字段加上tag:excel:"title:列头名称;" f 获取到的excel对象、dst 导入目标对象【传指针】 headIndex 表头的索引,从0开始(用于获取表头名字) startRow 头行行数(从第startRow+1行开始扫)
func NormalDownLoad ¶
func NormalDownLoad(fileName, sheet, title string, isGhbj bool, list interface{}, res http.ResponseWriter) error
NormalDownLoad 导出excel并下载(单个sheet)
func NormalDynamicDownLoad ¶
func NormalDynamicDownLoad(fileName, sheet, title, fields string, isGhbj, isIgnore bool, list interface{}, changeHead map[string]string, res http.ResponseWriter) error
NormalDynamicDownLoad 动态导出excel并下载(单个sheet) isIgnore 是否忽略指定字段(true 要忽略的字段 false 要导出的字段) fields 选择的字段,多个字段用逗号隔开,最后一个字段后面也要加逗号,如:字段1,字段2,字段3, changeHead 要改变表头的字段,格式是{"字段1":"更改的表头1","字段2":"更改的表头2"}
func NormalDynamicExport ¶
func NormalDynamicExport(list interface{}, sheet, title, fields string, isGhbj, isIgnore bool, changeHead map[string]string) (file *excelize.File, err error)
NormalDynamicExport 导出excel ** 需要在传入的结构体中的字段加上tag:excelize:"title:列头名称;index:列下标(从0开始);" list 需要导出的对象数组、sheet sheet名称、title 标题、isGhbj 是否设置隔行背景色
Types ¶
type Excel ¶
Click to show internal directories.
Click to hide internal directories.