in reply to cat worddoc1.doc worddoc2.doc worddoc3.doc > bigOlWordDoc.doc
pojuse strict; use Win32::OLE; my $MSWord = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', 'Quit'); my $bigDoc = $MSWord->Documents->Open("big.doc") or die "Could not open big.doc\n"; # $MSWord->{'Visible'} = 1; # uncomment this to see it work # list of documents to include my @documents = qw(test1.doc test1.doc test1.doc test1.doc); # copy each document into the big one for (@documents){ my $sourceDoc = $MSWord->Documents->Open("$_") or die "Could not open $_\n"; $sourceDoc->Select; $MSWord->Selection->Copy; $sourceDoc->Close(); $MSWord->Selection->Paste; print "$_ copied\n" } $bigDoc->Close(); $MSWord->Quit(); print "Program ended\n";
|
|---|