python win32com 中从右到左 excel 页面布局

right to left excel page layout in python win32com

我正在使用 win32com 编写 excel sheet,但我的数据是从右到左的,我想设置 sheet 布局从右到左(与 Microsoft Excel的页面布局选项卡)

https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetview.righttoleft?view=openxml-2.8.1

ActiveSheet.DisplayRightToLeft = True

编辑:

更明确一点...

import win32com.client as win32
xl = win32.gencache.EnsureDispatch('Excel.Application')

#xl.Visible = True

new_file = r'Drive:\path\file.xlsx'
new_book = xl.Workbooks.Open(new_file)

for sheet in new_book.Sheets: 
    xl.Worksheets(sheet.Name).Activate()
    new_book.Worksheets(sheet.Name).DisplayRightToLeft = True

xl.Application.Quit()