Commit 49b8f5cf by yemin

no message

parent f3fa3124
......@@ -10,7 +10,7 @@ import (
"time"
)
// ToExcel 生成io.ReadSeeker 参数 titleList 为Excel表头,dataList 为数据
// ToExcel 生成io.ReadSeeker 参数 titleList 为Excel表头,dataList 为数据(数组的值只能是struct或者切片的指针)
func ToExcel(titleList []string, dataList []interface{}) (content io.ReadSeeker) {
// 生成一个新的文件
file := xlsx.NewFile()
......@@ -70,7 +70,7 @@ func ResponseXls(w http.ResponseWriter, req *http.Request, content io.ReadSeeker
}
// ExportExcel 生成excel并导出
// 参数 fileName:文件名;titleList:表头;dataList:数据(数组的值只能是struct或者切片)
// 参数 fileName:文件名;titleList:表头;dataList:数据(数组的值只能是struct或者切片的指针)
func ExportExcel(fileName string, titleList []string, dataList []interface{}, w http.ResponseWriter, req *http.Request) {
content := ToExcel(titleList, dataList)
ResponseXls(w, req, content, fileName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment