summaryrefslogtreecommitdiff
path: root/col.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-09-24 21:53:19 +0800
committerxuri <xuri.me@gmail.com>2019-09-24 21:53:19 +0800
commita34d3b8c86d67d3ad0bc0dbedb69d3b4ebbc210f (patch)
treeb281ae447cdf2f9355cde1d04098db664882a759 /col.go
parent75d66a03f33f25c29167c5f75ee8a4cc58598420 (diff)
Compatibility improvement
Diffstat (limited to 'col.go')
-rw-r--r--col.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/col.go b/col.go
index ffa0ca6..be08c29 100644
--- a/col.go
+++ b/col.go
@@ -10,6 +10,7 @@
package excelize
import (
+ "errors"
"math"
"strings"
)
@@ -112,19 +113,22 @@ func (f *File) GetColOutlineLevel(sheet, col string) (uint8, error) {
for c := range xlsx.Cols.Col {
colData := &xlsx.Cols.Col[c]
if colData.Min <= colNum && colNum <= colData.Max {
- level = colData.OutlineLevel
+ level = colData.OutlineLevel + 1
}
}
return level, err
}
// SetColOutlineLevel provides a function to set outline level of a single
-// column by given worksheet name and column name. For example, set outline
-// level of column D in Sheet1 to 2:
+// column by given worksheet name and column name. The value of parameter
+// 'level' is 1-7. For example, set outline level of column D in Sheet1 to 2:
//
// err := f.SetColOutlineLevel("Sheet1", "D", 2)
//
func (f *File) SetColOutlineLevel(sheet, col string, level uint8) error {
+ if level > 7 || level < 1 {
+ return errors.New("invalid outline level")
+ }
colNum, err := ColumnNameToNumber(col)
if err != nil {
return err