zoukankan      html  css  js  c++  java
  • C# PPT 查找替换

     public void ReplaceAll(string OldText,string NewText)
            {
                int num = PageNum();
                for (int j = 1; j <=num; j++)
                {
                  POWERPOINT.Slide   slide = objPresSet.Slides[j];
                    for (int i = 1; i <=slide.Shapes.Count; i++)
                    {
                        POWERPOINT.Shape shape = slide.Shapes[i];
                        if (shape.TextFrame != null)
                        {
                            POWERPOINT.TextFrame textFrame = shape.TextFrame;
                            try
                            {
                                if (textFrame.TextRange != null)
                                {
                                    textFrame.TextRange.Replace(OldText, NewText);
                                }
                            }
                            catch
                            { }
                        }
                    }
                }
            }

       private void button3_Click(object sender, EventArgs e)
            {
                OperatePPT pOperatePPT = new OperatePPT();
                pOperatePPT.PPTOpen(this.textBox1.Text);
                pOperatePPT.ReplaceAll("闫磊", "闫磊 Email:gisworld@126.com");
            }

  • 相关阅读:
    uva 816
    SQL语言类
    VTK中国文字显示和简单的医疗图像浏览软件
    系统开始了解--感兴趣的文章
    的天数,以一个日期与当前日期的
    POJ 2528 QAQ段树+分离
    IT该忍者神龟Instant client required
    进程和线程之间的通信
    2014——我的求职(两)
    如何绕过chrome的弹窗拦截机制
  • 原文地址:https://www.cnblogs.com/gisoracle/p/5964320.html
Copyright © 2011-2022 走看看