http://qs1969.pair.com?node_id=422677

karthik4perl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
 
   I am writing code for extracting the "Comments" from a "Word" document and displaying it. I am using Win32::OLE.

   Please help me with the portions where I am stuck:
   
   1) How can I extract the "PageNumber" from which the comment is placed in the "Word" document?
   2) How to copy all the comments from one "Word" document to another "Word" document using perl?   

Here's the code:

    use Win32::OLE qw/ in /;

    my $Word;
    my $Doc;
    my $file;
    my $file1 = "c:\some.doc";

    $Word = Win32::OLE->new('Word.Application', 'Quit');
    $Doc = $Word->Documents->Open($file1);
 
    foreach my $c (in $Doc->{Comments}) {
      my $tag = $c->{Initial} . $c->{Index};

      print b($c->{Scope}{Text}),"  ",$tag,"-",$c->{Range}
      {Text},br,br;
    }

Thanks
(karthik4perl)