From ed91cddea59ce15da87ab744ac20b465a36ed5ef Mon Sep 17 00:00:00 2001 From: Thomas Charbonnel Date: Thu, 11 Aug 2022 00:20:48 +0800 Subject: This closes #1296, add new function `GetRowOpts` for stream reader (#1297) - Support get rows properties by `GetRowOpts` function - New exported constant `MaxCellStyles` --- sheet.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'sheet.go') diff --git a/sheet.go b/sheet.go index 01dd167..1f2dcea 100644 --- a/sheet.go +++ b/sheet.go @@ -928,6 +928,34 @@ func attrValToInt(name string, attrs []xml.Attr) (val int, err error) { return } +// attrValToFloat provides a function to convert the local names to a float64 +// by given XML attributes and specified names. +func attrValToFloat(name string, attrs []xml.Attr) (val float64, err error) { + for _, attr := range attrs { + if attr.Name.Local == name { + val, err = strconv.ParseFloat(attr.Value, 64) + if err != nil { + return + } + } + } + return +} + +// attrValToBool provides a function to convert the local names to a boolean +// by given XML attributes and specified names. +func attrValToBool(name string, attrs []xml.Attr) (val bool, err error) { + for _, attr := range attrs { + if attr.Name.Local == name { + val, err = strconv.ParseBool(attr.Value) + if err != nil { + return + } + } + } + return +} + // SetHeaderFooter provides a function to set headers and footers by given // worksheet name and the control characters. // -- cgit v1.2.1