perl_seeker has asked for the wisdom of the Perl Monks concerning the following question:
Please help.sub save_doc_as_text { my ( $infile, $outfile ) = @_; print "\n$infile"; print "\n$outfile"; require Win32::OLE; my $word = Win32::OLE->new( 'Word.Application', sub {$_[0]->Quit;});er +ror( "Can't create new instance or Word Reason:$Win32::OLE::LastError +" ) unless $word; $word->{visible} = 0; my $doc = $word->{Documents}->Open($infile); error( "Can't open $infile, Reason:$Win32::OLE::LastError" ) unless $d +oc; # wdFormatDocument wdFormatText wdFormatHTML $doc->SaveAs( { FileName => $outfile, FileFormat => $wdFormatText}); + $doc->Close; undef $doc; undef $word;} $inf="C:\\test\\input3.doc"; $outf="C:\\test\\text-output.txt"; save_doc_as_text($inf,$outf);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE module
by cacharbe (Curate) on Aug 12, 2003 at 12:06 UTC | |
by perl_seeker (Scribe) on Aug 13, 2003 at 06:09 UTC | |
|
Re: Win32::OLE module
by bm (Hermit) on Aug 12, 2003 at 09:03 UTC | |
by perl_seeker (Scribe) on Aug 12, 2003 at 11:38 UTC |