Page 1 of 1

Copying text text (and its format) to another field

Posted: Sun Dec 01, 2013 9:51 pm
by rumplestiltskin
The title pretty much says it all. I have a field "theSource" and a field "theDestination". Field "theSource" contains some text that the user may have formatted in a particular manner (size, font, etc.). I'd like to have a bit of code in a button that copies not only the text but the style to field "theDestination". I imagine the "styledText" property has something to do with this but it appears fairly complicated as it seems to require some sort of array.

What I have been using is

Code: Select all

copy field "theSource" to field "theDestination"
..but this, of course, seems only to copy the unformatted text to field "theDestination"

As always, suggestions gratefully accepted.

Barry

Re: Copying text text (and its format) to another field

Posted: Sun Dec 01, 2013 10:03 pm
by Klaus
Hi Barry,

use htmltext to preserve formatting:
...
set the htmltext of fld "theDestination" to the htmltext of fld "theSource"
## using "the rtftext of ..." should work, too!
...


Best

Klaus

Re: Copying text text (and its format) to another field

Posted: Sun Dec 01, 2013 11:08 pm
by rumplestiltskin
Klaus,

Yep; using the rtfText worked perfectly. As always, many thanks for the lesson!

Barry