save formatted text in a file

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Jul 21 06:19:11 EDT 2011


Hi Martin,

What do you want to do with your text? If you want to use it in a text editor, then it is often useful to keep unformatted text. If you want to import formatted text into Word or Pages, you could use the rtfText property.

put the rtfText of field "Some Field" into myData
open file myPath for binary write
write myData to file myPath
close file myPath

Make sure to use binary write. Btw you probably will want to use the .rtf file extension instead of .txt.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

New: Download the Installer Maker Plugin 1.6 for LiveCode here http://qery.us/ce

On 21 jul 2011, at 11:50, martin meili wrote:

> Hi
> How can I avoid loosing the formatting of a text, if I save this text to a file?
> 
> I usually save text in a file as follows:
> 
> open file the_path_Var for write
> write TextVar to file the_path_Var  ---TextVar contains the formatted text of a textfield; in the clipboard it can be seen as formatted text
> close file the_path_Var
> 
> Thanks for any replies!
> 
> Cheers
> Martin





More information about the use-livecode mailing list