浏览代码

fix:历史ppt表格显示

zqbao 5 月之前
父节点
当前提交
d21ce105f0
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      services/excel/lucky_sheet.go

+ 18 - 0
services/excel/lucky_sheet.go

@@ -1757,12 +1757,30 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hide
 						tmp.FontColor = styleConfig.Color
 					}
 					tmp.Monitor = showFormatValue
+					// 如果没有showValue, 则使用value
+					if cell.ShowValue == "" {
+						_, err := strconv.ParseFloat(cell.Value, 64)
+						if err == nil {
+							cell.ShowValue = cell.Value
+						}
+					}
 					_, err := strconv.ParseFloat(cell.Value, 64)
 					if err == nil {
 						hasPercent := false
 						if styleConfig.Nt == "percent" {
 							hasPercent = true
 						}
+						// 修复历史数据
+						if styleConfig.Pn != 0 {
+							if styleConfig.Decimal == nil {
+								styleConfig.Decimal = new(int)
+							}
+							*styleConfig.Decimal += styleConfig.Pn
+							if *styleConfig.Decimal < 0 {
+								*styleConfig.Decimal = 0
+							}
+						}
+
 						if styleConfig.Decimal != nil {
 							tmp.Monitor = utils.RoundNumber(cell.ShowValue, *styleConfig.Decimal, hasPercent)
 						} else {