473,549 Members | 3,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create Powerpoint via com

Can someone point me to a simple example
or better yet tutorial for creating
a Powerpoint using Python.

Thanks,
Alan Isaac
Aug 30 '07 #1
6 4452
Alan,

On Aug 30, 1:37 pm, Alan Isaac <ais...@america n.eduwrote:
Can someone point me to a simple example
or better yet tutorial for creating
a Powerpoint using Python.

Thanks,
Alan Isaac
You should check our the following for information on using COM
itself:

http://www.oreilly.com/catalog/pytho...pter/ch12.html

Core Python Programming by Chun has an example in it using Tkinter. I
did it a while back, so here's the source:
<code>

# Core Python Chp 23, pg 994
# ppoint.pyw

from Tkinter import Tk
from time import sleep
from tkMessageBox import showwarning
import win32com.client as win32

warn = lambda app: showwarning(app , 'Exit?')
RANGE = range(3, 8)

def ppoint():
app = 'PowerPoint'
ppoint = win32.gencache. EnsureDispatch( '%s.Application ' % app)
pres = ppoint.Presenta tions.Add()
ppoint.Visible = True

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

warn(app)
pres.Close()
ppoint.Quit()

if __name__ == '__main__':
Tk().withdraw()
ppoint()

</code>

I recommend getting ActiveState's Python distro as it comes with an
IDE that can browse COM objects fairly easily.

Hope that helps!

Mike

Aug 30 '07 #2
ky******@gmail. com wrote:
Hope that helps!
Yes indeed.
Thanks!
Alan
Aug 30 '07 #3
ky******@gmail. com wrote:
<code>
OK, creating bulleted lists, or tables,
or adding pictures is all straightforward .
How about chart creation (in Ppt 2003)?
I do not see how to do this with Python.

Thanks,
Alan
Aug 31 '07 #4
On Aug 30, 11:55 pm, Alan Isaac <ais...@america n.eduwrote:
kyoso...@gmail. com wrote:
<code>

OK, creating bulleted lists, or tables,
or adding pictures is all straightforward .
How about chart creation (in Ppt 2003)?
I do not see how to do this with Python.

Thanks,
Alan
Alan,

You probably need to browse the COM object using PythonWin, which is a
part of the ActiveState distro. You can also use Python's builtin
function, dir, to find out various methods of COM.

Here's some info in messing with charts in Excel, which should be
similar to chart manipulation in PowerPoint.

http://mail.python.org/pipermail/pyt...ne/003511.html
http://mail.python.org/pipermail/pyt...ch/000839.html
http://www.thescripts.com/forum/thread21565.html
http://mathieu.fenniak.net/plotting-...ugh-pythoncom/

Mike

Aug 31 '07 #5
>>How about chart creation (in Ppt 2003)?
>>I do not see how to do this with Python.
ky******@gmail. com wrote:
You probably need to browse the COM object using PythonWin, which is a
part of the ActiveState distro. You can also use Python's builtin
function, dir, to find out various methods of COM.

Here's some info in messing with charts in Excel, which should be
similar to chart manipulation in PowerPoint.

http://mail.python.org/pipermail/pyt...ne/003511.html
http://mail.python.org/pipermail/pyt...ch/000839.html
http://www.thescripts.com/forum/thread21565.html
http://mathieu.fenniak.net/plotting-...ugh-pythoncom/

Thanks!
Alan
Aug 31 '07 #6
Well, my needs were very limited so the
result is too, but in case someone else
just needs to get started:
http://econpy.googlecode.com/svn/trunk/utilities/mso.py

Comments, suggestions, additions welcom.

Alan Isaac
Sep 2 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
42121
by: Joseph | last post by:
I am trying to open a 3 powerpoint presentation simultaneously afte each other without interruption, the operator of the application doe not need to notice anything or interfere in the operation of th transition between the 3 presentations. Let us say I have three powerpoint presentation Presentation 1 Presentation 2, and Presentation 3. ...
0
868
by: msnews.microsoft.com | last post by:
I need to create custom word documents on a local web server. Currently I am using RTF but have trouble formatting complex tables. The overall syntax is cumbersome at best. I will also need to create powerpoint summaries of the word version. What is the best way to go about creating these?
11
11739
by: ssims | last post by:
1) Is it possible to create a powerpoint file with asp.net? I've Googled it and can't seem to find a definitive guide. 2) If it is possible to create a powerpoint file with asp.net, is it possible to pull exisiting slides together in a certain order rather than creating the slides from scratch? Thanks, -Sean
6
6307
by: BWPanda | last post by:
Hi everyone, I'm wanting to use VB.NET to display a powerpoint presentation, much the same way as the presenter that comes with PowerPoint (when used on multiple monitors). Basically, I want to show the presentation in one form/window, and in the other, have controls for moving through the presentation, list of slides, etc. I don't...
3
8090
by: WPeterson | last post by:
Converting PowerPoint to Flash would absolutely be a good choice to distribute your bulky PowerPoint presentations. You can do the whole PowerPoint to Flash conversion manually or with professional applications. First, you'll need to prepare the PowerPoint files. Make sure you are not using any complicated gradients or animations. These will...
0
1044
by: rishikaraj | last post by:
how to create powerpoint presentations using windows c# thanks
1
11839
by: chrizstone | last post by:
Hi Guys, What i want to do is: I want to create a Slide programmatically where a Table is on it! Here´s my Code: String strTemplate; strTemplate = template; String tableSlide = @"C:\Temp\TableSlide_" + guid.ToString();
2
1614
by: MaggiSinha | last post by:
I want to make powerpoint slides with the data from sql server 2008 But without COM objects ..can any1 plz help me
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.