TabStops and Tab Spacings
hh
hh at hyperhh.de
Mon Mar 4 20:41:21 EST 2019
To avoid misunderstandings here again the (correctly displayed) code:
-- 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
More information about the use-livecode
mailing list