summaryrefslogtreecommitdiff
path: root/rows.go
diff options
context:
space:
mode:
Diffstat (limited to 'rows.go')
-rw-r--r--rows.go28
1 files changed, 19 insertions, 9 deletions
diff --git a/rows.go b/rows.go
index 3171ab1..1e20f0a 100644
--- a/rows.go
+++ b/rows.go
@@ -67,19 +67,29 @@ func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) {
// Rows defines an iterator to a sheet.
type Rows struct {
- err error
- curRow, totalRow, stashRow int
- rawCellValue bool
- sheet string
- f *File
- tempFile *os.File
- decoder *xml.Decoder
+ err error
+ curRow, totalRows, stashRow int
+ rawCellValue bool
+ sheet string
+ f *File
+ tempFile *os.File
+ decoder *xml.Decoder
+}
+
+// CurrentRow returns the row number that represents the current row.
+func (rows *Rows) CurrentRow() int {
+ return rows.curRow
+}
+
+// TotalRows returns the total rows count in the worksheet.
+func (rows *Rows) TotalRows() int {
+ return rows.totalRows
}
// Next will return true if find the next row element.
func (rows *Rows) Next() bool {
rows.curRow++
- return rows.curRow <= rows.totalRow
+ return rows.curRow <= rows.totalRows
}
// Error will return the error when the error occurs.
@@ -255,7 +265,7 @@ func (f *File) Rows(sheet string) (*Rows, error) {
}
}
}
- rows.totalRow = row
+ rows.totalRows = row
}
case xml.EndElement:
if xmlElement.Name.Local == "sheetData" {