forked from p30928647/excelize
Fix #637, improve the compatibility of the auto filter with Office 2007 - 2013
This commit is contained in:
parent
dfea8f96ed
commit
9baa1bbc98
14
table.go
14
table.go
|
@ -290,6 +290,20 @@ func (f *File) AutoFilter(sheet, hcell, vcell, format string) error {
|
|||
return err
|
||||
}
|
||||
ref := cellStart + ":" + cellEnd
|
||||
wb := f.workbookReader()
|
||||
d := xlsxDefinedName{
|
||||
Name: "_xlnm._FilterDatabase",
|
||||
Hidden: true,
|
||||
LocalSheetID: intPtr(f.GetSheetIndex(sheet)),
|
||||
Data: fmt.Sprintf("%s!%s", sheet, ref),
|
||||
}
|
||||
if wb.DefinedNames != nil {
|
||||
wb.DefinedNames.DefinedName = append(wb.DefinedNames.DefinedName, d)
|
||||
} else {
|
||||
wb.DefinedNames = &xlsxDefinedNames{
|
||||
DefinedName: []xlsxDefinedName{d},
|
||||
}
|
||||
}
|
||||
refRange := vcol - hcol
|
||||
return f.autoFilter(sheet, ref, refRange, hcol, formatSet)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue