调整项目架构,让框架更优化
This commit is contained in:
@@ -87,9 +87,12 @@ type ExportData interface {
|
||||
//
|
||||
// excel.ExportToWriter(w, "用户列表", columns, users)
|
||||
func (e *Excel) ExportToWriter(w io.Writer, sheetName string, columns []ExportColumn, data interface{}) error {
|
||||
if e.file == nil {
|
||||
e.file = excelize.NewFile()
|
||||
}
|
||||
// 每次导出使用新文件,避免同实例多次/并发导出互相污染
|
||||
e.file = excelize.NewFile()
|
||||
defer func() {
|
||||
_ = e.file.Close()
|
||||
e.file = nil
|
||||
}()
|
||||
|
||||
// 设置工作表名称
|
||||
if sheetName == "" {
|
||||
|
||||
Reference in New Issue
Block a user