|
@@ -10,6 +10,7 @@ import (
|
|
|
"os"
|
|
"os"
|
|
|
"strconv"
|
|
"strconv"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
+ "unicode/utf8"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// File is a high level structure providing a slice of Sheet structs
|
|
// File is a high level structure providing a slice of Sheet structs
|
|
@@ -154,8 +155,8 @@ func (f *File) AddSheet(sheetName string) (*Sheet, error) {
|
|
|
if _, exists := f.Sheet[sheetName]; exists {
|
|
if _, exists := f.Sheet[sheetName]; exists {
|
|
|
return nil, fmt.Errorf("duplicate sheet name '%s'.", sheetName)
|
|
return nil, fmt.Errorf("duplicate sheet name '%s'.", sheetName)
|
|
|
}
|
|
}
|
|
|
- if len(sheetName) >= 31 {
|
|
|
|
|
- return nil, fmt.Errorf("sheet name must be less than 31 characters long. It is currently '%d' characters long", len(sheetName))
|
|
|
|
|
|
|
+ if utf8.RuneCountInString(sheetName) >= 31 {
|
|
|
|
|
+ return nil, fmt.Errorf("sheet name must be less than 31 characters long. It is currently '%d' characters long", utf8.RuneCountInString(sheetName))
|
|
|
}
|
|
}
|
|
|
sheet := &Sheet{
|
|
sheet := &Sheet{
|
|
|
Name: sheetName,
|
|
Name: sheetName,
|