当前位置:编程学习 > C#/ASP.NET >>

哪位大哥非常精通c#对PPT的操作

 谁有c#对PPT的具体操作,包括插入文字,插入图片,视频,flash,音频等,
 读取文本,图片什么的。 
 文本我的我已经搞定了 ,图片和视频的谁知道? --------------------编程问答-------------------- --------------------编程问答-------------------- private void button10_Click(object sender, System.EventArgs e)
    {
      string fileName = "d:\\a.ppt";

      PowerPoint.Application pptApp = new PowerPoint.ApplicationClass();
      PowerPoint.Presentation pptPre = pptApp.Presentations.Open(fileName,
        Microsoft.Office.Core.MsoTriState.msoTrue,
        Microsoft.Office.Core.MsoTriState.msoFalse,
        Microsoft.Office.Core.MsoTriState.msoFalse);
      PowerPoint.Slides mySlides = pptPre.Slides;

      string[] strKeyWordList = {"无线"}; //要搜索的文本
      try
      {
        /*
        for (int i=0;i<mySlides.Count;i++)
        {
          PowerPoint.Shapes myShapes = mySlides[i].Shapes;
          for (int j=0;j<myShapes.Count;j++)
          {
            if (myShapes[j].HasTextFrame == Microsoft.Office.Core.MsoTriState.msoTrue)
            {
              if (Microsoft.Office.Core.MsoTriState.msoTrue == myShapes[j].TextFrame.HasText)
              {
                textBox2.Text = textBox2.Text + myShapes[j].TextFrame.TextRange.Text;
              }
            }
          }
        }
        */
        foreach(PowerPoint.Slide sld in pptPre.Slides)
        {
          foreach(PowerPoint.Shape shp in sld.Shapes)
          {
            if(Microsoft.Office.Core.MsoTriState.msoTrue == shp.HasTextFrame)
            {
              if(Microsoft.Office.Core.MsoTriState.msoTrue == shp.TextFrame.HasText)
              {
                textBox2.Text = textBox2.Text + shp.TextFrame.TextRange.Text;
              }
            }
          }
        }
        /*
        PowerPoint.TextRange oText = null;
        foreach(PowerPoint.Slide slide in pptPre.Slides)
        {
          foreach(PowerPoint.Shape shape in slide.Shapes)
          {
            foreach(string strKeyWord in strKeyWordList)
            {
              oText = shape.TextFrame.TextRange.Find(strKeyWord, 0,
              Microsoft.Office.Core.MsoTriState.msoFalse,
              Microsoft.Office.Core.MsoTriState.msoTrue);

              if(oText!=null)
              {
                MessageBox.Show("文档中包含指定的关键字 " + strKeyWord + " !", "搜索结果", MessageBoxButtons.OK);
                continue;
              }
            }
          }
        }
        */
      }
      finally
      {
        pptPre.Close();
        System.Runtime.InteropServices.Marshal.ReleaseComObject (pptPre);
        pptPre = null;
        pptApp.Quit();
        System.Runtime.InteropServices.Marshal.ReleaseComObject (pptApp);
        pptApp = null;
      }
    }
--------------------编程问答-------------------- http://www.codeproject.com/KB/dotnet/EmbeddingPPT.aspx
http://topic.csdn.net/u/20100818/16/B761D944-7028-4C72-954D-82406958C652.html --------------------编程问答-------------------- --------------------编程问答-------------------- 2楼3楼的兄弟 知不知道怎么才能插入flash、视频什么的? --------------------编程问答-------------------- 没人知道吗? --------------------编程问答-------------------- 唉!没人知道呀
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,