More questions regarding revPrintText
rcozens at pon.net
Tue May 28 11:44:01 EDT 2002
This should be simple; but I'm not seeing the light (perhaps because
my web page editor hides the html output from me):
I want to print a table (ie: a string of fixed-length records
terminated by return) using revPrintText, optionally increasing the
spacing between table elements.
I've experimented with several approaches, the most recent is:
on printTable theTable,theHeader,fontSize,addedSpaceWidth,addedSpaceLocations
set cursor to watch
go to card 1 of stack "Serendipity Library.rev"
put "<P ALIGN=""e&"CENTER""e&"><FONT FACE=""e&"Courier
New""e&" SIZE=""e&fontSize"e&">" into fieldHeader
put "</FONT></P>" into fieldFooter
if addedSpaceWidth is not empty then put justifyString("
",addedSpaceWidth) into theSpacer
put fieldHeader into field "Print Formatter"
repeat for each line tableLine in theTable
if addedSpaceWidth > 0 then
repeat with x = the number of lines of addedSpaceLocations down to 1
put theSpacer after char (line x of addedSpaceLocations) of tableLine
put tableLine&"<BR>" after field "Print Formatter"
put fieldFooter after field "Print Formatter"
revPrintText (field "Print Formatter"),"<b>"&(the short
put empty into field "Print Formatter"
set cursor to hand
The issues I need to resolve are:
1. How to get the text center aligned (<P
ALIGN=""e&"CENTER""e&"> doesn't work...it just prints in
front of the first line of the table).
2. How to adjust print margins. (I haven't tried the obvious:
setting the printMargins, 'cause I've been focused on the centering
issue.) I will test that here.
There are a couple of other glitches in this version (eg: setting
font & size for the header & footer) but I can deal with them myself.
In addition to the above, I have tried:
* Moving the table to the field, selecting the text and changing
font, size, and alignment by script, and sending revPrintText the
htmlText of the field. Among other things, this loses the return
character on each line [I know the returns are replaced by "<BR>"
above; but they were retained in an earlier version.]
* Prefixing each line with <FONT FACE & SIZE>
CCW, Serendipity Software Company
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
from "The Triple Foole" by John Donne (1572-1631)
More information about the use-livecode