Example on how to work with power point components in Delphi

Can anyone give an example which shows how to work with powerpoitn components in Delphi on servers tab? A simple loading and showing a ppt file will do. Thanks
PutriAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

urban_smurfCommented:
Try This:

uses
  comobj;
  
procedure TForm1.Button2Click(Sender: TObject);
var
  PowerPointApp: OLEVariant;
begin
  try
    PowerPointApp := CreateOleObject('PowerPoint.Application');
  except
    ShowMessage('Error...');
    Exit;
  end;
  // Make Powerpoint visible
  PowerPointApp.Visible := True;

  // Show powerpoint version
  ShowMessage(Format('Powerpoint version: %s',[PowerPointApp.Version]));

  // Open a presentation
  PowerPointApp.Presentations.Open('c:\MyPresentation.ppt', False, False, True);

  // Show number of slides
  ShowMessage(Format('%s slides.',[PowerPointApp.ActivePresentation.Slides.Count]));

  // Run the presentation
  PowerPointApp.ActivePresentation.SlideShowSettings.Run;

  // Go to next slide
  PowerPointApp.ActivePresentation.SlideShowWindow.View.Next;

  // Go to slide 2
  PowerPointApp.ActivePresentation.SlideShowWindow.View.GoToSlide(2);

  // Go to previous slide
  PowerPointApp.ActivePresentation.SlideShowWindow.View.Previous;

  // Go to last slide
  PowerPointApp.ActivePresentation.SlideShowWindow.View.Last;

  // Show current slide name
  ShowMessage(Format('Current slidename: %s',[PowerPointApp.ActivePresentation.SlideShowWindow.View.Slide.Name]));
  
  // Close Powerpoint
  PowerPointApp.Quit;
  PowerPointApp := UnAssigned;
end;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.