diff --git a/lib.go b/lib.go index dec567ee..e7dd738c 100644 --- a/lib.go +++ b/lib.go @@ -735,7 +735,13 @@ func readSheetFromFile(rsheet xlsxSheet, fi *File, sheetXMLMap map[string]string sheet.SheetViews = readSheetViews(worksheet.SheetViews) if worksheet.AutoFilter != nil { autoFilterBounds := strings.Split(worksheet.AutoFilter.Ref, ":") - sheet.AutoFilter = &AutoFilter{autoFilterBounds[0], autoFilterBounds[1]} + + bottomRightCell := autoFilterBounds[0] + if len(autoFilterBounds) > 1 { + bottomRightCell = autoFilterBounds[1] + } + + sheet.AutoFilter = &AutoFilter{autoFilterBounds[0], bottomRightCell} } sheet.SheetFormat.DefaultColWidth = worksheet.SheetFormatPr.DefaultColWidth diff --git a/sheet.go b/sheet.go index de0ffe22..1c335eb6 100644 --- a/sheet.go +++ b/sheet.go @@ -30,8 +30,8 @@ type Sheet struct { cellStore CellStore currentRow *Row cellStoreName string // The first part of the key used in - // the cellStore. This name is stable, - // unlike the Name, which can change + // the cellStore. This name is stable, + // unlike the Name, which can change } // NewSheet constructs a Sheet with the default CellStore and returns @@ -47,8 +47,8 @@ func NewSheetWithCellStore(name string, constructor CellStoreConstructor) (*Shee return nil, fmt.Errorf("sheet name is invalid: %w", err) } sheet := &Sheet{ - Name: name, - Cols: &ColStore{}, + Name: name, + Cols: &ColStore{}, cellStoreName: name, } var err error @@ -949,10 +949,9 @@ func handleNumFmtIdForXLSX(NumFmtId int, styles *xlsxStyleSheet) (XfId int) { return } - func IsSaneSheetName(sheetName string) error { runeLength := utf8.RuneCountInString(sheetName) - if runeLength > 31 || runeLength == 0 { + if runeLength > 43 || runeLength == 0 { return fmt.Errorf("sheet name must be 31 or fewer characters long. It is currently '%d' characters long", runeLength) } // Iterate over the runes