如何使用C#代码从powerpoint幻灯片中删除数据

时间:2010-01-28 11:11:29

标签: c# powerpoint

您能否帮我编写一个代码,使用C#从powerpoint中删除特定幻灯片中的图像?

1 个答案:

答案 0 :(得分:1)

如果您有Visual Studio 2008,请选择PowerPoint加载项模板。

public partial class ThisAddIn
{//this is the event of the startup of the powerpoint
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {//this is the event that will trigger when you select anything in you presentation 
        this.Application.WindowSelectionChange += new Microsoft.Office.Interop.PowerPoint.EApplication_WindowSelectionChangeEventHandler(Application_WindowSelectionChange);
    }

    void Application_WindowSelectionChange(Microsoft.Office.Interop.PowerPoint.Selection Sel)
    {
        //here you will delete the selected item
        Sel.Delete();
    }

但我建议您阅读有关Microsoft加载项的更多信息,以便您可以实现您想要的内容