Add NumSheets to get the number of sheets

This commit is contained in:
Liu Ming
2016-01-21 13:14:37 +08:00
parent 1dd2ce626e
commit 1375b24d9d
3 changed files with 20 additions and 1 deletions

View File

@@ -210,16 +210,24 @@ func (w *WorkBook) prepareSheet(sheet *WorkSheet) {
sheet.parse(w.rs)
}
//Get one sheet by its number
func (w *WorkBook) GetSheet(num int) *WorkSheet {
if num < len(w.sheets) {
s := w.sheets[num]
w.prepareSheet(s)
if !s.parsed {
w.prepareSheet(s)
}
return s
} else {
return nil
}
}
//Get the number of all sheets, look into example
func (w *WorkBook) NumSheets() int {
return len(w.sheets)
}
//helper function to read all cells from file
func (w *WorkBook) ReadAllCells(max int) (res [][]string) {
res = make([][]string, 0)