diff options
author | three <three3q@qq.com> | 2021-08-13 01:32:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 01:32:44 +0800 |
commit | f6f14f507ee1adf4883cb1b12f27932a63afb286 (patch) | |
tree | 36128e53dc1b54f555bdd944829b1a4eb270f053 /adjust.go | |
parent | 61d0ed1ff26fbe47b4bfdc6adbc6db09743beb3a (diff) |
Speed up merge cells
Diffstat (limited to 'adjust.go')
-rw-r--r-- | adjust.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -145,7 +145,7 @@ func (f *File) adjustAutoFilter(ws *xlsxWorksheet, dir adjustDirection, num, off return nil } - coordinates, err := f.areaRefToCoordinates(ws.AutoFilter.Ref) + coordinates, err := areaRefToCoordinates(ws.AutoFilter.Ref) if err != nil { return err } @@ -199,7 +199,7 @@ func (f *File) adjustMergeCells(ws *xlsxWorksheet, dir adjustDirection, num, off for i := 0; i < len(ws.MergeCells.Cells); i++ { areaData := ws.MergeCells.Cells[i] - coordinates, err := f.areaRefToCoordinates(areaData.Ref) + coordinates, err := areaRefToCoordinates(areaData.Ref) if err != nil { return err } @@ -219,7 +219,7 @@ func (f *File) adjustMergeCells(ws *xlsxWorksheet, dir adjustDirection, num, off x1 = f.adjustMergeCellsHelper(x1, num, offset) x2 = f.adjustMergeCellsHelper(x2, num, offset) } - if x1 == x2 && y1 == y2 { + if x1 == x2 && y1 == y2 && i >= 0 { f.deleteMergeCell(ws, i) i-- } @@ -234,7 +234,7 @@ func (f *File) adjustMergeCells(ws *xlsxWorksheet, dir adjustDirection, num, off // compare and calculate cell axis by the given pivot, operation axis and // offset. func (f *File) adjustMergeCellsHelper(pivot, num, offset int) int { - if pivot >= num { + if pivot > num { pivot += offset if pivot < 1 { return 1 |