Solved

Delphi TPowerPointApplication Reference

Posted on 2007-11-30
9
1,143 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Expert Comment

by:ShimaAlavi
ID: 20392231
Dear Plumothy

You can use GetActiveOleObject function instead of CreateOleObject

0
 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Working this component WebCopy with proxy, help 3 86
Dynamically Created Query 3 57
Wincontrol not (correctly) drawn 15 38
DBCtrlGrid, Delphi, Scroll 7 15
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

825 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