powerpoint 2003 interop copy/paste slide

S

Scott Gravenhorst

PowerPoint 2003 interop
VB 2008 Express Edition

-----

I'm working on a project that requires I copy a slide out of an
existing presentation file and paste it into another.

I've been using the Presentation.Slides(n).Copy() and the
..Slides.Paste() method, but that copies only parts of the data. Text
from a TextRange is copied, but the text attributes such as bold are
missing. Bullet points are also messed up. Shape properties like
Top, Left, Height and Width are often wrong.

I can see that by doing this manually, it works perfectly. The slide
in the new presentation looks exactly like the template. When I do it
as mentioned above, the format looks all funky. Moreso with some
slides than others. A very few, usually simple slides seem to copy
correctly.

I also tride .Slides.InsertFromFil with the same results, only part of
the slide object appears to be copying and/or pasteing

Any clues?
 
S

Scott Gravenhorst

PowerPoint 2003 interop
VB 2008 Express Edition

-----

I'm working on a project that requires I copy a slide out of an
existing presentation file and paste it into another.

I've been using the Presentation.Slides(n).Copy() and the
.Slides.Paste() method, but that copies only parts of the data. Text
from a TextRange is copied, but the text attributes such as bold are
missing. Bullet points are also messed up. Shape properties like
Top, Left, Height and Width are often wrong.

I can see that by doing this manually, it works perfectly. The slide
in the new presentation looks exactly like the template. When I do it
as mentioned above, the format looks all funky. Moreso with some
slides than others. A very few, usually simple slides seem to copy
correctly.

I also tride .Slides.InsertFromFil with the same results, only part of
the slide object appears to be copying and/or pasteing

Any clues?

For anyone reading this, I found a way.

There is also Presentation.Slides.Range(n).Copy where n is an integer
representing the _slide_number_ to copy.

After that, a .Slides.Paste() pastes properly formatted text.

This did not solve the shape dimension properties problem, but I just
iterate through all of the shapes for a given slide and force Top,
Left, Height and Width by grabbing the numbers from the template slide
and stuffing them into the new slide shapes after the paste.

Very strange that .Slides.Range(n).Copy() is used and not
..Slides(n).Range.Copy()

It's working now.
 
S

Steve Rindsberg

Very strange that .Slides.Range(n).Copy() is used and not
..Slides(n).Range.Copy()

It's working now.

Very strange indeed. But all the same, thanks very much for posting back with
your solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top