Everything was already working, and suddenly...
The Calc sheet has a database range with a criteria range that has an advanced filter associated with it. The advanced filter works through the menu commands as expected. Also worked with a macro. But something happened...
After opening the file, the advanced filter does not work, and if you display the auto filter buttons and expand one (which field does not matter), the auto filter window will be blank (here is the problem, see screenshot). After toggling the auto filter using the menu command, the advanced filter starts working. Accordingly, the auto filter also works when redisplayed by the menu command. But after reopening the file, everything is repeated.
Tried changing the name of the database range, copied the contents of the sheet to another sheet with a special paste ... did not help.
I am under the impression that this is an old problem that has not been resolved, but maybe someone can suggest something so that I don't recreate the sheet from scratch? After all, it worked before...
The screenshot below (the language is not important) shows one unnamed checkbox against the background of the data range behind it.
Moreover, when such a buggy auto filter is displayed, the DatabaseRange.AutoFilter property returns False.
UPD:
I have no any anonymous zombie range names (see the topic in the link above).
UPD2:
Applied a patch.
Code: Select all
Sub SpreadsheetDocument_OnLoad(oEvent)
' Xray oEvent
' Toggle auto filter twice.
Call ToggleAutoFilter
Call ToggleAutoFilter
End Sub
Sub ToggleAutoFilter()
Dim document As Object
Dim dispatcher As Object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Dim args(0) As New com.sun.star.beans.PropertyValue
args(0).Name = "ToPoint"
args(0).Value = "$A$9" 'the top left corner of my database range
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args())
dispatcher.executeDispatch(document, ".uno:DataFilterAutoFilter", "", 0, Array())
End SubI will prepare an example if necessary. It will take some time. Everything needs to be translated into English.