Printing reports in Rev
Barry Levine
themacguy at macosx.com
Sun Aug 29 21:15:46 EDT 2004
Richard,
I do not disagree with anything you've written (as the documentation to do
such a task does not exist AFAIK. However, this leads me to ask for what
purpose the Report Builder was created? And that leads me to an observation:
Looks like Report Builder is MIA from the 2.5RC1 Tools menu (although it is
in the Tools folders). But I digress...
Neither the documentation (in 2.2 or 2.5) nor the "Learning Center" in
2.5RC1 has information about how to accomplish this. I've looked for sample
stacks at the Rev website but no luck.
As you seem to have a good handle on this, might I respectfully suggest a
small tutorial and example stack? I'll suggest a 40-card stack which should
be enough data to present on two printed pages using the invisible stack
method you mention.
BTW, it is possible that "revPrintText" is an alternate solution to my
"print@" wish. One of the code examples in the Learning Center (#41,
Printing the fields on a card) hints at this though some experimentation is
needed...(some minutes pass)...
Here's an example of the revPrintText command that seems to do much of what
my "print@" requests:
on mouseUp
put "<p>" into theStart
put "</p)" into theEnd
repeat with i = 1 to 60
-- ("60" would be the number of cards - a var)
put "LINE " & i & " IS BEING PRINTED" into field theField
put theStart & (the htmlText of field theField) & theEnd \
after theCollection
end repeat
revShowPrintDialog true,true
revPrintText theCollection
end mouseUp
Apparently, htmlText requires a field and can't deal with a var; "the
htmlText of theMiddle" (a variable) errors. So the "invisible printing
stack" might still be necessary if -only- to hold the current string we've
harvested from the stack data while we make it htmlText.
By the way, my test with 60 lines of data resulted in an automatic page
feed; I don't even have to keep track of this if I don't need page numbers,
headers, or footers.
However, reviewing your comments (and the docs) about the pageHeights
property bring additional enlightenment.
As usual, posting to the list and going through this Socratic discussion
yields wonderful results. Many thanks to all, especially you, Richard.
So should I kill my "print@" enhancement request? It it reinventing the
wheel?
Regards,
Barry
On 8/29/04 1:22 AM, Richard Gaskin allegedly flung into the void:
> Like most things in Rev, printing is handled in a unique manner that's
> not hard to use well once you get the hang of it.
>
> Basically you create an invisible stack to use as a "printing port", lay
> out objects, and issue a "print card" command.
>
> Using "open printing" before print commands and "close printing"
> afterward lets you issue multiple print commands in a single print job.
>
> Using "open printing with dialog" presents the OS print job dialog, and
> "answer printer" brings up the OS Page Setup dialog.
>
> Filter the Transcript Dictionary with "print" to get a list of printing
> properties which may be useful, including printScale, printPaperSize,
> printGutters, printMargins, and more.
>
> Key to printing a multi-page block of text is the pageHeights property.
> You put text into a field of the width you'll be printing, get the
> pageHeights of that field, and what you have is a list of integers which
> are the amount you'd need to scroll the field to advance one page's worth.
>
> While this sort of scroll,print,repeat may seem compicated, it's not bad
> once you actually do it, and not much more complicated than what you'd
> have to do do manage multi-page columns with headers, footers, etc. with
> a PRINT @ command.
>
> But using the existing object model to lay out printing gives you the
> full range of Rev objects to use, including vector and raster graphics
> in addition to fields, and even buttons if you need 'em.
>
> And best of all you can do it today, without needing to wait to anyone
> to add anything to the engine.
--------------------------------------------------------
Barry Jay Levine
"The Mac Guy"
Macintosh & Windows Troubleshooting, System Engineering, Training,
Server Setup, System Upgrades and Enhancements,
Multi-platform Application Development
Backup Strategies and Implementations
On-Site service for K20, Business, Consumer
Phone/VoiceMail: 915-581-1105
Fax: 915-581-8167
eMail: themacguy at themacguy.info
--------------------------------------------------------
More information about the use-livecode
mailing list