This is a bit more useful. Pass the long id of the field object:

function fieldToHTMLTable pFieldID
   if not there is a field pFieldID then return "ERROR: Field object does not 
   put the htmltext of pFieldID into ht
   put the effective textSize of pFieldID into fs
   put the tabstops of pFieldID into tStops
   put the width of pFieldID 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
   return htm
end fieldToHTMLTable

Bob S

> On Apr 8, 2019, at 09:07 , hh via use-livecode 
> <> wrote:
> -- Converts a simple table field with tabstops to a html <table>

use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to