Powerpoint editing how to copy one shape from one

2019-02-26 21:05发布

I'm a newbie in c# programming and I'm just confounded by the entire ms office library. I want to copy a textbox from one slide 3 and paste it in slide 2. I followed instruction from a page I found: How can I copy shapes from one slide to another slide in c#?

presentation.Slides[3 + 1].Shapes[2 + 1].Copy();
presentaiton.Slides.Paste(2 + 1);

But error message emerges and says: cannot paste because the clipboard is empty or contains things incompatible with the slide. I don't see the clipboard is empty. In fact I can paste it on the word and see what it was - One time it was a blank picture and another a gray shade which are in that slide. So in general I have two problem: how to know which shade I should copy out and why doesn't c# allow copying a shape and paste it in another?

Also I'm wondering if there is a complete or official library or tutorial for operating on powerpoint in c# other than that on ms website which is completely useless.

1条回答
太酷不给撩
2楼-- · 2019-02-26 21:28

In vba it, you'd do it like this:

ActivePresentation.Slides(2).Shapes(3).Copy
ActivePresentation.Slides(3).Shapes.Paste

This'd copy the third shape on slide 2 to slide 3

查看更多
登录 后发表回答