I often use filters in my Open/LibreOffice and wanted to know how to create a macro that removes all existing filters. The OpenOffice Wiki tells you how to do this.
Sub RemoveSheetFilter() Dim oSheet ' Sheet to filter. Dim oFilterDesc ' Filter descriptor. oSheet = ThisComponent.getSheets().getByIndex(0) oFilterDesc = oSheet.createFilterDescriptor(True) oSheet.filter(oFilterDesc) End Sub
The underlying logic is that when a filter is applied to a sheet, it replaces any existing filter for the sheet. Setting an empty filter in a sheet will therefore remove all filters for that sheet.