in reply to Re^2: how to replace superscript using Win32::OLE
in thread how to replace superscript using Win32::OLE
use Win32::OLE::Const 'Microsoft Word'; use Win32::OLE::Const 'Microsoft Office'; 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}= msoTrue; $rng->find->execute({findtext=>"[0-9]", wrap=>wdFindContinue, replacewith=>"<sup>^&</sup>", matchwildcards=>'True', # matchallwordforms => msoFalse, replace=>wdReplaceAll});
|
|---|