[HOW TO] Copy Text Only From Rich Text Field to Text Field

Hi Guys!

Recently I have trouble copying the text from the RichTextField to normal TextField. The error that I obtain saying that I can only pasted text inside the TextField. And I only encounter this error if the RichTextField contain attachment. Here is my code:

Function chkRTFieldEmpty(source As NotesUIDocument)

Call source.GotoField( “RTField” )

Call source.SelectAll

Call source.Copy

Call source.GotoField( “textField” )

Call source.Paste

End Function

My question is, how can I copy only TEXT from the Rich Text Field and ignore any attachment inside it?

Thanks in advance guys :slight_smile:

Firdhaus

Subject: GetUnformattedText

Look up the method GetUnformattedText in the NotesRichTextItem class.

You could perhaps also use the Text property of the NotesItem class.

You can find more examples here: redirecting...

Hint: use the help file…

Subject: Get text before save

Hi Karl,

I have read that method thru the Help file. The problem is, I want to get the text from Rich Text Field before the document is saved. How can I do this?

Subject: FieldGetText

First of all, you need to specify all the factors that are relevant to your problem/question in your initial post. You shold have mentioned that requirement.

But in that case, use FieldGetText/FieldSetText like Cristopher suggests.

I highly suggest that you learn both backend and UI classes in Lotusscript.

Subject: Just use fieldgettext, fieldsettext