V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
guanganqishi
V2EX  ›  Python

Python 自动化创建 ppt, Shapes 不能索引

  •  
  •   guanganqishi · 2018-01-06 22:43:00 +08:00 · 2076 次点击
    这是一个创建于 2272 天前的主题,其中的信息可能已经有所发展或是发生改变。
    def ppoint():
    app = 'PowerPoint'
    ppoint = win32.gencache.EnsureDispatch('{}.Application'.format(app))
    pres = ppoint.Presentations.Add()
    ppoint.Visible = True

    sl = pres.Slides.Add(1,win32.constants.ppLayoutText)
    sleep(1)
    sla = sl.Shapes[0].TextFrame.TextRange
    sla.Text = 'Python-to-{} Demo'.format(app)
    sleep(1)
    slb = sl.Shapes[1].TextFrame.TextRange
    for i in RANGE:
    slb.InsertAfter('Line {}\r\n'.format(i))
    sleep(1)
    slb.InsertAfter("\r\bTh-th-th-that's all folks!")

    warn(app)
    pres.Close()
    ppoint.Quit()
    错误信息 builtins.TypeError: 'Shapes' object does not support indexing
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3185 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:04 · PVG 21:04 · LAX 06:04 · JFK 09:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.