我想把ppt文件对象在olecontainer中显示,怎样做?   
  如果这个对象是图片好像可以但是如果是文本,就无法显示,为什么?
  只想用olecontainer来做,原因word,excel我是用ole来显示的。 

解决方案 »

  1.   

    补充下...
    //--新建ppt空白文档--//不能显示出来不知道为什么?
    procedure TFrm_Main.PPT1Click(Sender: TObject);  
    begin
     Form1:=TForm1.Create(application);
     Form1.Caption:='新建文档'+Inttostr(Frm_Main.MDIChildCount-1);
     MDITab1.AddTab(Form1,3);
     with Form1 do
       begin
          oleContainer1.CreateObject('PowerPoint.Slide',true);
          oleContainer1.DoVerb(0);    
       end;
    end;//--打开表中的文件或文件夹--//打开时也不能显示ppt文件
    procedure TFrm_Guide.FileOpen_ActionExecute(Sender: TObject);
    var
      filename,extname,path,TempPath:string;
      temp:TAdoquery;
      tempitem:TListItem;
      i:integer;
    begin
     if (ListView.Items.Count>0) and (ListView.Selected<>nil) and (ListView.Items[ListView.ItemIndex].SubItems.Count>0) then   //--如果选择了文件--//
       begin
         Form1:=Tform1.Create(application);
         tempitem:=ListView.Items[ListView.ItemIndex];
         path:= tempitem.SubItems[0];
         filename:= tempitem.Caption;
         extname:= tempitem.SubItems[1];
         Form1.Caption:=filename;
         TempPath:=CreateTempFile(PList(tempitem.Data)^.ID,Extname);//生成临时文件路径
         Frm_Main.MDITab1.AddTab(Form1,tempitem.ImageIndex);
         Try
           temp:=TAdoQuery.Create(self);
           temp.Connection:=Frm_Main.ADOConn;
           With Temp do
             begin
               close;
               sql.Clear;
               sql.Add('select * from TB_File where ID= :ID');
               Parameters[0].Value:=PList(tempitem.Data)^.ID;
               open;
               if not temp.Eof then
                 begin
                   TBlobField(FieldByName('FileContent')).SaveToFile(TempPath);
                   Form1.CreateFromFile(TempPath,PList(tempitem.Data)^.ID);
                 end;
             end;
         Finally
           temp.free;
         end;
       end
       else //如果选择了目录 ,则显示其下的所有文件和目录在listview中,同时至tree相应的目录节点为选中状态
        begin
        if ListView.Selected<>nil then   //--选择不为空时--//
          for i:=1 to Tree.Items.Count-1 do
             if PMyNode(Tree.Items.Item[i].Data)^.ID=PList(ListView.Items[ListView.ItemIndex].Data)^.ID then
               begin
                 ListView.Clear;
                 Tree.Items.Item[i].Selected:=true;
                 Tree.SetFocus;
                 DisplayDir(Tree.Items.Item[i]);
                 break;
               end;
         end;
    end;小弟开发一个文档管理系统时遇到左难题
    问题就是无法显示ppt,无论是空白,还是有文件...
    各位高手快帮助呀
      

  2.   

    窗体上放个OLE控件,设置打开文件类型.可以直接打开,
    用代码控制也行.
      

  3.   

    参考一下吧uses comobj 
    var 
     pptA: TPowerPointApplication; 
     pptP: TPowerPointPresentation; 
     ssSet: SlideShowSettings; 
     ssWin: SlideShowWindow; 
    procedure TForm1.FormCreate(Sender: TObject); 
    begin 
     pptA := TPowerPointApplication.Create(self); 
     pptA.Visible := msoTrue; 
     PPtP.ConnectTo(pptA.Presentations.Open(’h:\php.pps’, msoFalse, msoFalse, msoTrue)); 
     ssSet := PPtP.SlideShowSettings; 
     ssSet.LoopUntilStopped := msoFalse; 
     ssSet.ShowType := ppShowTypeSpeaker; 
     ssSet.Run; 
     ssWin := PPtP.SlideShowWindow; 
    end; procedure TForm1.Button2Click(Sender: TObject); 
    begin 
    sswin.View.next;//下一页 
    end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); 
    begin 
    try 
      pptA.Disconnect; 
      pptA.Quit; 
      if assigned(pptA) then pptA.Free; 
     except 
      showmessage(’PowerPoint has already closed!’); 
     end; 
    end;