下面的行,他先将图像发送到powerpoint然后再复制回来,powerpoint不显示
var c:TClipboard;
atype,tmp
levariant;
i:integer;
begin
try
try
PowerPointApplication1.Connect;
except on E: Exception do
begin
E.Message := 'PowerPoint does not appear to be installed';
raise;
end;
end;
// PowerPointApplication1.Visible := msoFalse;
// Form1.SetFocus;
PowerPointPresentation1.ConnectTo(PowerPointApplication1.Presentations.Add(1));
PowerPointSlide1.ConnectTo(PowerPointPresentation1.Slides.Add(PowerPointPresentation1.Slides.Count + 1, 1));
with PowerPointSlide1 do
begin
Layout := 10;
FollowMasterBackground := 0;
Background.Fill.PresetGradient(2, 2, 10);
Shapes.Item(1).TextFrame.TextRange.InsertAfter('test');
c:=TClipboard.Create;
c.Assign(Image1.Picture.Bitmap);
Shapes.Paste;
for i:=1 to Shapes.Count do
begin
if Shapes.item(i).Type_<>msoTextBox then
begin
Shapes.Item(i).Copy;
Image2.Picture.Assign(Clipboard);
//没有任何内容
end;
end;
{Set time displayed for each slide}
SlideShowTransition.AdvanceOnTime := 1;
SlideShowTransition.AdvanceTime := 2;
c.Free;
tmp:=True;
atype:=ppSaveAsPowerPoint7;
caption:=self.PowerPointPresentation1.GetNamePath;
self.PowerPointPresentation1.SaveAs('c:/1.ppt',atype,tmp);
end;
except
on E: Exception do
begin
Showmessage(E.Message);
PowerPointApplication1.Disconnect;
end;
end;
end;