1. Milton Jiménez
  2. PowerBuilder
  3. Tuesday, 30 May 2023 01:28 AM UTC

hi, Friends,
I need to store the information line by line in a variable of a
RichTextEdit control
thanks for any advice
Regards




Accepted Answer
Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 1 June 2023 00:13 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Milton,

I was thinking more along the lines of what John's understanding was and that you were interested in obtaining just the text of each line without any formatting.  If you did want the formatting then what Ronnie provided would work.

In the event you were not interested in the formatting characters but only the pure text, the following modification to Ronnie's code will pull out just the text:

FOR li_line = 1 TO rte_1.LineCount()
	/* Move cursor to li_line */
	rte_1.SelectText(li_line, 1, 0, 0, Detail!)
	rte_1.SelectTextLine()
	rte_1.Copy()
	ls_rtf = ClipBoard()
        ...
NEXT

HTH...regards,

Mark

Comment
  1. Milton Jiménez
  2. Thursday, 1 June 2023 19:41 PM UTC
Thanks.
  1. Helpful
  1. Mark Goldsmith
  2. Thursday, 1 June 2023 21:03 PM UTC
You're most welcome!
  1. Helpful
There are no comments made yet.
Ronnie Po Accepted Answer Pending Moderation
  1. Wednesday, 31 May 2023 18:28 PM UTC
  2. PowerBuilder
  3. # 1

Something like this should work:

integer li_line
string ls_rtf

FOR li_line = 1 TO rte_1.LineCount()
	/* Move cursor to li_line */
	rte_1.SelectText(li_line, 1, 0, 0)
	ret_1.SelectTextLine()
	ls_rtf = CopyRTF(TRUE)
	...
NEXT

If your rte control has header and detail bands, you'll need to take that into account.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 31 May 2023 00:53 AM UTC
  2. PowerBuilder
  3. # 2

Hi, Milton -

I've almost NO experience using Rich Text, but I suspect your premise that there exists a way to obtain the information contained in a Rich Text control "line by line" is incorrect. I'd be VERY surprised to learn that the control contains a method to return to your code any requested line within the control, because the text is in essence, a stream of data that is dynamically rendered, like a document in Word or an HTML file within a browser.

However, if there IS a way, I'm sure others in the Community will correct me.

Best regards, John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.