PowerPoint嵌入YouTube视频

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;

namespace EmbedYouTubeVideo
{
    public partial class Ribbon1
    {
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {

        }

        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            PowerPoint.Application PPaPP = Globals.ThisAddIn.Application;
            PowerPoint.Presentation Presentation = PPaPP.ActivePresentation;
            PowerPoint.CustomLayout layout = Presentation.SlideMaster.CustomLayouts[7];
            PowerPoint.Slide Slide = Presentation.Slides.AddSlide(1, layout);
            PowerPoint.Shape Shape = Slide.Shapes.AddOLEObject(Left: 0, Top: 0, Width: 560, 
            Height: 315, ClassName: "ShockwaveFlash.ShockwaveFlash.11");
            var browser = Shape.OLEFormat.Object;
            browser.Movie = "http://www.youtube.com/v/wIH2LTxU3N8?version=3&hl=zh_CN&rel=0";
        }
    }
}
相关资源:http://blog.csdn.net/tx_officedev/article/details/7449951

posted @ 2012-04-11 15:49  许阳 无锡  阅读(406)  评论(0编辑  收藏  举报