Information générale
Catégorie:
COM/DCOM et OLE Automation
>>>Is there a way to retrieve the collection returned by Word.GetSpellingSuggestions("some-word") method?
>>
>>You need to traverse the collection and grab the data. My Advisor Answers piece in the July issue was about this. The key code you need is:
>>
>>oSuggestions = oWord.GetSpellingSuggestions("whatever")
>>FOR EACH oSuggestion in oSuggestions
>> * oSuggestion.Name contains this suggested spelling.
>>ENDFOR
>>
>>Tamar
>
>That reminds me of a question I wanted to ask a long while ago. Do you know whether Word has the capability of showing (not necessarily through Automation) words in the dictionary that match a specific pattern? Let's assume that for a crossword puzzle, I need a match for "?a???b??c", or for the children's homework, we want to search for words that contain a certain combination of letters, simething like "*abc*".
>
>Hilmar.
Hilmar,
You can set the 5th paameter for GetSpellingSuggestions to wdWildCard, like
oWord.GetSpellingSuggestions("?a*",,,, 1). But I doubt it will be of help for two reasons:
1. Though it worked for my MS Word 97, I got "Speller does not support wildcard.." error in MS Word 2000, and was unable to find any information about what is missing and/or how to fix it.
2. Even you get spelling suggestions, it will not list the entire collection of the 'like' words as you would expect to see.
Another solution could be to use thesaurus. For example, for word "aa" CheckSynonyms brings list of 26 words or sentences in alphabetic order. So I think that it is possible to do a loop from "aa", "ab",... to "zz", invoke thesaurus dialog with CheckSynonyms or SENDKEYS and gather all words from there to temporarely foxpro table. Then you will be able to search the table for word or wildcard as needed. Unfortunately AFAIK thesaurus is not very robotic, and I was unable to find direct suitable methods or properties to automate the procedure (except sendkeys).
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement