Styled text challenge...

JonathanC at ag.nsw.gov.au JonathanC at ag.nsw.gov.au
Thu Feb 12 17:53:18 EST 2004


xbury.<cs at clearstream.com> wrote on Wed, 11 Feb 2004 16:39:48 +0100:

> Other than parsing completely out the html code, you would assume that
> 
> set the RTFText of fld "text" to the HTMLText of fld "html"
> 
> converts html to styled text... BUT IT DOESN'T! 
> 
> There doesn't seem to be any other language features for this purpose.

And then a little later (18:17:44 +0100):
 
> I'm not sure if i was clear,
> I want to convert HTML text in fld "HTML" to RTF in fld "TEXT"
> 
> But I'm practically giving up, this is too much hassle, ...

I have an EXTREMELY simple one-card HTML <-> Styled text convertor stack 
that works like this:
2 fields: "Styled Text" & "HTML"
2 buttons: "Styled text -> HTML" & "HTML -> Styled text"

Script of button "Styled text -> HTML":
on mouseUp
  put the htmlText of fld "Styled Text" into fld "HTML"
end mouseUp

Script of button "HTML -> Styled text":
on mouseUp
  set the htmlText of fld "Styled Text" to fld "HTML"
end mouseUp

Isn't this second button doing what you want? 
I assume you don't want the RTF CODE (e.g. 
  {\rtf1\mac\ansicpg10000\cocoartf102
  {\fonttbl\f0\fnil\fcharset77 Verdana-Bold;\f1\fswiss\fcharset77 
ArialMT;\f2\fnil\fcharset77 Verdana;
  }
  ...etc. etc. }
just the HTML code to DISPLAY as it's meant to (except for stuff like 
tables).

Regards,

Jonathan Cooper
Manager of Information / Website
Art Gallery of New South Wales
Sydney, Australia
http://www.artgallery.nsw.gov.au

This e-mail message is intended only for the addressee(s) and contains 
information which may be confidential.  If you are not the intended 
recipient please advise the sender by return email, do not use or disclose 
the contents, and delete the message and any attachments from your system. 
 Unless specifically indicated, this email does not constitute formal 
advice or commitment by the sender or the Art Gallery of NSW  (ABN 24 934 
492 575) or its related entities.


More information about the use-livecode mailing list