Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print Report

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi,

How to print same report two times on a same page? Paper size is A4

Thanks

Saif
 
When you create the report, set the paper size to have half A4 height.
To print it, run the report twice, first with NoPageEject then without.
 
This question has been asked several times before. The short answer is that there is no easy way printing one report twice on the same physical sheet of paper. But there is nothing stopping you from printing exactly same data twice within each page of the report.

All you have to do is to increase the height of the various bands so they occupy the full height of a sheet of A4 (297 mm). Then move the various labels and expressions up to the upper half of the page. Finally, select all the fields and expressions, copy them to the clipboard, and paste them in the lower half of the page.

That will give you two reports on the same page, but with data from consecutive records. If you want the same data to appear in both the upper and lower parts of the page, you will have to double-up the records in your cursor. For example, if your original cursor (or table) looks like this:

Code:
[i]ID    CustName     CustAddr[/i]
1     Ricky       1 1st St
2     Lucy        2 2nd Ave
3     Fred        3 F Street
4     Ethel       99 High Street

You would generate a new cursor that looks like this:

Code:
[i]ID    CustName     CustAddr[/i]
1     Ricky       1 1st St
2     Ricky       1 1st St
3     Lucy        2 2nd Ave
4     Lucy        2 2nd Ave
5     Fred        3 F Street
6     Fred        3 F Street
7     Ethel       99 High Street
8     Ethel       99 High Street

This will give you four sheets of A4, with Ricky appearing twice on the first, Lucy twice on the second, and so on.

Does that answer your question.

Mike






__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
tun the report twice, first with NoPageEject then without.

Tore, I might be wrong, but I think that might work with a tractor-fed printer, but not with a page-fed model such as a laser printer. Regardless of the presence of NOPAGEEJECT, the printer driver would see the end of the first report as the end of the page, and eject the page anyway.

But it is worth a try.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Tractor fed printer. Heavent heard of such printers for a while. I still have a NEC P6, though not operative.

On the topic: How you need to double your data when choosing that route of a solution depends pretty much on the report design. If your first page already consists of a few records and the standard output is just one page, the repeat of records should rather be done by appending all rows to double them, not double each row. That might also need some empty rows to fill up detail space so there is a forced page break for the repeating data.

The simple solution could be to print with 2 copies and set the page size to A5. Dpeneds a bit on printer settings, too, how printed A5 is handled, you may get a small print centered on A4 rather than two A5 side by side. I would experiment a litte, but more with the printer settings than with the VFP report.

Bye, Olaf.
 
Saif said:
two times on a same page

I have some institutional clients who need to generate single 2-part reports where the top and bottom of the report are duplicates of each other.

To do that I set up a VFP Report Form with no Header, Footer, or Summary Band, but it had a BIG Detail Band (full height of paper stock).

Then within the Detail Band I laid out the various Objects to represent the top half of the report.
Then I merely copied ALL of those objects and pasted them into the bottom half of the Detail Band, separating the 2 halves of the report with a dotted line (for tear-off).

Then when the data is presented to the Report Form, it is printed twice - once in the upper half and once in the lower half on a single page of paper.

Good Luck,
JRB-Bldr
 
Picking up ideas from above,
You could try a label and duplicate your records to print 2 copies to a same page.

Create a cursor with duplicate record such that duplicates appear together.

Then create a Label report and feed the newly created cursor to it.

If you have to print a separating line then add to 'Print When' that print only for odd numbered records(use mod function)


 
Hi All,

Thanks and sorry for the delay in reply, I took out one solution in which I cut the A4 size paper into two equal pieces and then increased the size of page footer.
After I generated one loop like ;

Code:
Select pckraw
Set Order To cReference
Go Top
Report Form Locfile('\reports\FgRec.frx') 
For i = 1 To 2
   Do Case
   Case i = 1
      mStyle = 'Original'
      Report Form Locfile('\reports\FgRec.frx') TO PRINTER PROMPT NOPAGEEJECT 
   Otherwise
      mStyle = '2nd Copy'
      Report Form Locfile('\reports\FgRec.frx') TO PRINTER NOPAGEEJECT 
   Endcase
Endfor

And, finally I got my solution.

Thanks

Saif
 
This is a useless loop, you go through each case once, that's also done with no loop at all. So simplify this:

Code:
Select pckraw
Set Order To cReference
Go Top
Report Form Locfile('\reports\FgRec.frx') 
mStyle = 'Original'
Report Form Locfile('\reports\FgRec.frx') TO PRINTER PROMPT NOPAGEEJECT 
mStyle = '2nd Copy'
Report Form Locfile('\reports\FgRec.frx') TO PRINTER NOPAGEEJECT && <- questionable, if you don't print anything else this leaves the print job open endless.

Now you print the report three times, and you use NOPAGEEJECT the wrong way, I don't know whether the first print should really end with a page eject, but the last report should, so NOPAGEEJECT should not be part of the last Report Form call.

Bye, Olaf.
 
Thanks Mr.Olaf

I did this and working perfectly! Again thanks for the time sharing with me.

Saif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top