Saving a tab formatted field to a file and retaining its formatting

Paul Dupuis paul at researchware.com
Mon Apr 8 10:55:31 EDT 2019


On 4/7/2019 9:00 PM, Paul Dupuis via use-livecode wrote:
> I take it your have tried:
>
> put the rtfText of field "X" into URL 
> ("file:"&specialFolderPath("desktop")&slash&"savedfield.rtf")
>
> And then reading it back to a new field with:
>
> set the rtfText of field "Y" to URL 
> ("file:"&specialFolderPath("desktop")&slash&"savedfield.rtf")
>
> and the tab spacing is not preserved?
>

If the rtfText does nto preserve the tabstops, the htmlText should 
preserve the tabstops. See the dictionary entry for the htmlText 
property of a field.

If neither the rtfText property of a field, nor the htmlText property of 
a field preserve the tabstops (again, not sure about rtfText, but the 
Dictionary implies htmlText does), you can use

put the arralEncode(the styledText of field "X") into URL 
("binfile:"&specialFolderPath("desktop")&slash&"savedfield.bin")

And then reading it back to a new field with:

put URL 
("binfile:"&specialFolderPath("desktop")&slash&"savedfield.bin")into 
tFieldData
set the styledText of field "Y" to arrayDecode(tFieldData)

But this later approach does not produce an RTF or HTML file that can be 
opened in other software tools like Microsoft Word




More information about the Use-livecode mailing list