Преглед на файлове

fix:兼容前端传递的数据类型

Roc преди 2 години
родител
ревизия
8c3b0d4447
променени са 1 файла, в които са добавени 14 реда и са изтрити 2 реда
  1. 14 2
      services/excel/lucky_sheet.go

+ 14 - 2
services/excel/lucky_sheet.go

@@ -162,8 +162,9 @@ type LuckySheetDataConfigBorderInfoCellValue struct {
 
 // LuckySheetDataConfigBorderInfoCell 单元格边框信息(cell类型)
 type LuckySheetDataConfigBorderInfoCell struct {
-	Color string `json:"color" description:"边框颜色 color: 16进制颜色值"`
-	Style string `json:"style" description:"边框粗细 style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick ,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 aspose.cells"`
+	Color string      `json:"color" description:"边框颜色 color: 16进制颜色值"`
+	Style int         `description:"边框粗细 style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick ,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 aspose.cells"`
+	Sl    interface{} `json:"style" description:"边框粗细 style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick ,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 aspose.cells"`
 }
 
 // LuckySheetCellData 单个单元格数据
@@ -259,6 +260,17 @@ func GetLuckySheetData(jsonStr string) (item *LuckySheetData, err error) {
 
 		item.CellData[k].Value = value
 	}
+
+	//边框
+	if len(item.Config.BorderInfo) > 0 {
+		for k, v := range item.Config.BorderInfo {
+			v.Value.T.Style = getIntValueByInterface(v.Value.T.Style)
+			v.Value.B.Style = getIntValueByInterface(v.Value.B.Style)
+			v.Value.L.Style = getIntValueByInterface(v.Value.L.Style)
+			v.Value.R.Style = getIntValueByInterface(v.Value.R.Style)
+			item.Config.BorderInfo[k] = v
+		}
+	}
 	return
 }