将图片从剪贴板粘贴到特定幻灯片上

时间:2019-06-07 09:34:40

标签: c# interop powerpoint

我试图将剪贴板中的图片粘贴到演示文稿中的特定幻灯片上,但是每当我运行代码时,它都不会将图片粘贴到同一演示文稿中,而是每次都打开一个不同的演示文稿并将其粘贴到那里。

>

我尝试使用slide.paste()方法。

Microsoft.Office.Interop.PowerPoint.Application objApp = new 
Microsoft.Office.Interop.PowerPoint.Application();
objApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
Presentations objPresSet = objApp.Presentations;
        objPresSet.Open(@"C:\Users\Mohit\Desktop\Archive\Working_Session_S&OP.pptx");
        Presentation objPres = objPresSet.Add(Microsoft.Office.Core.MsoTriState.msoTrue);
        Slide slide =
            objPres.Slides.FindBySlideID(1);

        // Shapes[2] is the image shape on this layout.
        Microsoft.Office.Interop.PowerPoint.Shape shape = slide.Shapes[2];
        slide.Shapes.Paste();

我想将剪贴板中的特定图像粘贴到第一张幻灯片上。

0 个答案:

没有答案