Create PowerPoint presentation from Delphi (OleObject)

0

I'm trying to generate a PowerPoint presentation from a Memo, I found a code on the internet that uses OleObject, but it's not working.

What is incorrect? (Using Delphi 10.2 Tokyo)

uses
System.Win.ComObj

Procedure:

procedure EnviarparaPowerPoint;
var
PowerPointApp: OLEVariant;
begin
try
PowerPointApp := CreateOleObject('PowerPoint.Application');
PowerPointApp.Visible := True;
PowerPointApp.Presentations.Add;
except
Application.MessageBox('Aconteceu um erro na conversão para o PowerPoint !!!',
'Erro', MB_OK + MB_ICONHAND + MB_DEFBUTTON1 + MB_APPLMODAL);
end;

Screen.Cursor := crHourGlass;

begin
//Incluir Slide
PowerPointApp.ActivePresentation.Slides.Add(1, 11); //11 é igual a ppLayoutTitleOnly

// Editar o titulo do slide
PowerPointApp.ActiveWindow.Selection.SlideRange.Shapes('Rectangle 2').Select;
PowerPointApp.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select;
PowerPointApp.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(
Start := 1, Length := 0).Select;

PowerPointApp.ActiveWindow.Selection.TextRange.Text := Memo1.Lines.Text;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Name := 'Arial';
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Size := 30;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Bold := msoFalse;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Italic := msoFalse;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Underline := msoFalse;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Shadow := msoFalse;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Emboss := msoFalse;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.BaselineOffset := 0;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.AutoRotateNumbers := msoFalse;
PowerPointApp.ActiveWindow.Selection.TextRange.Font.Color.SchemeColor := ppTitle;
end;
end;

Errors:

  

Undeclared identifier: 'ppLayoutTitleOnly'

     

Undeclared identifier: 'msoFalse'

     

Undeclared identifier: 'ppTitle'

    
asked by anonymous 13.06.2018 / 16:39

1 answer

1

link

msoFalse is 0.

link

ppLayoutTitleOnly is worth 11.

link

ppTitle is worth 4.

    
13.06.2018 / 18:04