File Exchange
Try Origin for Free
The Origin Forum
Home
|
Profile
|
Register
|
Active Topics
|
Members
|
Search
|
FAQ
|
Send File to Tech support
All Forums
Origin Forum for Programming
Forum for Python
How to Insert OLE into PowerPoint using Python
Note:
Only the poster of this message, and the Moderator can edit the message.
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Forum:
Forum for Python
Subject:
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
Origin Ver. and Service Release (Select Help-->About Origin): origin2023 Operating System: windows Hello. I am using Origin opju files by copying and pasting them into PowerPoint (graph with data included: ctrl + J), so that I can double-click the graphs in PowerPoint to edit the Origin graph and data as needed. I am trying to automate this process using Python, but the OLE insertion is not working (error: invalid request). I would appreciate it if you could help me with how to do this with the code below. --------------------------- import win32com.client as win32 import originpro as op # Open the Origin project file op.open("your_project.opju") # Get a list of all graph windows graphs = op.find_pages("G") if graphs: # Activate the first graph window graph = graphs[0] graph.activate() # Copy the graph op.copy_page(graph.name) # Start the PowerPoint application ppt_app = win32.Dispatch("PowerPoint.Application") ppt_app.Visible = True # Create a new presentation ppt = ppt_app.Presentations.Add() slide = ppt.Slides.Add(1, 1) # 1: ppLayoutText # Insert the Origin graph as an OLE object shape = slide.Shapes.AddOLEObject( Left=100, Top=100, Width=500, Height=400, ClassName="Origin.Application", FileName="your_project.opju", DisplayAsIcon=False ) # Save the slide ppt.SaveAs("output_presentation.pptx") # Close PowerPoint (optional) # ppt_app.Quit() else: print("No graph pages found in the project.")
Check here to subscribe to this topic.
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000