in reply to Re^3: 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
$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();
|
|---|