Unverified Commit 9baa1bbc authored by xuri's avatar xuri

Fix #637, improve the compatibility of the auto filter with Office 2007 - 2013

parent dfea8f96
......@@ -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)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment