vsto 之关于ppt中的一些基础知识。

            Microsoft.Office.Interop.PowerPoint.Presentation MyPres = null;//PPT应用的实例
            Microsoft.Office.Interop.PowerPoint.Slide MySlide = null;//PPT中的幻灯片          
            MyPres = Globals.ThisAddIn.Application.ActivePresentation; // 当前ppt应用实例          
            MySlide = Globals.ThisAddIn.Application.ActiveWindow.View.Slide;  //获取当前选中的幻灯片


            PowerPoint.Shape bg; //声明一个shape
            bg = slide.Shapes.AddShape(Office.MsoAutoShapeType.msoShapeRectangle, 0, 0, MyPres.PageSetup.SlideWidth, 70);  //添加一个shape,形状为矩形(msoShapeRectangle)
            bg.Fill.ForeColor.RGB = ColorTranslator.ToOle(Color.LightGray); //设置它的背景填充色为灰色
            bg.Line.Visible = Office.MsoTriState.msoFalse;       //去掉边框
            bg.TextFrame.TextRange.Text=“hello”  //设置它的插入文本内容
            bg.TextFrame.HorizontalAnchor = Office.MsoHorizontalAnchor.msoAnchorCenter;  //文本格式居中
            bg .TextFrame.TextRange.Font.Size = 20;  //文本字号
            bg .Visible = Office.MsoTriState.msoFalse //设置自选图形为不可见状态

            PowerPoint.Shape pic;         
            string picParh = "http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg";          
            pic = MySlide.Shapes.AddPicture(picParh, Office.MsoTriState.msoTrue, Office.MsoTriState.msoTrue, 50, 50, 100, 100); //下载一个网络图片,插入至当前幻灯片,并设置相关参数

 

转载于:https://www.cnblogs.com/winshuo/p/9773855.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值