当前位置: 首页>>代码示例>>Python>>正文


Python Dispatch.ScreenUpdating方法代码示例

本文整理汇总了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
开发者ID:boonkwee,项目名称:mypylib,代码行数:30,代码来源:mylib.py

示例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
开发者ID:boonkwee,项目名称:mypylib,代码行数:22,代码来源:mylib.py


注:本文中的win32com.client.Dispatch.ScreenUpdating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。