in reply to Win32::OLE for MS-Word
The file ole-word-demo-3.doc is located in the foldersub 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;}); error( "Can't create new instance or Word Reason:$Win32::OLE::LastErro +r" ) 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="ole-word-demo-3.doc"; $outf="ole-word-demo-3.txt"; save_doc_as_text($inf,$outf);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Win32::OLE for MS-Word
by WhiteBird (Hermit) on Jun 12, 2003 at 16:08 UTC | |
by perl_seeker (Scribe) on Jun 13, 2003 at 09:41 UTC | |
by WhiteBird (Hermit) on Jun 13, 2003 at 15:20 UTC |