ITPub博客

首页 > > > VSTO 对PPT的操作

VSTO 对PPT的操作

作者:chinarocky 时间:2019-10-16 10:43:25 0 删除 编辑

最近才学习VSTO,对PPT的操作。

  private void AddTextBox(PowerPoint.Slide slide, string txtContent)         {             PowerPoint.Shape textbox;             textbox = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, 50, 100, 600, 50);//向当前PPT添加文本框             textbox.TextFrame.TextRange.Text = txtContent;//设置文本框的内容             textbox.TextFrame.TextRange.Font.Size = 48;//设置文本字体大小             textbox.TextFrame.TextRange.Font.Color.RGB = Color.DarkViolet.ToArgb();//设置文本颜色         }

        private void AddPicture(PowerPoint.Slide slide, PowerPoint.Shape shape, string filePath)         {             PowerPoint.Shape pic;             pic = slide.Shapes.AddPicture(filePath, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue, shape.Left, shape.Top, shape.Width, shape.Height);             pic.Name = "图片";             pic.Height = shape.Height;             pic.Width = shape.Width;         }

        private void AddTextMessage(PowerPoint.Slide slide, PowerPoint.Shape shape, string txtContent)         {             PowerPoint.Shape textbox;             textbox = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, shape.Left, shape.Top, shape.Width, shape.Height);//向当前PPT添加文本框             textbox.Height = shape.Height;             textbox.Width = shape.Width;             textbox.TextFrame.TextRange.Text = txtContent;             textbox.TextFrame.TextRange.Font.Color.RGB = Color.Orange.ToArgb();         }

 

这几个方法该怎么调用啊?

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4547/viewspace-3163199/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-10

  • 博文量
    213
  • 访问量
    1691