General information
Category:
ActiveX controls in VFP
Hi Terry,
The loss of formating seems to occur when the complete text of the RTF control is replaced in a single step.
I don't have your spell checker, so I don't know if its practical to submit one word at a time for checking. The performance may also be too poor for this approach.
If it is feasible to follow this route, then some formatting can be maintained using code similar to that below. The RTF control is named olecontrol1 and bound is to a memo field.
For my test I have misspelled 'format' as 'firmat'
The code fails to maintain formatting if the format is changed mid word, as the initial format gets applied to the whole word.
Sorry about the EXIT in the DO loop but I'm just off out.
Hope this helps.
Alan
******************************************
ThisForm.olecontrol1.selStart = 0 && Start work at position 0
ThisForm.olecontrol1.selLength = 1 && Number of selected characters
DO WHILE .T.
* Check if selected text is a complete word,
* i.e. it is terminated by space or is the last word available
IF RIGHT(ThisForm.olecontrol1.selText,1) = ' ' OR;
ThisForm.olecontrol1.selLength + ;
ThisForm.olecontrol1.selStart =;
LEN(ThisForm.olecontrol1.text)
* A word has been found. Check the spelling.
lcWord2Check = ThisForm.olecontrol1.selText
IF lcWord2Check = 'firmat '
lcWord2Check = 'format '
ENDIF
* Place word back in RTF control
ThisForm.olecontrol1.selText = lcWord2Check
* Check for end of job
IF ThisForm.olecontrol1.selStart = LEN(ThisForm.olecontrol1.text)
EXIT
ENDIF
ELSE
* Increase length of selected text
ThisForm.olecontrol1.selLength = ThisForm.olecontrol1.selLength + 1
ENDIF
ENDDO
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only