Difference between revisions of "PowerpointAutomation/de"
From Lazarus wiki
Jump to navigationJump to searchLine 9: | Line 9: | ||
<br> | <br> | ||
− | =Speicherplatz reservieren= | + | ==Speicherplatz reservieren== |
<syntaxhighlight> | <syntaxhighlight> | ||
var | var | ||
Line 15: | Line 15: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
− | = | + | ==OleObjekt erstellen== |
<syntaxhighlight> | <syntaxhighlight> | ||
begin | begin | ||
Line 28: | Line 28: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
− | = | + | ==OleObjekt beenden und den Speicher freigeben== |
<syntaxhighlight> | <syntaxhighlight> | ||
begin | begin | ||
Line 38: | Line 38: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
− | =Powerpoint | + | ==Powerpoint Version ermitteln== |
<syntaxhighlight> | <syntaxhighlight> | ||
begin | begin | ||
Line 47: | Line 47: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
− | =Powerpoint | + | ==Sichtbarkeit steuern== |
+ | Wenn Powerpoint während der automatisierten Erstellung einer Präsentation unsichtbar ist, dann flackert der Bildschirm nicht.<br> | ||
<syntaxhighlight> | <syntaxhighlight> | ||
begin | begin | ||
... | ... | ||
− | varPptApp. | + | varPptApp.Visible := False; //macht Powerpoint unsichtbar |
+ | varPptApp.Visible := True; //macht Powerpoint sichtbar | ||
... | ... | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
− | =Powerpoint | + | =Powerpoint Präsentation= |
− | + | ==neue Datei erstellen== | |
− | |||
<syntaxhighlight> | <syntaxhighlight> | ||
begin | begin | ||
... | ... | ||
− | varPptApp.Presentations. | + | varPptApp.Presentations.Add(True); // Fügt eine neue Präsentation ein |
... | ... | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<br> | <br> | ||
− | + | ==vorhandene Datei öffnen== | |
− | = | + | Um in Powerpoint eine vorhandene Präsentation zu öffnen, müssen sie den String in das UTF16-format umwandeln (casten),<br> |
− | + | da die Powerpointschnittstelle nur UTF16 versteht.<br> | |
<syntaxhighlight> | <syntaxhighlight> | ||
begin | begin | ||
... | ... | ||
− | varPptApp. | + | varPptApp.Presentations.Open(UTF8ToUTF16('D:\Arbeit\Test\TestDateien\Test.ppt')) // Benötigt die Unit lclproc |
− | |||
... | ... | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | <br> | ||
=Auszug aus den Powerpointkonstanten= | =Auszug aus den Powerpointkonstanten= | ||
<syntaxhighlight> | <syntaxhighlight> |
Revision as of 08:16, 30 September 2012
│
Deutsch (de) │
Powerpoint als OleObjekt
Für die Oleautomation muss die Unit ComObj eingebunden werden.
Grundsätzlich sollte für das Arbeiten mit Powerpoint die Unit lclproc eingebunden werden.
Die Unit lclproc stellt die nötigen Routinen für das Umwandeln der Stringtypen (Stringcasting) bereit.
Speicherplatz reservieren
var
varPptApp: OleVariant;
OleObjekt erstellen
begin
...
try
varPptApp := CreateOleObject('Powerpoint.Application'); // erstellt das Powerpointobjekt
except
WriteLn('MS Powerpoint kann nicht gestartet werden.'); // Fehlerbehandlung
end;
...
end;
OleObjekt beenden und den Speicher freigeben
begin
...
varPptApp.Quit;
varPptApp := Unassigned;
...
end;
Powerpoint Version ermitteln
begin
...
ShowMessage(varPptApp.Version);
...
end;
Sichtbarkeit steuern
Wenn Powerpoint während der automatisierten Erstellung einer Präsentation unsichtbar ist, dann flackert der Bildschirm nicht.
begin
...
varPptApp.Visible := False; //macht Powerpoint unsichtbar
varPptApp.Visible := True; //macht Powerpoint sichtbar
...
end;
Powerpoint Präsentation
neue Datei erstellen
begin
...
varPptApp.Presentations.Add(True); // Fügt eine neue Präsentation ein
...
end;
vorhandene Datei öffnen
Um in Powerpoint eine vorhandene Präsentation zu öffnen, müssen sie den String in das UTF16-format umwandeln (casten),
da die Powerpointschnittstelle nur UTF16 versteht.
begin
...
varPptApp.Presentations.Open(UTF8ToUTF16('D:\Arbeit\Test\TestDateien\Test.ppt')) // Benötigt die Unit lclproc
...
end;
Auszug aus den Powerpointkonstanten
unit uPPTConst;
interface
const
ppSaveAsPresentation = $00000001;
ppSaveAsPowerPoint7 = $00000002;
ppSaveAsPowerPoint4 = $00000003;
ppSaveAsPowerPoint3 = $00000004;
ppSaveAsTemplate = $00000005;
ppSaveAsRTF = $00000006;
ppSaveAsShow = $00000007;
ppSaveAsAddIn = $00000008;
ppSaveAsWizard = $00000009;
ppSaveAsPowerPoint4FarEast = $0000000A;
ppSaveAsDefault = $0000000B;
//Bibliothek PpSlideLayout
ppLayoutBlank = 12;
ppLayoutChart = 8;
ppLayoutChartAndText = 6;
ppLayoutClipartAndText = 10;
ppLayoutClipArtAndVerticalText = 26;
ppLayoutFourObjects = 24;
ppLayoutLargeObject = 15;
ppLayoutMediaClipAndText = 18;
ppLayoutMixed = -2;
ppLayoutObject = 16;
ppLayoutObjectAndText = 14;
ppLayoutObjectAndTwoObjects = 30;
ppLayoutObjectOverText = 19;
ppLayoutOrgchart = 7;
ppLayoutTable = 4;
ppLayoutText = 2;
ppLayoutTextAndChart = 5;
ppLayoutTextAndClipart = 9;
ppLayoutTextAndMediaClip = 17;
ppLayoutTextAndObject = 13;
ppLayoutTextAndTwoObjects = 21;
ppLayoutTextOverObject = 20;
ppLayoutTitle = 1;
ppLayoutTitleOnly = 11;
ppLayoutTwoColumnText = 3;
ppLayoutTwoObjects = 29;
ppLayoutTwoObjectsAndObject = 31;
ppLayoutTwoObjectsAndText = 22;
ppLayoutTwoObjectsOverText = 23;
ppLayoutVerticalText = 25;
ppLayoutVerticalTitleAndText = 27;
ppLayoutVerticalTitleAndTextOverChart = 28;
// Bibliothek MsoTriState
msoCTrue = 1;
msoFalse = 0;
msoTriStateMixed = -2;
msoTriStateToggle = -3;
msoTrue = -1;
implementation
end.
--Olaf 16:39, 27 September 2012 (UTC)