소스 검색

Fixed duplicate empty cell creation inf readRowsFromSheet as reported in issue #4

Geoffrey J. Teale 14 년 전
부모
커밋
02c684ca8e
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      lib.go

+ 2 - 4
lib.go

@@ -210,7 +210,7 @@ func makeRowFromSpan(spans string) *Row {
 // readRowsFromSheet is an internal helper function that extracts the
 // readRowsFromSheet is an internal helper function that extracts the
 // rows from a XSLXWorksheet, poulates them with Cells and resolves
 // rows from a XSLXWorksheet, poulates them with Cells and resolves
 // the value references from the reference table and stores them in
 // the value references from the reference table and stores them in
-func readRowsFromSheet(worksheet *XLSXWorksheet, reftable []string) []*Row {
+func readRowsFromSheet(Worksheet *XLSXWorksheet, reftable []string) []*Row {
 
 
 	// Note, this function needs tidying up!
 	// Note, this function needs tidying up!
 	var rows []*Row
 	var rows []*Row
@@ -226,8 +226,7 @@ func readRowsFromSheet(worksheet *XLSXWorksheet, reftable []string) []*Row {
 				panic(fmt.Sprintf("Invalid Cell Coord, %s\n", rawcell.R))
 				panic(fmt.Sprintf("Invalid Cell Coord, %s\n", rawcell.R))
 			}
 			}
 			error = nil
 			error = nil
-			cell = new(Cell)
-			cell.data = ""
+			cell = row.Cells[x]
 			if len(rawcell.V.Data) > 0 {
 			if len(rawcell.V.Data) > 0 {
 				vval := strings.Trim(rawcell.V.Data, " \t\n\r")
 				vval := strings.Trim(rawcell.V.Data, " \t\n\r")
 				if rawcell.T == "s" {
 				if rawcell.T == "s" {
@@ -242,7 +241,6 @@ func readRowsFromSheet(worksheet *XLSXWorksheet, reftable []string) []*Row {
 				}
 				}
 
 
 			}
 			}
-			row.Cells[x] = cell
 		}
 		}
 		rows[i] = row
 		rows[i] = row
 	}
 	}