I want to know, how to remove a filter that is there in a calc sheet. In the below code, I set the filter and change the contents of filtered sheet, now I want to remove the filter, so that the sheet looks without any hidden rows...
I filter Column A and update column B on the filtered result...
Code: Select all
Dim xRange as object
Dim FilterDesc as Object
Dim FilterFields(0) as new com.sun.star.sheet.TableFilterField
xRange = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("A2:C12")
FilterDesc = xRange.createFilterDescriptor(true)
FilterDesc.ContainsHeader = true
FilterFields(0).Field = 0
FilterFields(0).IsNumeric = true
FilterFields(0).Operator = com.sun.star.sheet.FilterOperator.GREATER_EQUAL
FilterFields(0).NumericValue = 3
FilterDesc.SetFilterFields(FilterFields)
xRange.Filter(FilterDesc)
Dim xRange1 as Object
Dim Rngs as Object
xRange1 = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("B2:B12")
Rngs = xRange1.QueryVisibleCells()
for each c in Rngs.Cells
c.setString("Hai")
next c
' Need to remove the filter here... How ???
End Sub
- Raja