diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-01-18 14:47:23 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-01-18 14:47:23 +0800 |
commit | f05df2a0182ee5761f5fbe7e56020313a0ab0b61 (patch) | |
tree | 7aaf5365c9082931f9d4cdd080ff2932918164fb /cell.go | |
parent | a99f0227b085d8f417f77864941650ef0e6273e4 (diff) |
- New function `SetSheetName` and `SetColWidth` added, support rename sheet and set column width;
- Add escape characters of sheet name;
- Update go test and fix typo
Diffstat (limited to 'cell.go')
-rw-r--r-- | cell.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -13,7 +13,7 @@ func (f *File) GetCellValue(sheet string, axis string) string { var xlsx xlsxWorksheet row, _ := strconv.Atoi(strings.Map(intOnlyMapF, axis)) xAxis := row - 1 - name := `xl/worksheets/` + strings.ToLower(sheet) + `.xml` + name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml" xml.Unmarshal([]byte(f.readXML(name)), &xlsx) rows := len(xlsx.SheetData.Row) if rows > 1 { @@ -23,7 +23,7 @@ func (f *File) GetCellValue(sheet string, axis string) string { } } if rows <= xAxis { - return `` + return "" } for _, v := range xlsx.SheetData.Row { if v.R != row { @@ -38,7 +38,7 @@ func (f *File) GetCellValue(sheet string, axis string) string { shardStrings := xlsxSST{} xlsxSI := 0 xlsxSI, _ = strconv.Atoi(r.V) - xml.Unmarshal([]byte(f.readXML(`xl/sharedStrings.xml`)), &shardStrings) + xml.Unmarshal([]byte(f.readXML("xl/sharedStrings.xml")), &shardStrings) return shardStrings.SI[xlsxSI].T case "str": return r.V @@ -47,7 +47,7 @@ func (f *File) GetCellValue(sheet string, axis string) string { } } } - return `` + return "" } // GetCellFormula provide function get formula from cell by given sheet index and axis in XLSX file. @@ -56,7 +56,7 @@ func (f *File) GetCellFormula(sheet string, axis string) string { var xlsx xlsxWorksheet row, _ := strconv.Atoi(strings.Map(intOnlyMapF, axis)) xAxis := row - 1 - name := `xl/worksheets/` + strings.ToLower(sheet) + `.xml` + name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml" xml.Unmarshal([]byte(f.readXML(name)), &xlsx) rows := len(xlsx.SheetData.Row) if rows > 1 { @@ -66,7 +66,7 @@ func (f *File) GetCellFormula(sheet string, axis string) string { } } if rows <= xAxis { - return `` + return "" } for _, v := range xlsx.SheetData.Row { if v.R != row { @@ -81,5 +81,5 @@ func (f *File) GetCellFormula(sheet string, axis string) string { } } } - return `` + return "" } |