Styled text challenge...

Richard Gaskin ambassador at fourthworld.com
Wed Feb 11 12:50:14 EST 2004


xbury.cs at clearstream.com wrote:

> I want to convert HTML text in fld "HTML" to RTF in fld "TEXT"

There are three ways to refer to the contents of fields:

 the text     -- returns plain text
 the htmlText -- return text with style run info in HTML
 the rtfText  -- return text with style run info in RTF

If a field contains HTML, getting the htmlText of that field will return the
field's content reformatted with ISO-8959-1 character entities (e.g., "<h3>"
would become "<h3>").

So if your field contains HTML and you want to convert it to RF, first don't
alter with with character entities by getting its htmlText -- just get its
text instead:

  set the htmlText of fld "rtf" to fld "html"
  get the rtfText of fld "rtf"
  -- now "it" contains an RTF version of the HTML
  -- originally in fld "html"

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list