From ebea684ae5c60776d4d8364b7360d0c0603cb3b0 Mon Sep 17 00:00:00 2001
From: xuri <xuri.me@gmail.com>
Date: Mon, 18 Jul 2022 00:21:34 +0800
Subject: Fix potential file corrupted and change worksheet name
 case-insensitive

- Using sheet ID instead of sheet index when delete the cell in calculation chain
- Update documentation for exported functions
- Using `sheet` represent the sheet name in the function parameters
---
 shape.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'shape.go')

diff --git a/shape.go b/shape.go
index ddf9e31..58751b2 100644
--- a/shape.go
+++ b/shape.go
@@ -300,7 +300,8 @@ func (f *File) AddShape(sheet, cell, format string) error {
 		drawingXML = strings.ReplaceAll(sheetRelationshipsDrawingXML, "..", "xl")
 	} else {
 		// Add first shape for given sheet.
-		sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(f.sheetMap[trimSheetName(sheet)], "xl/worksheets/") + ".rels"
+		sheetXMLPath, _ := f.getSheetXMLPath(sheet)
+		sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetXMLPath, "xl/worksheets/") + ".rels"
 		rID := f.addRels(sheetRels, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
 		f.addSheetDrawing(sheet, rID)
 		f.addSheetNameSpace(sheet, SourceRelationship)
-- 
cgit v1.2.1