Browse Source

fix:最下方和最后方合并单元格的问题

Roc 2 years ago
parent
commit
d3a33bb1e0
1 changed files with 3 additions and 3 deletions
  1. 3 3
      services/excel/lucky_sheet.go

+ 3 - 3
services/excel/lucky_sheet.go

@@ -362,7 +362,7 @@ func (item *LuckySheetData) GetTableDataByLuckySheetDataStr() (selfTableData Tab
 		for rowIndex := lenRow - 1; rowIndex >= 0; rowIndex-- {
 			isDelete := true
 			for _, v := range tableDataList[rowIndex] {
-				if v.Monitor != `` || v.MergeCell.Column != rowIndex {
+				if v.Monitor != `` || (v.MergeCell.Row != rowIndex && v.MergeCell.Row != 0) {
 					isDelete = false
 					flag = true
 					break
@@ -424,7 +424,7 @@ func (item *LuckySheetData) GetTableDataByLuckySheetDataStr() (selfTableData Tab
 		for columnIndex := lenColumn - 1; columnIndex >= 0; columnIndex-- {
 			isDelete := true
 			for _, v := range tableDataList {
-				if v[columnIndex].Monitor != `` || v[columnIndex].MergeCell.Column != columnIndex {
+				if v[columnIndex].Monitor != `` || (v[columnIndex].MergeCell.Column != columnIndex && v[columnIndex].MergeCell.Column != 0) {
 					isDelete = false
 					flag = true
 					break
@@ -563,7 +563,7 @@ func HandleTableCell(oldTableData TableData) (newTableData TableData) {
 			tmpColumnDataList := newTableData.TableDataList[rowIndex]
 
 			newTableData.TableDataList[rowIndex] = append(tmpColumnDataList[:columnIndex], tmpColumnDataList[columnIndex+1:]...) // 删除开头N个元素
-			fmt.Println("row:", rowIndex, "===column:", columnIndex)
+			//fmt.Println("row:", rowIndex, "===column:", columnIndex)
 		}
 	}