1

I want to make a powerpoint viewer inside of delphi as a feature for one of my projects. All I want is to be able to display the powerpoint inside of the app and cycle through the slides

Example of what I want:
enter image description here

I have tried a variety of methods such as

const
  ppAdvanceOnTime = $00000002;
var
  P: OleVariant;
  S: OleVariant;
  i: Integer;
begin
  P :=  OleContainer1.OleObject.Application.Presentations.Item(1);

  // below block would not be necessary for a slide show (i.e. a *.pps)
  for i := 1 to P.Slides.Count do begin
    P.Slides.Item(i).SlideShowTransition.AdvanceOnTime := True;
    P.Slides.Item(i).SlideShowTransition.AdvanceTime := 1;
  end;
  S := P.SlideShowSettings;
  S.AdvanceMode := ppAdvanceOnTime;

  S.run;
OleContainer1.OleObject.Application.Presentations.Item(1).SlideShowSettings.Run;

The following code did do what I want but displayed the powerpoint app over the program

Olecontainer1.doVerb(ovShow);
Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
MGJC
  • 11
  • 3
  • OK, I corrected the tags accordingly. So what problem do you have with the code you show? – Tom Brunberg Jul 23 '23 at 09:22
  • It either displays the powerpoint in its standard full screen presentation like standard powerpoint or with some new code whick was olecontainer1. Doverb(ovshow). The previously stated code did do what I want but it overlayed the powerpoint app over the program – MGJC Jul 23 '23 at 09:24
  • (Btw, you can delete the two first comments as they are not related to your problem. Move your mouse over your comment and a 'delete' button will appear at the end). I suggest you try the code in https://stackoverflow.com/a/5683894/2292722 as that displays the ppt in a panel, with some code to reduce size to the size of the panel. – Tom Brunberg Jul 23 '23 at 09:38
  • Thanks, I'll try it when I'm back home and report back – MGJC Jul 23 '23 at 09:41
  • It tells me that the CreateOleObject is an undeclared identifier, I tried looking at the documentation but could not figure it out. – MGJC Jul 23 '23 at 10:32
  • You are probably missing `Vcl.OleAuto` in the `uses` clause. – Tom Brunberg Jul 23 '23 at 10:36
  • It seems to be working thank you – MGJC Jul 23 '23 at 10:50
  • 1
    Why? Honestly ... why? I've thought about this many times, and if all you have is some images, you'd be best off simply making a screenshot of each slide, loading them into a TImageList, and then just using the Prev / Next buttons to move through the list and display them on a TImage. That would save you a HUGE amount of memory at run-time and would not require PowerPoint to be installed to view the slides. And the end effect would not look any different to the person viewing them. Using PP in this case is not adding anything to the end result, and only introducing problems. – David Schwartz Jul 23 '23 at 22:43

0 Answers0