Browse Source

Merge branch 'bzq/excel_style' of eta_gn_server/eta_chart_lib into master

baoziqiang 3 months ago
parent
commit
d0a0cb27e5
2 changed files with 12 additions and 0 deletions
  1. 1 0
      models/request/mixed_table.go
  2. 11 0
      services/excel/lucky_sheet.go

+ 1 - 0
models/request/mixed_table.go

@@ -167,6 +167,7 @@ type MixCellShowStyle struct {
 	Last            string      `description:"起始操作:nt|decimal" json:"last"`
 	Color           string      `description:"颜色值,#RRG" json:"color"`
 	BackgroundColor string      `description:"背景颜色值,#RRG" json:"background-color"`
+	Align           string      `description:"对齐方式:left|center|right" json:"align"`
 }
 
 type DateDataBeforeAfterReq struct {

+ 11 - 0
services/excel/lucky_sheet.go

@@ -1231,6 +1231,17 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hide
 							cell.ShowValue = cell.Value
 						}
 					}
+					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
+					}
 					_, err := strconv.ParseFloat(cell.ShowValue, 64)
 					if err == nil {
 						hasPercent := false