Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I need some guidance to proceed further.
I want to find and replace the superscipt with some text using Win32::OLE in word doc.
I tried using the following code, but i cant able to find.
use strict; use Win32::OLE; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; use Constant 'True' => 1; use Constant 'False' => 0; #$Win32::OLE::Warn = 2; # Throw Errors, I'll catch them my $word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', 'Quit'); my $mydoc = $word->activedocument; my $rng = $mydoc->{range}; $rng->find->clearformatting; $rng->find->replacement->clearformatting; $rng->find->font->{Superscript}= "True"; $rng->find->execute({findtext=>"[0-9]", wrap=>wdFindContinue, replace +with=>"<sup>^&</sup>", matchwildcards=>'True', replace=>wdReplaceAll} +);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to replace superscript using Win32::OLE
by traveler (Parson) on Mar 08, 2005 at 18:13 UTC | |
by Anonymous Monk on Mar 09, 2005 at 02:12 UTC | |
by traveler (Parson) on Mar 09, 2005 at 17:43 UTC |