xlsxNews := excelize.NewFile()标签:Set,保存,Content,Header,xlsxNews,go,Response,下载 From: https://www.cnblogs.com/sumafan/p/16966939.html
xlsxNews.SetSheetRow("sheet1", "A1", &[]interface{}{
"publishDate", "newsId", "title"}, )
r.Response.Header().Set("Content-Type", "application/octet-stream")
r.Response.Header().Set("Content-Transfer-Encoding", "binary")
// 注意后面的attachment和filename,否则下载的时候不能自动命名文件名和文件后缀
r.Response.Header().Set("Content-Disposition", "attachment; filename="+"test.xlsx")
//r.Response.Write(file)
_ = xlsxNews.Write(r.Response.Writer)