TabStops and Tab Spacings

Roger Guay irog at mac.com
Mon Mar 4 21:44:09 EST 2019


Thank you, Herman. I’m going to have to study this to see if I can use it. I am not converting a "simple table field” but rather a simple field with tabStops (not sure if that makes a difference?). Also, I’m working with rtfText instead of HTMLText. (Again, not sure if that makes a difference or even what the trades are of each)

Thank you very much for taking so much time to help me.

Roger

> On Mar 4, 2019, at 6:45 PM, hh via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Last trial. Typos removed and tested to work.
> Sorry for the previous faulty version, it's too late here.
> 
> -- Converts a simple table field with tabstops to a html <table>
> -- [-hh fecit, Mar 2019]
> on mouseUp
>  put the htmltext of fld 1 into ht
>  put the effective textSize of fld 1 into fs
>  put the tabstops of fld 1 into tStops
>  put the width of fld 1 into fw
>  put empty into tabbs
>  -- we need tabstops relative, not absolute
>  put item 1 of tStops into tabbs[1]
>  repeat with i=2 to the num of items of tStops
>    put item i of tStops - item (i-1) of tStops into tabbs[i]
>  end repeat
>  set itemdel to ("&" & "#9;");
>  set linedel to "<p>"
>  replace "</p>" with empty in ht
>  put "<table width=" &fw& " cellpadding=0 cellspacing=2 "& \
>        "style='font-size:"&fs&"'>"into s0
>  repeat for each line L in ht
>    put empty into s
>    repeat with i=1 to the num of items of L
>      put item i of L into II
>      put "<td style='width:"& tabbs[i] &"'>" &II& "</td>" after s
>    end repeat
>    if s is not empty then put cr&"<tr>"&s&"</tr>" after s0
>  end repeat
>  put "<html><head><meta charset='UTF8'></head>" & cr & \
>        "<body style='padding:0; margin:0; " & \
>        "font-family:verdana,arial,sans-serif;'>" & \
>        s0 & cr & "</table></body</html>" into htm
>  set htmltext of widget "browser" to htm
> end mouseUp
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list