in reply to Re^2: How to get spelling suggestions in EnglishUK language as default in Win32::OLE
in thread How to get spelling suggestions in EnglishUK language as default in Win32::OLE

First you need to know what to do. That's what the macro recorder tells you. Then you can code it in Perl. If you have problems with that, come back with your new problem.
  • Comment on Re^3: How to get spelling suggestions in EnglishUK language as default in Win32::OLE

Replies are listed 'Best First'.
Re^4:I tried in word macro and then finally i done in perl intself. Thanks for the quick reply. How to get spelling suggestions in EnglishUK language as default in Win32::OLE
by johnpeterdinesh (Initiate) on Feb 25, 2010 at 09:05 UTC
    I tried in word macro and then finally i done in perl intself. Thanks for the quick reply.
    $MSWord = Win32::OLE->new('Word.Application', 'Quit') or die "Coul +d not load MS Word\n"; $wd=Win32::OLE::Const->Load($MSWord); $doc = $MSWord->Documents->Add(); my $range = $doc->{Content}; $range->{LanguageID}=2057; $range->{Text} ="$word"; eval {$range->InsertParagraphAfter();}; if($@) { print "Error occur for word :: $word in English UK Function In +sertParagraphAfter\n"; open er,"$0_Error_Log.txt"; print er "Error occur for word :: $word in English UK Function + InsertParagraphAfter\n"; close er; return; } my $suggestions = $range->GetSpellingSuggestions(); my $result_UK; my @suggestions_UK; my $offset = pos($word) - length($word) + 1; my $term = { term => $word, offset => $offset }; if ($suggestions || $suggestions->{Count}) { my @suggest; my @errors; foreach (in $suggestions) { push @suggest, $_->{Name}; } $term -> {type} = 'guess'; $term -> {guesses} = \@suggest; push @errors, $term; foreach my $word(@errors) { my $guesses = $word->{'guesses'}; @suggestions_UK = @$guesses; } } $doc->{Saved} = 1; $doc->Close(); $MSWord->Quit();
Re^4: How to get spelling suggestions in EnglishUK language as default in Win32::OLE
by Anonymous Monk on Feb 22, 2010 at 10:36 UTC
    Please can you send the macro code. I tried macro with word.but i can check the word is present in EnglishUK dictionary. but i am not able to get the spell suggestion.
      VB Macro code as requested, 'fraid you'll have to convert it to perl yourself.
      Sub UKEnglish() ' ' UKEnglish Macro ' Macro recorded 2/22/2010 by Clive Darke ' ActiveDocument.AttachedTemplate.LanguageID = wdEnglishUK ActiveDocument.AttachedTemplate.NoProofing = False Selection.LanguageID = wdEnglishUK Selection.NoProofing = False Application.CheckLanguage = False End Sub