diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-07-16 13:03:45 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-07-16 13:03:45 +0800 |
commit | 3b2c80ddc37db87bf090f531ae6afcb70d49b759 (patch) | |
tree | bc6f6a2992d502cee6ab356b46bbd1710879a33d /sheet.go | |
parent | 4f942255e460d6eb3235c3973fe22eb19c328b43 (diff) |
Trim blank cells which created by `completeCol()`, relate issue #81
Diffstat (limited to 'sheet.go')
-rw-r--r-- | sheet.go | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -72,10 +72,29 @@ func (f *File) workbookWriter() { func (f *File) worksheetWriter() { for path, sheet := range f.Sheet { if sheet != nil { + for k, v := range sheet.SheetData.Row { + f.Sheet[path].SheetData.Row[k].C = trimCell(v.C) + } output, _ := xml.Marshal(sheet) f.saveFileList(path, replaceWorkSheetsRelationshipsNameSpace(string(output))) + ok := f.checked[path] + if ok { + f.checked[path] = false + } + } + } +} + +// trimCell provides function to trim blank cells which created by completeCol. +func trimCell(column []xlsxC) []xlsxC { + col := []xlsxC{} + for _, c := range column { + if c.S == 0 && c.V == "" && c.F == nil && c.T == "" { + continue } + col = append(col, c) } + return col } // Read and update property of contents type of XLSX. |