function ReadPPt(sName: string): string; 
var 
  n,m,i,j: integer; 
  PptApp: OleVariant; 
begin 
  try 
    PptApp := CreateOleObject('PowerPoint.Application'); 
    PptApp.Visible := true; 

    PptApp.Presentations.Open(sName); 
    n := PptApp.ActiveWindow.Presentation.Slides.Count; 

    for i:=1 to n do 
    begin 
      m := PptApp.ActiveWindow.Presentation.Slides.item(i).Shapes.Count; 
      for j:=1 to m do 
      begin 
        If PptApp.ActiveWindow.Presentation.Slides.item(i).Shapes.item(j).HasTextFrame Then 
          result:=result+PptApp.ActiveWindow.Presentation.Slides.item(i).Shapes.item(j).TextFrame.TextRange.Text +#$D#$A; 
      end; 
    end; 
  finally
    PptApp.ActiveWindow.Presentation.Saved := true; 
    PptApp.ActiveWindow.Close; 
    PptApp.Quit; 
    PptApp := null; 
  end; 
end;
posted on 2009-03-05 13:35  一个人的天空@  阅读(843)  评论(0编辑  收藏  举报