Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Graham Brown
  Where is Graham Brown?
 East Midlands
 United Kingdom
 Graham Brown
 To: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 India
 tushar Kanvinde
 Tags
Subject: RE: Report page eject problem
Thread ID: 104655 Message ID: 104709 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Reports and Printers
Date: Saturday, August 19, 2006 3:18:10 PM         
   


Hi

Fox has a
set memowidth to
and a
memlines
which will tell me how many lines the memo will need.

There is also a
prow()
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



> vb6 has a function printer.textheight which gives the height that will be occupied by a text on the printer. so it is not impossible but pretty painful. you will need to create a vb dll for that. pass the memo to it and find out the height required.
> > > Hi all
> > >
> > > Got a mental block on this one.
> > >
> > > I have a report which prints among other things a memo in the details band, the field ("Comments") is set to stretch with overflow. All works fine.
> > >
> > > The client has asked me to change the report so that if the entire memo will not fit on the current page then eject the page and start a new one.
> > >
> > > I can't think how to do this.
> > >
> > > Any clues gratefully received!
> > >
> > > Best wishes
> > > Graham

> >
> >
> > Someone correct me if I'm wrong, but I think this is impossible. Different printers render the same font in different ways, so you'll never be able to predict how much space a string will take up and how the line breaks will come in and therefore you can't know how many lines a memo will take up on a printed piece of paper.
> >
> > Maybe there's a really fancy way to do this with Report Listeners that I don't know of, but outside of that, I don't think you can do what you want.
> >
> > I think all you can do is approximate the average #lines of a memo and reserve space for it (and maybe a little extra). But I guarantee you'll come up against a memo SOMETIME in the future that will be just a little longer than that and will end up overflowing onto another page.
> >
> > Sorry to be discouraging. If someone has an ironclad solution, I'd love to hear it.
> >
> > --Brad


ENTIRE THREAD

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