in reply to Re^3: how to convert this VB code to perl
in thread how to convert this VB code to perl
I want to add $count number of images in doc file so that i need to put page break after each pic insert.#! c:\perl\bin\perl use strict; use warnings; use Win32::OLE; my $file = $ARGV[0]; my $image = $ARGV[1]; my $count = $ARGV[2]; my $class = "Word.Application"; my $word_ref = Win32::OLE->new($class) || die ("Failed to launch Word +due to", Win32::OLE::LastError()); $word_ref->{'Visible'} = 1; # Add the doc my $doc = $word_ref->Documents->Add; my ($obj_sel, $obj_shape); for (my $i=0; $i < $count; $i++) { $obj_sel = $word_ref->Selection; $obj_shape = $doc->Shapes; # add image $obj_shape->AddPicture($image); # add page break add_pagebreak($obj_sel); } # Save the file $word_ref->ActiveDocument->SaveAs($file); # destory objs undef $obj_sel; undef $obj_shape; $word_ref->Quit(); # destory contructor for word app undef $word_ref;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: how to convert this VB code to perl
by gone2015 (Deacon) on Jan 27, 2009 at 22:24 UTC | |
by proton-69 (Novice) on Jan 28, 2009 at 05:06 UTC | |
|
Re^5: how to convert this VB code to perl
by marto (Cardinal) on Jan 27, 2009 at 19:10 UTC |