Solved

Delphi TPowerPointApplication Reference

Posted on 2007-11-30
9
1,125 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

20 Experts available now in Live!

Get 1:1 Help Now