[python-win32] Help with a report generator

Bob Gailer bgailer@alum.rpi.edu
Thu Apr 10 20:29:24 EDT 2003

Content-Type: text/plain; x-avg-checked=avg-ok-78695C68; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit

At 11:31 AM 4/10/2003 -0400, KKGOLFER@aol.com wrote:
>  I need to take tables and graphs out of an Excel Workbook and put them 
> into various slides in a PowerPoint file.

Using win32com.client you can create instances of excel and powerpoint, 
then use VBA commands to extract things from excel and add them to 
powerpoint. Try thsi:

import win32com.client

ex = win32com.client.Dispatch("excel.application")
ex.visible = 1 # so you can see the application
wb = ex.workbooks.open('c:\\foo.xls')
wk = ex.Worksheets(1) # worksheet
chartobject1 = wk.chartobjects(1)

pp = win32com.client.Dispatch("powerpoint.application")
pt = pp.presentations.open('c:\\foo.ppt')
sl = pt.slides(1)

This is only an example. VBA provides a lot more functionality.

Bob Gailer
303 442 2625

Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-78695C68
Content-Disposition: inline

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003


More information about the Python-win32 mailing list