summaryrefslogtreecommitdiff
path: root/rows.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-09-13 22:00:33 +0800
committerRi Xu <xuri.me@gmail.com>2017-09-13 22:00:33 +0800
commitf05f799f8d33e24b3bbf6c030c9f22d2829e0748 (patch)
treedff6b11b838c5ee26ea8c0fcf1af26bba8355702 /rows.go
parent3e7192b6abaa9c8db29a2e34867879ebc9fedca7 (diff)
- API changed, use worksheet name instead of "sheet" + index, related issue #25, #43, #47, #51, #89, #101, #116 and #120.
- go test updated
Diffstat (limited to 'rows.go')
-rw-r--r--rows.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/rows.go b/rows.go
index c45b49f..39c6246 100644
--- a/rows.go
+++ b/rows.go
@@ -8,15 +8,10 @@ import (
"strings"
)
-// GetRows return all the rows in a sheet by given "sheet" + index. For now you
-// should use sheet_name like "sheet3" where "sheet" is a constant part and "3"
-// is a sheet number. For example, if sheet named as "SomeUniqueData" and it is
-// second if spreadsheet program interface - you should use "sheet2" here. For
-// example:
+// GetRows return all the rows in a sheet by given worksheet name (case
+// sensitive). For example:
//
-// index := xlsx.GetSheetIndex("Sheet2")
-// rows := xlsx.GetRows("sheet" + strconv.Itoa(index))
-// for _, row := range rows {
+// for _, row := range xlsx.GetRows("Sheet1") {
// for _, colCell := range row {
// fmt.Print(colCell, "\t")
// }
@@ -70,7 +65,7 @@ func (f *File) GetRows(sheet string) [][]string {
}
// getTotalRowsCols provides a function to get total columns and rows in a
-// sheet.
+// worksheet.
func (f *File) getTotalRowsCols(sheet string) (int, int) {
name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
decoder := xml.NewDecoder(strings.NewReader(f.readXML(name)))
@@ -182,7 +177,7 @@ func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) {
}
// 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:
+// worksheet name and row index. For example, hide row 3 in Sheet1:
//
// xlsx.SetRowVisible("Sheet1", 2, false)
//
@@ -199,7 +194,7 @@ func (f *File) SetRowVisible(sheet string, rowIndex int, visible bool) {
}
// 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
+// worksheet name and row index. For example, get visible state of row 3 in
// Sheet1:
//
// xlsx.GetRowVisible("Sheet1", 2)
@@ -212,7 +207,7 @@ func (f *File) GetRowVisible(sheet string, rowIndex int) bool {
return !xlsx.SheetData.Row[rowIndex].Hidden
}
-// RemoveRow provides function to remove single row by given worksheet index and
+// RemoveRow provides function to remove single row by given worksheet name and
// row index. For example, remove row 3 in Sheet1:
//
// xlsx.RemoveRow("Sheet1", 2)