浏览代码

fix:混合表格增加水平对齐

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

+ 12 - 1
services/excel/lucky_sheet.go

@@ -1749,13 +1749,24 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hide
 					if err := json.Unmarshal([]byte(cell.ShowStyle), &styleConfig); err != nil {
 						utils.FileLog.Info("表格样式showStyle解析失败", err.Error())
 					}
-					showFormatValue := fmt.Sprintf("%v", cell.ShowFormatValue)
 					if styleConfig.BackgroundColor != "" {
 						tmp.Background = styleConfig.BackgroundColor
 					}
 					if styleConfig.Color != "" {
 						tmp.FontColor = styleConfig.Color
 					}
+					switch styleConfig.Align {
+					case "center":
+						tmp.HorizontalType = 0
+						tmp.Ht = 0
+					case "left":
+						tmp.HorizontalType = 1
+						tmp.Ht = 1
+					case "right":
+						tmp.HorizontalType = 2
+						tmp.Ht = 2
+					}
+					showFormatValue := fmt.Sprintf("%v", cell.ShowFormatValue)
 					tmp.Monitor = showFormatValue
 					tmpShowValue, err := strconv.ParseFloat(cell.Value, 64)
 					if err == nil {