作者 tangxvhui

bug

修复
... ... @@ -413,12 +413,6 @@ func (c *AuditController) ChanceDataExcel() {
xlsMaker := exceltool.NewExcelMaker()
xlsMaker.SetListHead(excelHead)
xlsMaker.MakeListExcelForBeego(sourceData)
err = xlsMaker.Xlsx.Write(c.Ctx.Output.Context.ResponseWriter)
if err != nil {
msg = protocol.BadRequestParam("1")
c.ResposeJson(msg)
return
}
c.ResponseExcelByFile(c.Ctx, xlsMaker)
return
}
... ...
... ... @@ -108,7 +108,8 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R
}
func (this *BaseController) ResponseExcelByFile(ctx *context.Context, excelMaker *exceltool.ExcelMaker) error {
ctx.Output.Header("Content-Disposition", "attachment; filename="+excelMaker.GetFileName())
fname := excelMaker.GetFileName()
ctx.Output.Header("Content-Disposition", "attachment; filename="+fname)
ctx.Output.Header("Content-Description", "File Transfer")
ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
ctx.Output.Header("Content-Transfer-Encoding", "binary")
... ...
... ... @@ -75,7 +75,7 @@ func (e *ExcelMaker) MakeListExcel(sourData []map[string]string) (err error) {
e.Xlsx.SetCellStr("Sheet1", cellAlpha, sourData[key1][headEn[i]])
}
}
e.fileName = GetRandomString(8) + ".xlsx"
e.SetFileName(GetRandomString(8) + ".xlsx")
return nil
}
... ...