Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Adding Slide to Powerpoint

by ~~David~~ (Hermit)
on Feb 16, 2007 at 23:07 UTC ( #600541=note: print w/ replies, xml ) Need Help??


in reply to Re: Adding Slide to Powerpoint
in thread Adding Slide to Powerpoint

Thanks for your suggestions, but I am still having problems. I see what you were trying to accomplish, so it has given me a better starting point. I updated the code, but it still fails with the same error. Do you know if I need to switch between active presentations in order to copy, paste, etc...

sub addMyFile{ my $file = shift; my $fullpath = "$edmdir\\$file"; my $addpres = $ppt->Presentations->Open( $fullpath ) or die "Can't + open PowerPoint file '$fullpath': $!\n"; my $j = 1; my $slide; my $newslide; while ($j < 10){ # this is hard coded while i figure out the bug +s, but it will be length of the file $newslide = $pres -> Slides->Add($slideIndex,$addpres->Slides( +$j)->Layout); $newslide = $addpres->Slides($j); $j++; $slideIndex++; } };
~~David~~


Comment on Re^2: Adding Slide to Powerpoint
Download Code
Re^3: Adding Slide to Powerpoint
by traveler (Parson) on Feb 16, 2007 at 23:43 UTC
    You do not need to switch presentations: using the proper var does that. Your old logic (with my changes) was better. Exactly what line gave the error on my version? Oh, and print out $k and $slideindex to be sure they are right and to figure when the error occurs.
      $pres -> Slides->Add($slideIndex,ppLayoutTitleOnly) = $slide; line gives the error "Can't modify non-lvalue subroutine call". If I remove the equals part, and try to add it to the next line, I get the right number of pages, but they are blank...
      ~~David~~
        My Bad. Your $slides are just pointers to ppt slides. Try
        my @slides; my $j = 1; my $slide; while ($addpres->Slides($j)){$slides[$j] = $addpres->Slides($j);$j +++}; my $k = 1; foreach $slide (@slides){ # make a new slide my $s = $pres -> Slides->Add($slideIndex,$slides[$k]->Layout) $slides[$k]->Copy; #get what you want $s->Paste; #save it $slideIndex++; $k++; }
        I always forget the details of the PPT DOM details.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://600541]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-08-20 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (105 votes), past polls