本文整理汇总了Python中win32com.client.Dispatch.ScreenUpdating方法的典型用法代码示例。如果您正苦于以下问题:Python Dispatch.ScreenUpdating方法的具体用法?Python Dispatch.ScreenUpdating怎么用?Python Dispatch.ScreenUpdating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类win32com.client.Dispatch
的用法示例。
在下文中一共展示了Dispatch.ScreenUpdating方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save2xlsx
# 需要导入模块: from win32com.client import Dispatch [as 别名]
# 或者: from win32com.client.Dispatch import ScreenUpdating [as 别名]
def save2xlsx(fname, output_dump=None):
"""
Do a simple : create empty xlsx, paste python list as content, save as given
fname, close and quit MS Excel
"""
from win32com.client import Dispatch
if output_dump is None:
output_dump = []
xlapp = Dispatch("excel.application")
xlapp.DisplayAlerts = False
xlapp.Visible = True
xlapp.ScreenUpdating = True
# create a new spreadsheet
xlbook = xlapp.Workbooks.Add()
# use the first worksheet
sht1 = xlbook.Sheets("Sheet1")
# inserts all the accepted claims
address = list2exceladdress(output_dump)
pprint(address)
ur1 = sht1.Range(address)
ur1.Value = output_dump
xlbook.SaveAs(fname) # save the spreadsheet
xlbook.Close() # close the workbook
xlapp.DisplayAlerts = True
xlapp.Quit() # quit Excel
示例2: RefreshXlsx
# 需要导入模块: from win32com.client import Dispatch [as 别名]
# 或者: from win32com.client.Dispatch import ScreenUpdating [as 别名]
def RefreshXlsx(fname):
from os.path import exists
from win32com.client import Dispatch
if not exists(fname):
return ()
xlapp = Dispatch('Excel.Application')
# xlapp = EnsureDispatch('Excel.Application')
xlapp.DisplayAlerts = False
xlapp.Visible = True
xlapp.ScreenUpdating = True
xlBook = xlapp.Workbooks.Open(fname)
xlBook.RefreshAll()
xlBook.Save()
xlBook.Close()
xlapp.Quit()
del xlapp