如何在 OLE2 ABAP 中对受保护的 excel 文件启用过滤器

How to enable filters on protected excel file in OLE2 ABAP

我能够在 ABAP 中使用 OLE2 添加过滤器,并且我的 excel 文件已成功创建。问题是过滤器不起作用 - 我可以看到附加到字段列的过滤器,但我无法点击。

DATA: go_application TYPE ole2_object,
      go_column      TYPE ole2_object,

CALL METHOD OF go_application 'Columns' = go_column.
CALL METHOD OF go_column 'AutoFit'.
SET PROPERTY OF go_column 'AutoFilter' = 1.
 CALL METHOD OF go_sheet 'Protect'
      EXPORTING
        #1  = 'pass' " Password
        #2  = 1 " Protect Drawing Objects
        #3  = 1 " Protect Contents
        #4  = 1 " Protect Scenarios
        #5  = 0
        #6  = 0
        #7  = 0
        #8  = 0
        #9  = 0
        #10 = 0
        #11 = 0
        #12 = 0
        #13 = 0
        #14 = 0
        #15 = 1.

#15 将过滤器打开。如果对您有用,请给我反馈