Reputation: 11
I'm trying to interface with a custom add-in for powerpoint using python 3. Specifically think-cell, a charting tool. I need to use just one function documented here: https://www.think-cell.com/en/support/manual/exceldataautomation.shtml
I can successfuly use pywin32 to connect to powerpoint and get a reference to the addin
import win32com.client as win32
def ppt():
return win32.gencache.EnsureDispatch('PowerPoint.Application')
def excel():
return win32.gencache.EnsureDispatch('Excel.Application')
e = excel()
p = ppt()
thinkcell = p.COMAddIns("thinkcell.addin").Object
However when I call thinkcell.UpdateChart(slide, "Chart24", r)
(slide and r defined elsewhere) I get:
AttributeError: <unknown>.UpdateChart
.
I believe this to mean that the issue is there's no python interface written for the think-cell addin or that the addin is not registered in such a way that the object can call its functions.
How can I resolve this? If I need to write an interface that allows calling UpdateChart, what would that look like?
Upvotes: 1
Views: 431
Reputation: 2819
Did you tried some simple actions as:
p.Visible = True
presentation=p.Presentations.Add()
slide = presentation.Slides.Add(1, 12)
myDiamond = slide.Shapes.AddShape(4, Top=100,Left=100, Width=20, Height=20)
presentation.SaveAs(“C:\\Temp\\myPowerPoint”,1)
Also, Did you tried with:
p = win32com.client.Dispatch("PowerPoint.Application")
Upvotes: 0