Solved

Delphi TPowerPointApplication Reference

Posted on 2007-11-30
9
1,133 Views
Last Modified: 2012-08-13
Does anyone know where I can find decent documentation (or a tutorial) for Delphi's TPowerPointApplication component?

Despite a lot of searching I have found nothing that explains how to use it.

I want to write an application that can extract slides out of one presentation and put them into another one (without using the clipboard).
0
Comment
Question by:plumothy
9 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 225 total points
ID: 20384101
This is the definitive Delphi Powerpoint automation "reference"
http://www.djpate.freeserve.co.uk/AutoPpt.htm

However, take note that the Powerpoint VB help file will ease your transition.
0
 

Assisted Solution

by:ShimaAlavi
ShimaAlavi earned 225 total points
ID: 20390939
Hi dear plumothy:
You can do this easily,VBA allows you to extact sub range of slides out of one presentation and put  them into another one , therefore you should use InsertFromFile method as below :
InsertFromFile( FileName, Index, SlideStart, SlideEnd ).
Parameters  Description :
FileName : The name of the file that contains the slides you want to insert.
Index : The index number of the Slide object in the specified Slides collection you want to insert the new slides after.
SlideStart :The index number of the first Slide object in the Slides collection in the file denoted by FileName.
SlideEnd : The index number of the last Slide object in the Slides collection in the file denoted by FileName.

This method return an integer value that repersents  the number of slides inserted.
procedure ExtractSlidesFrom(FileName: String; Index, SlideStart, SlideEnd : Integer);

var

  PP : OleVariant;

begin

  PP := CreateOleObject('PowerPoint.Application');

  PP := PP.ActivePresentation.Slides.InsertFromFile(FileName,Index,SlideStart,SlideEnd);

end;

Open in new window

0
 

Author Comment

by:plumothy
ID: 20391402
Thanks - that looks really useful (and is ridiculously easy)!

It's my own fault, but I should have made it clear that I need to extract the slides from a loaded presentation rather than from a ppt file on disk (but without using the clipboard).
0
 

Expert Comment

by:ShimaAlavi
ID: 20392231
Dear Plumothy

You can use GetActiveOleObject function instead of CreateOleObject

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:plumothy
ID: 20394082
Thanks ShimaAlavi,

But won't that still get slides from a ppt file on disk?
0
 

Expert Comment

by:ShimaAlavi
ID: 20394277
Dear Plumothy

I believe  that there is no solution for your question. I suggest you save your file at first and after that do the work what I mentioned before. You can get the file path of the  presentation using ActivePresentation.Path which you intend to insert into active presentation and put the file path into ExtarctSldiesFrom method.
0
 
LVL 3

Assisted Solution

by:Mamouri
Mamouri earned 50 total points
ID: 20397368
Only PowerPoint method's for inserting slide from another presentation is InsertFromFile. This method didn't support inserting slides from an opened presentation.

I didn't think there is a direct way for inserting slides from an opened presentation. I recommend an indirect way for this issue. Create a new slide and insert an OLE Object using Slides.Shapes.AddObject and give the reference of the opened presentation which you want insert slide from.

I didn't check this issue and I'm not sure it's working. But I think it's worth to think over it. Maybe Shima could help more about this.

Also maybe you should consider Shima's Solution, more seriously. If I understand him/her correctly, she recommend to save the source presentation and use InsertFromFile method to insert an slide from loaded presentation.
0
 

Author Comment

by:plumothy
ID: 20401304
Thanks to all who have responded. I now have it partially solved - not perfect but good enough.

I would like to split the points as follows:
 - EddieShipman = 225 points (for directing to some decent documentation - which is what I actually asked for in my original question)
 - ShimaAlavi = 225 points (for suggestions that very nearly solved my problem)
 - Mamouri = 50 points (for expanding on a previous answer encouraging me to keep trying).

For the sake of completeness, here is where I have got to so far:
I am now connecting to the source presentation while it is running and using its FullName property to find where it is on disk. Then I create a new presentation and call InsertFromFile to get all the slides from the source presentation. Then I call Save for the new presentation.
It's not perfect because that does not bring over the master slide, but I will continue working on it and I am sure I will get there in the end!

Thanks again.
0
 

Author Closing Comment

by:plumothy
ID: 31411935
Great help - thanks to all the contributors
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now