فهرست منبع

Additional logic not required in getWorksheetFromSheet as we correctly read the mapping from the workbook.xml.rels file within the XLSX bundle.

Geoffrey J. Teale 12 سال پیش
والد
کامیت
38cf34ce4f
1فایلهای تغییر یافته به همراه1 افزوده شده و 17 حذف شده
  1. 1 17
      workbook.go

+ 1 - 17
workbook.go

@@ -5,7 +5,6 @@ import (
 	"encoding/xml"
 	"fmt"
 	"io"
-	"strings"
 )
 
 // xmlxWorkbookRels contains xmlxWorkbookRelations
@@ -134,22 +133,7 @@ func getWorksheetFromSheet(sheet xlsxSheet, worksheets map[string]*zip.File, she
 			sheetName = fmt.Sprintf("sheet%s", sheet.Id)
 		}
 	}
-	f, ok := worksheets[sheetName]
-	if !ok {
-		// excel created from mac MsExcel,will have a sheets Id as "rId1",
-		// but has a sheet file named "sheet1" and  "_rels/sheet1.xml."
-		// this work around will open it
-		for sheetName, f = range worksheets {
-			//do not want "_rels/sheet1.xml."
-			if strings.Contains(sheetName, "_") {
-				continue
-			}
-			break
-		}
-		if f == nil {
-			return nil, fmt.Errorf("not found sheet file sheetId:%s", sheet.Id)
-		}
-	}
+	f := worksheets[sheetName]
 	rc, error = f.Open()
 	if error != nil {
 		return nil, error