• 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");
            }

  • 相关阅读:
    PAT 个位数统计
    Least Common Multiple
    PAT 输出华氏-摄氏温度转换表
    害死人不偿命的(3n+1)猜想
    牛客小白月赛1 A-简单题
    结构体 查找书籍
    TZOJ 复习时间
    JS 瀑布流效果
    JS浏览器对象
    JS 数组相关
  • 原文地址:https://www.cnblogs.com/gisoracle/p/5964320.html
Copyright © 2020-2023  润新知