From 37c4575835a40126ec7ce227c18aa8dbf9cc4bf3 Mon Sep 17 00:00:00 2001 From: ahmad Date: Mon, 31 Oct 2016 13:13:22 +0200 Subject: looping on row col functionality --- sheet.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sheet.go') diff --git a/sheet.go b/sheet.go index c0e9287..5315d70 100644 --- a/sheet.go +++ b/sheet.go @@ -185,6 +185,22 @@ func (f *File) SetActiveSheet(index int) { return } + + +func (f *File) GetColumnsLength(sheet string) (int, error) { + var xlsx xlsxWorksheet + name := `xl/worksheets/` + strings.ToLower(sheet) + `.xml` + err := xml.Unmarshal([]byte(f.readXML(name)), &xlsx) + if ( err != nil ) { + return -1, err + } + rows := len(xlsx.SheetData.Row) + + return rows, nil + +} + + // Replace xl/workbook.xml XML tags to self-closing for compatible Office Excel 2007. func workBookCompatibility(workbookMarshal string) string { workbookMarshal = strings.Replace(workbookMarshal, `xmlns:relationships="http://schemas.openxmlformats.org/officeDocument/2006/relationships" relationships:id="`, `r:id="`, -1) -- cgit v1.2.1