简体   繁体   中英

How to delete data from a powerpoint slide using C# code

您能帮助我编写代码以使用C#从PowerPoint中的特定幻灯片中删除图像吗?

If you have Visual studio 2008 choose PowerPoint add-in template.

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();
    }

but i recommend that you read more on the Microsoft add-in so you can achieve what you want exactly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM