Data Access Worldwide Knowledge Base
Article ID 2084 Article Title HOWTO: Get only the plain text from a RichEdit control Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2084 KBase Category VDF11 Date Created 02/14/2005 Last Edit Date 02/16/2005
Article Text
QUESTION:
Does the Richtext class provide the ability to get just the text (without the formatting tags) ?
ANSWER:
Yes. You can do that by using the TextRange message -- that returns text in given position range.
Example:
Procedure OnClick
string sTmp
Get TextRange of oRichEdit1 0 9999999 to sTmp
Showln sTmp
End_Procedure // OnClick
TextRange returns the first 9,999,999 characters of plain text displayed in the oRichEdit1 control.
You can also use CharCount to get the maximum characters instead of specifying the range. Yes, this will return the characters including the RTF stream, but since this is always higher than the plain text, it will be safe.
Example:
Procedure GetPlainText
string sText
integer iChars
Get CharCount of oRichEdit1 to iChars
Get TextRange of oRichEdit1 0 iChars to sText
End_Procedure // GetPlainText
Contributed By:
Garret Mott
email: garret@automatesoftware.com
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.