Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi TPowerPointApplication Reference

Posted on 2007-11-30
9
Medium Priority
?
1,184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 26

Accepted Solution

by:
EddieShipman earned 900 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 900 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

610 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