Просмотр исходного кода

- 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

Ri Xu 7 лет назад
Родитель
Сommit
564ebe48dd
4 измененных файлов с 5 добавлено и 0 удалено
  1. 4 0
      cell.go
  2. 1 0
      excelize_test.go
  3. BIN
      logo.png
  4. BIN
      test/Book1.xlsx

+ 4 - 0
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]
 

+ 1 - 0
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 {


BIN
test/Book1.xlsx