TabStops and Tab Spacings

hh hh at hyperhh.de
Mon Mar 4 20:14:49 EST 2019


Using the htmltext or the rtfText will not work:
They contain the tabs but NOT the tabspacing.

You could try the following, it works for me.
Make a browser widget with the width of your table field = fld 1.

-- Converts a simple table field with tabstops to a html <table>
-- [-hh fect 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 "	"
  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></html>" into htm
  set htmltext of widget "browser" to htm
end mouseUp





More information about the use-livecode mailing list