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

  • 相关阅读:
    51Nod 1009 数字1的数量(思维)
    「CTSC 2008」祭祀
    「CSA Round #41」BFS-DFS
    「CEOI2008」order
    「HEOI 2016/TJOI 2016」求和
    「HAOI 2018」染色
    「CF 961G」Partitions
    「WC 2007」剪刀石头布
    「POI 2010」Bridges
    「CQOI 2014」危桥
  • 原文地址:https://www.cnblogs.com/gisoracle/p/5964320.html
Copyright © 2011-2022 走看看