From ddbaa92289d85e07a3d3da09ad61ab2e25ea157e Mon Sep 17 00:00:00 2001 From: zhangxin Date: Fri, 19 Mar 2021 17:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9SaveExcelFile=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/utils.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/utils/utils.go b/utils/utils.go index e053d93..ef7e13b 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -390,7 +390,28 @@ func FileExist(file string) bool { } -// 导出excel文件 prefixFilename 文件前缀名称 +/****************************************************************************** + * + * @Function Name : SaveExcelFile + *----------------------------------------------------------------------------- + * + * @Description : 把传入的[]interface 数据保存成excel + * + * @Function Parameters : []interface{} 需要保存的数据切片 + * + * @Function Parameters : sheetName excel sheet名称 + * + * @Function Parameters : prefixFilename 保存文件的前缀名称 后面会有自动添加时间和文件类型后缀 + * + * @Return Value : filepath 文件路径 + * + * @Return Value : err 执行出现的错误 + * + * @Author : zhangxin + * + * @Date : 2021-03-19 + * + ******************************************************************************/ func SaveExcelFile(list []interface{}, sheetName string, prefixFilename string) (filepath string, err error) { file := excelize.NewFile() streamWriter, err := file.NewStreamWriter(sheetName)