最近才学习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(); }
这几个方法该怎么调用啊?