Right-Align Cell Values in Tables
J. Landman Gay
jacque at hyperactivesw.com
Thu Apr 20 16:58:35 EDT 2006
Bill Marriott wrote:
> Am I correct that there is no way to right-justify individual values in
> cells (i.e., numbers)?
>
> When I apply the right-align formatting to a table, it actually seems to
> work on a *line* basis, causing the values to jump the boundaries of their
> cells. Same thing with centering.
If you use a fixed-width font, you can pad each entry with spaces to
force it to appear right-aligned. Leave the field alignment set to
"left" and pass each tabbed item through this:
function rightAlign theText,theWidth
put char 1 to theWidth of theText into theText -- trucate long strings
put char 1 to (theWidth-length of theText) of " " \
before theText
return theText
end rightAlign
Use enough spaces between the quotes to cover the column width, for
worst cases. This does assume you already know the maximum character
width of a column.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list