Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Ken Murphy
 To: Brad Schulz
  Where is Brad Schulz?
 San Carlos
 California - United States
 Brad Schulz
Subject: RE: Report page eject problem
Thread ID: 104655 Message ID: 104733 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Reports and Printers
Date: Sunday, August 20, 2006 3:20:38 AM         

> > Hi
> >
> > Fox has a
set memowidth to
and a
which will tell me how many lines the memo will need.
> >
> > There is also a
which tells where the print head if I manually send data to the printer, doesn't work though if I'm running from a report.
> >
> > The only way I can see is to create a dummy group header based on a function. The function will then behave how I used to do this in clipper
> >
> > so something like
> >
> > if type("nPagePos")<>"N"
> > 	public nPagePos
> > 	nPagePos=0
> > endif
> > 
> > if nPagePos+memlines(comments)>66
> > 	nPagePos=0
> > 	return "eject"
> > else
> > 	nPagePos=nPagePos+memlines(comments)
> > 	return ""
> > endif
> > 

> >
> > The nPagePos would need to be defaulted to something sensible, based on the height of the page and group headers. and the font size.
> >
> > Set the group to start on new page.
> >
> > This appears to work but haven't tested fully yet.
> > Will have a bit more of a play and see what it does.
> >
> > Graham

> Remember, MEMOWIDTH() and MEMLINES() are CHARACTER-based, but printing in Windows is PIXEL-based (or DOT-based or graphically based... whatever). Unless you are using a monospace font (like Courier) instead of a variable-length font (like Arial), you can't use MEMOWIDTH(). (And forget about incorporating the TXTWIDTH() function... that has to do with character widths on your SCREEN, not their widths on a printer). Even with a font like Courier, different printers will render it differently... one printer might make the characters 20 dots wide, and another will make them 21 dots wide so the line break would occur sooner on the latter printer. Some printers substitute their OWN version of Courier instead of using the TrueType Courier font from Windows. So, again, you will never know how much width a string will take up on printed output.
> Trying to do a grouping like you described is possible, but tricky, because (if I remember correctly) you have to evaluate the memo of the NEXT record as opposed to the CURRENT record. (In other words, you will have to set some kind of variable that will do a SKIP, evaluate the length, then SKIP -1 to go back). This is because the Group expression is evaluated BEFORE the current record is done (to see if a Group Footer is required or not).
> I wrote an article for FoxPro Advisor many years ago on doing something like this. I'm not at the office right now so I don't know the month/year it was published. But is wasn't all that straightforward... it was a little tricky.
> One more thing... you can't assume 66 lines either. Different printers will have different amounts of printable space on a page. A laser printer can print more lines than a deskjet printer, for example (because most deskjets can't print in the lower 0.5 or 0.6 inches of a page, but a laser can). Even if you have two different laserjet models made by HP, they will not necessarily have the same printable area and, again, the same font may be a little taller (dot-wise) on one printer vs another.
> --Brad

You are absolutely right Brad.

I am an old sailor (spent some time in our navy) and printers can still teach me how to curse! One would think that a standardized font height (in dots) would be achievable but no. I upgraded printer drivers on an old HP Laserjet 4 a few weeks ago, and it changed the printable area! Not only will two HP's have different printable areas - the SAME printer can have it's printable area changed.

You shall know the truth - and the truth shall set you free. (John 8:33)


Report page eject problem Posted by Graham Brown @ 8/18/2006 7:19:37 PM
RE: Report page eject problem Posted by Brad Schulz @ 8/18/2006 7:49:15 PM
RE: Report page eject problem Posted by tushar @ 8/19/2006 7:57:26 AM
RE: Report page eject problem Posted by Graham Brown @ 8/19/2006 3:18:10 PM
RE: Report page eject problem Posted by Brad Schulz @ 8/19/2006 9:37:32 PM
RE: Report page eject problem Posted by Ken Murphy @ 8/20/2006 3:20:38 AM
RE: Report page eject problem Posted by tushar @ 8/20/2006 9:49:30 AM
RE: Report page eject problem Posted by Ken Murphy @ 8/18/2006 8:13:51 PM