admin管理员组文章数量:1332872
I really need your help. I would greatly appreciate any advice you can give.
I am trying to sequentially open multiple OriginPro OLE objects embedded in a PowerPoint slide and automatically update the worksheets originally inside each object, but I am facing an issue.
When multiple OLE objects are open, op.find_sheet
(origin function) only calls the first opened OLE object, so I cannot update the next one. so I tried using op.exit
or doverb(0)
to close the first OLE object and then reconnect the application with op.attach
(origin function) to update the next OLE object, but I am unable to establish the reconnection to the origin application.
The approximate code is as follows:
import os
import win32com.client
import originpro as op
powerpoint = win32com.client.Dispatch("PowerPoint.Application")
powerpoint.Visible = True
origin = win32com.client.Dispatch("Origin.ApplicationSI")
origin.Visible = True
for slide_index, slide in enumerate(presentation.Slides)
for shape_index, shape in enumerate(slide.Shapes):
ole_name = shape.Name
if "origin" in ole_name.lower():
shape.OLEFormat.DoVerb(1)
wks = op.find_sheet('w', 0)
wks.from_df(data)
shape.OLEFormat.DoVerb(0)
op.detatch()
op.utils.exit()
op.attach()
I can successfully iterate through and open OLE objects, but after closing the completed OLE object, an error occurs when trying to reconnect with Origin.
additionally, I tried using time.sleep
and gc.collect
, but it didn’t work well.
本文标签:
版权声明:本文标题:powerpoint - How to update multiple origin OLEs embedeed in Power Point?(Python,OriginPro) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742295946a2448726.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论