There is no need for a module, as you can use the OLE interface to interact directly with Word. Any module that wraps (or replaces) this functionality would have to be updated for each new version of Office that comes out.
This code should get you started on the right track (though this is written for Word 2013, as that is what I have. You should be able to just change the object library version number to get it to work with your version of Word
use 5.16.2; use Win32::OLE; use Win32::OLE::Const 'Microsoft Office 15.0 Object Library'; my $word = Win32::OLE->new( 'Word.Application', 'Quit' ); my $doc = $word->Documents->Open( 'C:\Temp\OLE\Word\test.docx' ) || d +ie 'Unable to open document: ', Win32::OLE->LastError; my $paragraphs = Win32::OLE::Enum->new( $doc->Paragraphs ); while ( defined( my $paragraph = $paragraphs->Next ) ) { my $words = Win32::OLE::Enum->new( $paragraph->{Range}->{Words} ); while ( defined( my $word = $words->Next ) ) { $word->{Text} =~ s/([Hh])i/$1ello/; } } $doc->Save; $doc->Close;
You may also find this helpful: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word%28v=office.14%29.aspx
In reply to Re: To Read and Edit docx files in Windows 7
by SimonPratt
in thread To Read and Edit docx files in Windows 7
by DVCHAL
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |