Macros/Calc/ba027/es
TDF LibreOffice en español Document Liberation Project Blogs comunitarios Weblate Nextcloud Redmine Preguntas y respuestas Donar
Summary
This page provides a LibreOffice Basic macro procedure that removes the current sheet filter by setting an empty filter. It is an example drawn from Chapter 13 ("Calc as a Database") of the 7.0 Calc Guide.
Description
When a filter is applied to a sheet, it replaces any existing filter for that sheet. Therefore, to remove a filter in a sheet, simply create and set an empty filter for that sheet (see code below).
Code
Sub RemoveSheetFilter()
Dim oSheet ' <span lang="en" dir="ltr" class="mw-content-ltr">Sheet to filter.</span>
Dim oFilterDesc ' <span lang="en" dir="ltr" class="mw-content-ltr">Filter descriptor.</span>
oSheet = ThisComponent.getSheets().getByIndex(0)
oFilterDesc = oSheet.createFilterDescriptor(True)
oSheet.filter(oFilterDesc)
End Sub
This Calc spreadsheet contains the above LibreOffice Basic code.