解决方案 »

  1.   

    你的Office是什么版本?如果是2010我或许可以帮你
      

  2.   

    我只有思路!第一:使用微软提供office接口 (PPT的我没搞过)
    第二:将PPT存成xml ,然后读取里面的标签。(PPT的没搞过 搞过Word,下面的路径 就是我搞Word的一总结 希望对你有用)
    http://www.myaspx.com/Example/Word/OupPutWordByWordXmlTemp.htm
      

  3.   

    那些互操作的dll是随Office附带的,所以Office版本的不同会导致接口有些差异你可以把你的工程发到我邮箱里吧,我看看能不能帮你
    [email protected]
      

  4.   


    公司的东西 不能外发啊,也没有外发权限
    我的office版本是2007 之前做的和2003感觉也没啥区别现在就想知道怎么能获取ppt母版中的内容 我能单个获取到1-2个框的内容,但是不知道母版的每一页是怎么获取的,不知道你能不能给贴点代码啊? 谢谢了!
      

  5.   

    那给发个PPT的例子吧,我试试
      

  6.   


    //如下代码是查找PPT母版中带有▲符号的文本框,但我只能找到其中的几页 并不能找到所有
    PowerPoint.Application PptApp = new PowerPoint.Application();
                    PowerPoint.Presentation Present = null;
                    PptApp.DisplayAlerts = PowerPoint.PpAlertLevel.ppAlertsNone;
                    object missing = Type.Missing;
                    FileInfo fileinfo = new FileInfo(FilePath);
                    DateTime savedaccesstime = fileinfo.LastAccessTime;
                   
                    Present = PptApp.Presentations.Open(FilePath, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
                    if (Present.Slides.Count >= 1)
                    {
                        
                        foreach (PowerPoint.Shape pptShape in Present.SlideMaster.Shapes)
                        {
                            if (MsoTriState.msoFalse == pptShape.HasTextFrame) continue;
                            if (MsoTriState.msoFalse == pptShape.TextFrame.HasText) continue;
                            str = pptShape.TextFrame.TextRange.Text;
                            if (str.Contains(@"▲"))
                            {
                                break;
                            }
                            
                           
                        }
                     }
      

  7.   

    试出来了,呵呵
    其实只有母版的第一页是SlideMaster
    下面的几页都是这个SlideMaster的CustomLayout                foreach (PowerPoint.Shape pptShape in Present.SlideMaster.Shapes)
                    {
                        if (MsoTriState.msoFalse == pptShape.HasTextFrame) continue;
                        if (MsoTriState.msoFalse == pptShape.TextFrame.HasText) continue;
                        string str = pptShape.TextFrame.TextRange.Text;
                        if (str.Contains(@"▲"))
                        {
                            pptShape.TextFrame.TextRange.Text = "A";
                            break;
                        }
                    }
                    foreach (PowerPoint.CustomLayout layout in Present.SlideMaster.CustomLayouts)
                    {
                        foreach (PowerPoint.Shape pptShape in layout.Shapes)
                        {
                            if (MsoTriState.msoFalse == pptShape.HasTextFrame) continue;
                            if (MsoTriState.msoFalse == pptShape.TextFrame.HasText) continue;
                            string str = pptShape.TextFrame.TextRange.Text;
                            if (str.Contains(@"▲"))
                            {
                                pptShape.TextFrame.TextRange.Text = "A";
                                break;
                            }
                        }
                    }
      

  8.   

    感谢icedmilk,但我的问题目前还没有解决.我发现我需要的字符串在背景图上面,打开PPT进行搜索替换是可以的,如何才能得到这个字符串呢?
      

  9.   

    感谢icedmilk,但我的问题还没有解决。我突然发现我要找的字符串是在背景图上的,打开PPT进行查找替换是可以找到并替换这些字符串的,背景图上的字符串应该如何获取呢?
      

  10.   

    是啊,是文本框在背景图片上 如果取消背景图片的话,这个文本框也会跟着消失,但是PPT 的查找替换可以对其进行修改,怎样得到这个文本框及其内容呢?
      

  11.   

    能给我发个这样的PPT过来吗?
      

  12.   

    替换一下这两个东西试试Present.SlideMaster.Background.TextFrame.TextRange.Text
    Present.SlideMaster.CustomLayouts[0].Background.TextFrame.TextRange.Text
      

  13.   


    PPT发布出去啊 我先试试哈~
      

  14.   

    PPT那个我试了一下 还不行啊 我用Present.SlideMaster.Background.TextFrame.TextRange.Text
    Present.SlideMaster.CustomLayouts[0].Background.TextFrame.TextRange.Text 这两个都替换了,得不到我需要的文本。
    能不能给点思路啊,另外Present.SlideMaster.Background得到的是母版中一页的背景图吧?其他的如何获得呢?