如何将形状从一张幻灯片复制到另一张幻灯片? [英] How can i copy shapes from one slide to another?

查看:142
本文介绍了如何将形状从一张幻灯片复制到另一张幻灯片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从presentation1到presentation2插入形状.
我们可以插入像
这样的幻灯片 pptApp.Presentations[Presentation2].Slides.InsertFromFile("presenation1", 10,2,2);

但是我只希望从Presentation1.slide(x)插入到Presentation2.slide(y)的形状.

像这样的东西:

I need to insert shape(s) from presentation1 to presentation2.
We can insert a slide like
pptApp.Presentations[Presentation2].Slides.InsertFromFile("presenation1", 10,2,2);

But I want only the shapes from Presentation1.slide(x) inserted to Presentation2.slide(y).

Something like this :

foreach (Microsoft.Office.Interop.PowerPoint.Shape shp in sld.Shapes)
                        {
                            shp.Copy();
                            Targetslide.Shapes.Paste();     
                            
                        }



如何在C#中做到这一点?

请帮帮我.
谢谢P2000



How can I Do this in C#?

Please help me.
Thanks P2000

推荐答案

我还是不太确定这里的要求.

I am still quite unsure about the requirement here.

pp.Presentation PPT1 = pptApp.Presentations["Presentation1"]; //get the PPT1 object

pp.Presentation PPT2 = pptApp.Presentations["Presentation2"]; // get the PPT2 object
pp.Slide ppt2ActiveSlide = PPT2.Slides[pptApp.ActiveWindow.Selection.SlideRange.SlideIndex]; // returns the active slide of PPT2

// This for loop will loop through all the slides and paste it in the Active Slide of PPT2
foreach(pp.Slide slide in PPT1.Slides)
{
 foreach(pp.Shape shp in slide.Shapes)
  {
   shp.Copy();
   ppt2ActiveSlide.Shapes.Paste();
  }
}



希望对您有所帮助.



Hope it helped.


这篇关于如何将形状从一张幻灯片复制到另一张幻灯片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆