我正在使用 win32com 撰寫 Excel 作業表,但我的資料是從右到左的,我想從右到左設定作業表布局(與 Microsoft Excel 的頁面布局選項卡相同)
uj5u.com熱心網友回復:
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()
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/409589.html
標籤:
上一篇:M語言-僅從字串中提取5位數字
