How to parse a Word File to retrieve the contents ?
Parsing a Word File ?
Collapse
X
-
Tags: None
-
-
When I run the below program the MS Word Program also opens. How to avoid that ?
Code:use strict; use Win32::OLE; use Win32::OLE::Enum; parseAndScanWord($filename); sub parseAndScanWord { my ($fileName) = @_; my $document = Win32::OLE -> GetObject($fileName) or return; my $paragraphs = $document->Paragraphs(); my $enumerate = new Win32::OLE::Enum($paragraphs); while(defined(my $paragraph = $enumerate->Next())) { $text = $paragraph->{Range}->{Text}; } }Comment
Comment