From 564ebe48dd660347c7ac5cdebe3395e4a085f19b Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Sun, 8 Apr 2018 10:31:11 +0800 Subject: - Fix `checkCellInArea()` index out of range when merged cell ref is single coordinate, relate issue #206; - go test updated; - Repository icon for SourceTree has been added --- cell.go | 4 ++++ excelize_test.go | 1 + logo.png | Bin 0 -> 4208 bytes test/Book1.xlsx | Bin 22962 -> 22981 bytes 4 files changed, 5 insertions(+) create mode 100644 logo.png diff --git a/cell.go b/cell.go index 281ab45..c5cd838 100644 --- a/cell.go +++ b/cell.go @@ -532,6 +532,10 @@ func checkCellInArea(cell, area string) bool { area = strings.ToUpper(area) ref := strings.Split(area, ":") + if len(ref) < 2 { + return false + } + from := ref[0] to := ref[1] diff --git a/excelize_test.go b/excelize_test.go index efffe8c..ade3baf 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -332,6 +332,7 @@ func TestMergeCell(t *testing.T) { xlsx.SetCellHyperLink("Sheet1", "J11", "https://github.com/360EntSecGroup-Skylar/excelize", "External") xlsx.SetCellFormula("Sheet1", "G12", "SUM(Sheet1!B19,Sheet1!C19)") xlsx.GetCellValue("Sheet1", "H11") + xlsx.GetCellValue("Sheet2", "A6") // Merged cell ref is single coordinate. xlsx.GetCellFormula("Sheet1", "G12") err = xlsx.Save() if err != nil { diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..4853698 Binary files /dev/null and b/logo.png differ diff --git a/test/Book1.xlsx b/test/Book1.xlsx index a8328cf..7168ff1 100644 Binary files a/test/Book1.xlsx and b/test/Book1.xlsx differ -- cgit v1.2.1