Import RTF text
J. Landman Gay
jacque at hyperactivesw.com
Mon Jun 4 23:18:00 EDT 2007
-= JB =- wrote:
> so to export and re-import text do not choose RTF because it
> might not work properly. Does that mean if you already have
> a text file in RTF importing might not work properly on it.
>
> It sounds like RTF is supported but can't be trusted because
> sometimes it might work and sometimes it might not. So if
> you are dealing with text saved as RTF good luck. Or did I
> miss something.
I've always found it very reliable, but it can only work with the
attributes that Rev fields support. For example, if you don't have the
right font installed, you'll get a substitution instead. Rev fields only
support one alignment overall, there is no paragraph-level formatting.
That means text can be right, left, or center aligned, but the alignment
will be the same for the whole field. Text styling transfers over very
well as long as it's one of the text styles that Rev fields support (see
the text style menu for those; all the common ones are supported.) Tabs
work fine.
If you grab the trial version of Revolution, it's pretty easy to do a
test so you can see how it works. Make a stack with a field and a
button. Double-click the field with the editing tool to get the field's
inspector and turn off fixed line height (otherwise lines with large
font sizes can get mangled.)
Then set the button's script to this:
on mouseUp
answer file "Choose an RTF file:"
if it is empty then exit mouseUp
set the rtfText of fld 1 to url ("file:"&it)
end mouseUp
Apply the script and close the editor. Now click the button, choose a
sample RTF file from disk, and see what you get in the field.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list