diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-06-14 15:01:49 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-06-14 15:01:49 +0800 |
commit | a9f671d98f85585e7f77c73554f3c1ad897c4fd1 (patch) | |
tree | 1424e4a4b3e9c176483d8a883ae3168645ff31a4 /rows.go | |
parent | efff54ccde5b7f0a62bccbeab557e23e5e89970b (diff) |
- New functions: `GetSheetVisible()` and `GetRowVisible()` added, relate issue #61;
- go test updated
Diffstat (limited to 'rows.go')
-rw-r--r-- | rows.go | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -149,26 +149,33 @@ func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) { } } -// HideRow provides a function to set hidden of a single row by given worksheet index and row index. For example, hide row 3 in Sheet1: +// SetRowVisible provides a function to set visible of a single row by given +// worksheet index and row index. For example, hide row 3 in Sheet1: // -// xlsx.HideRow("Sheet1", 2) +// xlsx.SetRowVisible("Sheet1", 2, false) // -func (f *File) HideRow(sheet string, rowIndex int) { +func (f *File) SetRowVisible(sheet string, rowIndex int, visible bool) { xlsx := f.workSheetReader(sheet) rows := rowIndex + 1 cells := 0 completeRow(xlsx, rows, cells) + if visible { + xlsx.SheetData.Row[rowIndex].Hidden = false + return + } xlsx.SheetData.Row[rowIndex].Hidden = true } -// UnhideRow provides a function to set unhidden of a single row by given worksheet index and row index. For example, unhide row 3 in Sheet1: +// GetRowVisible provides a function to get visible of a single row by given +// worksheet index and row index. For example, get visible state of row 3 in +// Sheet1: // -// xlsx.UnhideRow("Sheet1", 2) +// xlsx.GetRowVisible("Sheet1", 2) // -func (f *File) UnhideRow(sheet string, rowIndex int) { +func (f *File) GetRowVisible(sheet string, rowIndex int) bool { xlsx := f.workSheetReader(sheet) rows := rowIndex + 1 cells := 0 completeRow(xlsx, rows, cells) - xlsx.SheetData.Row[rowIndex].Hidden = false + return !xlsx.SheetData.Row[rowIndex].Hidden } |