diff options
| author | Ri Xu <xuri.me@gmail.com> | 2016-09-06 21:20:24 +0800 |
|---|---|---|
| committer | Ri Xu <xuri.me@gmail.com> | 2016-09-06 21:20:24 +0800 |
| commit | df8f85d6abdebba567766484705134f30bf5f847 (patch) | |
| tree | 1730311c68e29fd3557695a1b6590a41830b9400 /lib.go | |
| parent | 50863294f9d6f2ecc399d06f1b3c2312c4bdce10 (diff) | |
Open file error return added and UpdateLinkedValue function added to fix linked values within a spreadsheet are not updating.
Diffstat (limited to 'lib.go')
| -rw-r--r-- | lib.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -14,19 +14,25 @@ import ( // ReadZip takes a pointer to a zip.ReadCloser and returns a // xlsx.File struct populated with its contents. In most cases // ReadZip is not used directly, but is called internally by OpenFile. -func ReadZip(f *zip.ReadCloser) (map[string]string, error) { +func ReadZip(f *zip.ReadCloser) (map[string]string, int, error) { defer f.Close() return ReadZipReader(&f.Reader) } // ReadZipReader can be used to read an XLSX in memory without // touching the filesystem. -func ReadZipReader(r *zip.Reader) (map[string]string, error) { +func ReadZipReader(r *zip.Reader) (map[string]string, int, error) { fileList := make(map[string]string) + worksheets := 0 for _, v := range r.File { fileList[v.Name] = readFile(v) + if len(v.Name) > 18 { + if v.Name[0:19] == "xl/worksheets/sheet" { + worksheets++ + } + } } - return fileList, nil + return fileList, worksheets, nil } // Read XML content as string and replace drawing property in XML namespace of sheet |
