现在的位置: 首页 > 综合 > 正文

读取Powerpoint备注页的文字

2014年01月30日 ⁄ 综合 ⁄ 共 1610字 ⁄ 字号 评论关闭

quote] using System; using System.Collections.Generic; using System.Text; //add by my shelf using PowerPoint=Microsoft.Office.Interop.PowerPoint; using Microsoft.Office.Core; using System.Windows.Forms; namespace Test {         class Program         {                  static void Main(string[] args)                 {                           string filename=@"d:/a.ppt";                         PowerPoint.Application ap = new PowerPoint.Application();  ap.Visible = MsoTriState.msoTrue;                           PowerPoint.Presentation ps = ap.Presentations.Open(filename, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoTrue);  PowerPoint.DocumentWindow dw = (PowerPoint.DocumentWindow)ap.Windows._Index(1);                                   dw.ViewType = PowerPoint.PpViewType.ppViewNotesPage;                          int n = 0;                          foreach (PowerPoint.Slide slide in ps.Slides)                         {                                 foreach (PowerPoint.Shape shape in slide.NotesPage.Shapes)                                {                          if (shape.TextFrame.HasText.Equals(MsoTriState.msoTrue))                     {                                                   MessageBox.Show(shape.TextFrame.TextRange.Text);                                          }                      //MessageBox.Show("has text");                                                    }                 }                        // MessageBox.Show(ps.Slides._Index(1).Count.ToString());                              }         } }<!-- CETagParser ~/quote </td></tr></table></td></tr></table><br>

用NotesPage就可以了,具体信息可以参考VBA帮助。

 

 

更多技术文章请参看施昌权的个人网站: http://www.joyvc.cn

 

 

抱歉!评论已关闭.