diff options
author | xuri <xuri.me@gmail.com> | 2021-08-06 22:44:43 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-08-06 22:44:43 +0800 |
commit | cf9fbafdd805874267a0f5d27fd1c720b148ec91 (patch) | |
tree | 4eda7bd0d974160b5f396c05cd914ba8baf504da /adjust.go | |
parent | 933159f9391f9be1b41b51e85885722124f8a7aa (diff) |
This closes #979, fix the data validation deletion issue and tidy the internal function in the source code
Diffstat (limited to 'adjust.go')
-rw-r--r-- | adjust.go | 60 |
1 files changed, 0 insertions, 60 deletions
@@ -11,10 +11,6 @@ package excelize -import ( - "strings" -) - type adjustDirection bool const ( @@ -194,62 +190,6 @@ func (f *File) adjustAutoFilterHelper(dir adjustDirection, coordinates []int, nu return coordinates } -// areaRefToCoordinates provides a function to convert area reference to a -// pair of coordinates. -func (f *File) areaRefToCoordinates(ref string) ([]int, error) { - rng := strings.Split(strings.Replace(ref, "$", "", -1), ":") - if len(rng) < 2 { - return nil, ErrParameterInvalid - } - - return areaRangeToCoordinates(rng[0], rng[1]) -} - -// areaRangeToCoordinates provides a function to convert cell range to a -// pair of coordinates. -func areaRangeToCoordinates(firstCell, lastCell string) ([]int, error) { - coordinates := make([]int, 4) - var err error - coordinates[0], coordinates[1], err = CellNameToCoordinates(firstCell) - if err != nil { - return coordinates, err - } - coordinates[2], coordinates[3], err = CellNameToCoordinates(lastCell) - return coordinates, err -} - -// sortCoordinates provides a function to correct the coordinate area, such -// correct C1:B3 to B1:C3. -func sortCoordinates(coordinates []int) error { - if len(coordinates) != 4 { - return ErrCoordinates - } - if coordinates[2] < coordinates[0] { - coordinates[2], coordinates[0] = coordinates[0], coordinates[2] - } - if coordinates[3] < coordinates[1] { - coordinates[3], coordinates[1] = coordinates[1], coordinates[3] - } - return nil -} - -// coordinatesToAreaRef provides a function to convert a pair of coordinates -// to area reference. -func (f *File) coordinatesToAreaRef(coordinates []int) (string, error) { - if len(coordinates) != 4 { - return "", ErrCoordinates - } - firstCell, err := CoordinatesToCellName(coordinates[0], coordinates[1]) - if err != nil { - return "", err - } - lastCell, err := CoordinatesToCellName(coordinates[2], coordinates[3]) - if err != nil { - return "", err - } - return firstCell + ":" + lastCell, err -} - // adjustMergeCells provides a function to update merged cells when inserting // or deleting rows or columns. func (f *File) adjustMergeCells(ws *xlsxWorksheet, dir adjustDirection, num, offset int) error { |