28 lines
672 B
Go
28 lines
672 B
Go
|
// Package excel -----------------------------
|
||
|
// @file : options.go
|
||
|
// @author : JJXu
|
||
|
// @contact : wavingBear@163.com
|
||
|
// @time : 2022/12/19 12:41:40
|
||
|
// -------------------------------------------
|
||
|
package excel
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"path/filepath"
|
||
|
"strings"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type Option func(excel *Excel)
|
||
|
|
||
|
//func AddSaveFileSuffixWithUnixTime(excel *Excel) {
|
||
|
// excel.SaveName
|
||
|
// fmt.Sprintf("%v", time.Now().Unix())
|
||
|
//}
|
||
|
// 时间戳作为文件后缀
|
||
|
func OptionFileNameSuffixWithUnixTime(excel *Excel) {
|
||
|
ext := filepath.Ext(excel.SaveName)
|
||
|
name := strings.Split(excel.SaveName, ext)[0]
|
||
|
excel.SaveName = fmt.Sprintf("%s_%v%s", name, time.Now().Unix(), ext)
|
||
|
}
|