Selvakumar has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use Cwd; use Win32::OLE::Const 'Microsoft Word'; my $Word = Win32::OLE->new('Word.Application'); $Word->{'Visible'} = 1; $Word->{DisplayAlerts} = 0; my $folderpath=getcwd()."/"; opendir(RDIR,"$folderpath"); for my $xmlfile (readdir(RDIR)) { if ($xmlfile=~/\.doc$/) { $xmlfile=$folderpath.$xmlfile; my $xmlfile1=$xmlfile; $xmlfile1=~s/\.doc$/\.xml/; my $doc = $Word->Documents->Open("$xmlfile"); $Word->ActiveDocument->SaveAs({FileName=>"$xmlfile1"}); $Word->{ActiveDocument}->Close; $doc->Close; } } $Word->Close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Word file save as xml file
by Gangabass (Vicar) on Aug 13, 2009 at 09:52 UTC | |
by Anonymous Monk on Aug 13, 2009 at 10:03 UTC | |
|
Re: Word file save as xml file
by Anonymous Monk on Aug 13, 2009 at 08:12 UTC |