From 40ff5dc1a7d7aa42f5db9cf9dfe858cc3820b44e Mon Sep 17 00:00:00 2001
From: xuri <xuri.me@gmail.com>
Date: Sat, 23 Mar 2019 20:08:06 +0800
Subject: refactor: handler error instead of panic,

Exported functions:

SetCellStyle
InsertCol
RemoveCol
RemoveRow
InsertRow
DuplicateRow
DuplicateRowTo
SetRowHeight
GetRowHeight
GetCellValue
GetCellFormula
GetCellHyperLink
SetCellHyperLink
SetCellInt
SetCellBool
SetCellFloat
SetCellStr
SetCellDefault
GetCellStyle
SetCellValue
MergeCell
SetSheetRow
SetRowVisible
GetRowVisible
SetRowOutlineLevel
GetRowOutlineLevel
GetRows
Columns
SearchSheet
AddTable
GetPicture
AutoFilter
GetColVisible
SetColVisible
GetColOutlineLevel
SetColOutlineLevel
SetColWidth
GetColWidth

inner functions:

adjustHelper
adjustMergeCells
adjustAutoFilter
prepareCell
setDefaultTimeStyle
timeToExcelTime
addDrawingChart
addDrawingVML
addDrawingPicture
getTotalRowsCols
checkRow
addDrawingShape
addTable
---
 shape.go | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'shape.go')

diff --git a/shape.go b/shape.go
index c58038c..e6b0456 100644
--- a/shape.go
+++ b/shape.go
@@ -275,15 +275,21 @@ func (f *File) AddShape(sheet, cell, format string) error {
 		rID := f.addSheetRelationships(sheet, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
 		f.addSheetDrawing(sheet, rID)
 	}
-	f.addDrawingShape(sheet, drawingXML, cell, formatSet)
+	err = f.addDrawingShape(sheet, drawingXML, cell, formatSet)
+	if err != nil {
+		return err
+	}
 	f.addContentTypePart(drawingID, "drawings")
 	return err
 }
 
 // addDrawingShape provides a function to add preset geometry by given sheet,
 // drawingXMLand format sets.
-func (f *File) addDrawingShape(sheet, drawingXML, cell string, formatSet *formatShape) {
-	fromCol, fromRow := MustCellNameToCoordinates(cell)
+func (f *File) addDrawingShape(sheet, drawingXML, cell string, formatSet *formatShape) error {
+	fromCol, fromRow, err := CellNameToCoordinates(cell)
+	if err != nil {
+		return err
+	}
 	colIdx := fromCol - 1
 	rowIdx := fromRow - 1
 
@@ -421,6 +427,7 @@ func (f *File) addDrawingShape(sheet, drawingXML, cell string, formatSet *format
 	}
 	content.TwoCellAnchor = append(content.TwoCellAnchor, &twoCellAnchor)
 	f.Drawings[drawingXML] = content
+	return err
 }
 
 // setShapeRef provides a function to set color with hex model by given actual
-- 
cgit v1.2.1