summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--excelize.go2
-rw-r--r--rows.go10
2 files changed, 7 insertions, 5 deletions
diff --git a/excelize.go b/excelize.go
index 95bce34..73c6eda 100644
--- a/excelize.go
+++ b/excelize.go
@@ -80,7 +80,7 @@ func (f *File) setDefaultTimeStyle(sheet, axis string) {
// workSheetReader provides function to get the pointer to the structure after
// deserialization by given worksheet index.
func (f *File) workSheetReader(sheet string) *xlsxWorksheet {
- name, ok := f.sheetMap[sheet]
+ name, ok := f.sheetMap[trimSheetName(sheet)]
if !ok {
name = "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
}
diff --git a/rows.go b/rows.go
index 78ed664..6e9aaaa 100644
--- a/rows.go
+++ b/rows.go
@@ -21,7 +21,10 @@ import (
func (f *File) GetRows(sheet string) [][]string {
xlsx := f.workSheetReader(sheet)
rows := [][]string{}
- name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
+ name, ok := f.sheetMap[trimSheetName(sheet)]
+ if !ok {
+ return rows
+ }
if xlsx != nil {
output, _ := xml.Marshal(f.Sheet[name])
f.saveFileList(name, replaceWorkSheetsRelationshipsNameSpace(string(output)))
@@ -31,7 +34,7 @@ func (f *File) GetRows(sheet string) [][]string {
var inElement string
var r xlsxRow
var row []string
- tr, tc := f.getTotalRowsCols(sheet)
+ tr, tc := f.getTotalRowsCols(name)
for i := 0; i < tr; i++ {
row = []string{}
for j := 0; j <= tc; j++ {
@@ -66,8 +69,7 @@ func (f *File) GetRows(sheet string) [][]string {
// getTotalRowsCols provides a function to get total columns and rows in a
// worksheet.
-func (f *File) getTotalRowsCols(sheet string) (int, int) {
- name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
+func (f *File) getTotalRowsCols(name string) (int, int) {
decoder := xml.NewDecoder(strings.NewReader(f.readXML(name)))
var inElement string
var r xlsxRow