I'm stuck on how to read a MS Word document. Using Windows XP, latest ActiveState Perl 5.5.x. I know how to create a MS Word document, and I found some decent examples on the internet as well. May I please have an example of how to read an MS Word document? Here is one example I found on the internet, that did NOT work: use Win32::OLE; use Win32::OLE::Enum; $document = Win32::OLE -> GetObject("srdd.doc"); open (FH,">$ARGV[0]"); print "Extracting Text ...\n"; $paragraphs = $document->Paragraphs(); # This errors out !!! $enumerate = new Win32::OLE::Enum($paragraphs); while(defined($paragraph = $enumerate->Next())) { $style = $paragraph->{Style}->{NameLocal}; print FH "+$style\n";
$text = $paragraph->{Range}->{Text}; $text =~ s/[\n\r]//g; $text =~ s/\x0b/\n/g; print FH "=$text\n"; }
Returns the error message: Can't call method "Paragraphs" on an undefined value at fi.pl line 9. Thanks --cg __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |