473,785 Members | 2,811 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 4465
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
42148
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. I like to fire them from a window form on the click event of a butto on the form. The sequence of...
0
876
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
11766
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
6323
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 really want code as such, more like a tutorial on how to do something like this.
3
8117
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 be interpreted poorly when they are brought into Flash. Also, make sure there are no objects that...
0
1058
by: rishikaraj | last post by:
how to create powerpoint presentations using windows c# thanks
1
11905
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
1620
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
9645
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4050
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
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.