Currently I am working in project, where we are migrating all the Excel reports (Behind logic in VBA code) to SSRS reports. I have to enable AUTO FILTER for the excel reports generated from SSRS. Can you please help on this
问题:
回答1:
I am trying to figure out how to do this as well. So far I have the following VBA to add an auto-filter to all sheets on row 1:
Sub FilterLoop()
Dim WS_Count As Integer
Dim I As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
ActiveWorkbook.Worksheets(I).Select
Range("A1").AutoFilter
Next I
ActiveWorkbook.Worksheets(1).Select
End Sub
It is less than ideal, but I have added this to my PERSONAL
workbook so that I can just run it when I generate a new report. I hope this helps, and if I figure out something better, I'll post again.
回答2:
I had the same issue too and I think it is not possible.
The Excel export is primarily a layout renderer. It replicates the layout of the rendered report as closely as possible. There are differences and different limitations in Excel, so not everything is working. The AutoFilter is not supported, you cannot add it automatically to the exported file.
Excel does not support interactive sort either.
https://docs.microsoft.com/en-us/sql/reporting-services/report-builder/exporting-to-microsoft-excel-report-builder-and-ssrs#a-nameinteractivitya-interactivity
In my case, I have to open the generated file in c# and add the filter there.