如何使用Python3和win32com.client在Excel工作簿中显示/显示所有公式,就像我可以使用Cntrl-`进行交互式操作
我相信我必须使用Windows DisplayFormulas Property,但是我不知道如何在Python中访问ActiveWindow来执行此操作。
这是我打开电子表格和第一个工作簿并保存的代码:
import win32com.client
excel = win32com.client.Dispatch("Excel.Application")
wb = excel.Workbooks.Open(wb_path)
ws_index_list = [1]
wb.WorkSheets(ws_index_list).Select()
// would like to toggle to show the formulas here before saving
wb.ActiveSheet.ExportAsFixedFormat(0, pdf_path)
wb.Close(False)
在键盘上,我只需输入Cntrl-`,因为要处理约30个excel电子表格,所以我想使它自动化。
答案 0 :(得分:0)
您首先需要访问<mat-vertical-stepper>
<ng-template matStepperIcon="edit">
<mat-icon>insert_drive_file</mat-icon>
</ng-template>
<ng-template matStepperIcon="done">
<mat-icon>done_all</mat-icon>
</ng-template>
<!-- Custom icon with a context variable. -->
<ng-template matStepperIcon="number" let-index="index">
{{index + 10}}
</ng-template>
<!-- Stepper steps go here -->
</mat-vertical-stepper>
应用程序的Window
对象。然后,您可以调用Excel
方法:
DisplayFormulas