It is hard to see exactly what you are trying to do. By far the easiest way to do this is to convert the doc to a text file. The either slurp it in and split it into paras or set $/ ="\n\n" and read it in one para at a time. This sub will do the conversion for you.
my $wdFormatText = 2; # wdFormatText constant from Win32::OLE::Co +nst 'Microsoft Word' sub convert_doc_to_text { my ( $infile, $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::LastE +rror")unless $word; $word->{visible} = 0; my $doc = $word->{Documents}->Open($infile); error("Can't open $infile, Reason:$Win32::OLE::LastError")unless $ +doc; # wdFormatDocument wdFormatText wdFormatHTML $doc->SaveAs( { FileName => $outfile, FileFormat => $wdFormatText +} ); $doc->Close; undef $doc; undef $word; } sub error { die shift }
cheers
tachyon
In reply to Re: OLE Find with Paragraphs()
by tachyon
in thread OLE Find with Paragraphs()
by wyldtek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |