修正导出数字为文本格式问题 (#2033)

Co-authored-by: Cai Meng 蔡猛 <caimeng@wisers.com>
This commit is contained in:
OPSTime 2025-05-28 15:49:28 +08:00 committed by GitHub
parent 0ebb3d4195
commit b916c7951b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -315,7 +315,14 @@ func (sysExportTemplateService *SysExportTemplateService) ExportExcel(templateID
} }
for i, row := range rows { for i, row := range rows {
for j, colCell := range row { for j, colCell := range row {
sErr := f.SetCellValue("Sheet1", fmt.Sprintf("%s%d", getColumnName(j+1), i+1), colCell)
var sErr error
if v, err := strconv.ParseFloat(colCell, 64); err == nil {
sErr = f.SetCellValue("Sheet1", cell, v)
} else {
sErr = f.SetCellValue("Sheet1", cell, colCell)
}
if sErr != nil { if sErr != nil {
return nil, "", sErr return nil, "", sErr
} }