Documentation ¶
Index ¶
- func LoadExcel(filePath, filename string, colCount int) (rows [][]string, err error)
- func LoadExcelByStruct(filePath, filename string, data interface{}, ignoreRows int) (rows [][]string, err error)
- func LoadLadderExcel(filePath, filename string, colCount, ignoreRows, ignoreCols int) (rows [][]string, err error)
- type ExcelConfig
- func (e *ExcelConfig) ExportFile(filePath string) (err error)
- func (e *ExcelConfig) GetLadderTemplate(firstCase string, tableHead []string) (f *excelize.File, err error)
- func (e *ExcelConfig) GetTemplate(tableName string, tableHead []string) (f *excelize.File, err error)
- func (e *ExcelConfig) GetTemplateByStruct(tableName string, data interface{}) (f *excelize.File, err error)
- func (e *ExcelConfig) LoadHttpExcel(mf multipart.File, data interface{}, ignoreRows int, ...) (fileRcd exmodel.FileRecord, rows [][]string, err error)
- func (e *ExcelConfig) LoadHttpLadderExcel(mf multipart.File, tableHead []string, ignoreRows, ignoreCols int, ...) (fileRcd exmodel.FileRecord, rows [][]string, err error)
- type ExcelTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadExcel ¶
LoadExcel *
- @Description: 导入Excel
- @param filePath 文件路径(不包含文件名)
- @param filename 文件名
- @param colCount 需要读取的列数
- @return rows 读取后的内容
- @return err 错误
func LoadExcelByStruct ¶
func LoadExcelByStruct(filePath, filename string, data interface{}, ignoreRows int) (rows [][]string, err error)
LoadExcelByStruct *
- @Description: 导入Excel数据,通过结构体
- @param filePath 文件保存路径(不包含文件名)
- @param filename
- @param data 结构体
- @param ignoreRows 忽略行数(对前n行不进行校验)
- @return rows 读取出的数据
- @return err 错误
func LoadLadderExcel ¶
func LoadLadderExcel(filePath, filename string, colCount, ignoreRows, ignoreCols int) (rows [][]string, err error)
LoadLadderExcel *
- @Description:
- @param filePath 文件路径
- @param filename 文件名
- @param colCount 总列数
- @param ignoreRows 忽略行数
- @param ignoreCols 忽略列数
- @return rows 数据
- @return err 错误
Types ¶
type ExcelConfig ¶
type ExcelConfig struct { SheetName string // 工作表名称 FileName string // 文件名 DefaultColWidth float64 // 默认列宽 DefaultRowHeight float64 // 默认行高 SpecialColWidth map[string]float64 // 特殊列宽 SpecialRowHeight map[int]float64 // 特殊行高 Style map[string]exstyle.Style // 格式(map[左上,右下]exstyle.Style) MergeCell map[string]string // 需要合并单元格(map[左上]右下) DB *gorm.DB // 数据库对象 // contains filtered or unexported fields }
ExcelConfig 表格参数
func (*ExcelConfig) ExportFile ¶
func (e *ExcelConfig) ExportFile(filePath string) (err error)
ExportFile *
- @Description: 导出文件
- @receiver e
- @param filePath
- @return err
func (*ExcelConfig) GetLadderTemplate ¶
func (e *ExcelConfig) GetLadderTemplate(firstCase string, tableHead []string) (f *excelize.File, err error)
GetLadderTemplate *
- @Description: 生成阶梯导入模板
- @receiver e
- @param tableName
- @param firstCase
- @param tableHead
- @return f
- @return err
func (*ExcelConfig) GetTemplate ¶
func (e *ExcelConfig) GetTemplate(tableName string, tableHead []string) (f *excelize.File, err error)
GetTemplate *
- @Description: 获取文件导入模板
- @receiver e
- @param tableName
- @param tableHead
- @return f
- @return err
func (*ExcelConfig) GetTemplateByStruct ¶
func (e *ExcelConfig) GetTemplateByStruct(tableName string, data interface{}) (f *excelize.File, err error)
GetTemplateByStruct *
- @Description: 通过结构体获取文件导入模板
- @receiver e
- @param tableName
- @param data
- @return f
- @return err
func (*ExcelConfig) LoadHttpExcel ¶
func (e *ExcelConfig) LoadHttpExcel(mf multipart.File, data interface{}, ignoreRows int, filePath, fileName, funModule, userId string, otherFunc func()) (fileRcd exmodel.FileRecord, rows [][]string, err error)
LoadHttpExcel *
- @Description:
- @receiver e
- @param mf http文件对象
- @param data
- @param ignoreRows
- @param filePath 文件保存路径(不包含文件名)
- @param fileName 文件名(需要保持的文件名)
- @param funModule 所属功能模块名
- @param userId 操作人
- @param otherFunc 其他操作函数
- @return fileRcd 导入导出记录
- @return rows excel数据内容
- @return err 错误
func (*ExcelConfig) LoadHttpLadderExcel ¶
func (e *ExcelConfig) LoadHttpLadderExcel(mf multipart.File, tableHead []string, ignoreRows, ignoreCols int, filePath, fileName, funModule, userId string, otherFunc func()) (fileRcd exmodel.FileRecord, rows [][]string, err error)
LoadHttpLadderExcel *
- @Description:
- @receiver e
- @param mf http文件对象
- @param tableHead 表头
- @param ignoreRows 忽略行数
- @param ignoreCols 忽略列数
- @param filePath 文件保存路径(不包含文件名)
- @param fileName 文件名(需要保持的文件名)
- @param funModule 所属功能模块名
- @param userId 操作人
- @param otherFunc 其他操作函数
- @return fileRcd 导入导出记录
- @return rows excel数据内容
- @return err 错误
Click to show internal directories.
Click to hide internal directories.