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!

alternating printing in portrait and landscape possible ?

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi!

I am wondering if it's possible to have a report [VFP9], once runned, (based upon certain data-contents), prints a 1st sheet giving general information in portrait orientation and thereafter another sheet but than in landscape orientation. Landscape should stay depending on data to be printed and than again a '1st' sheet in portrait orientation having general information.

Can this be done within VFP or do I have to deal with automation and MS word to achieve such a result?

-Bart
 

Bart,

I once needed to so something very similar, and I couldn't find a good way of doing it. I ended it creating separate reorts in portrait and landscape, and writing code to choose which one to print at run time.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Ok Mike,
Once even you could not fix it.....
So I will go further using the automation-approach.
Thanks!
-Bart
 
I Don't know of this helps at all, but i have modified the FRX report file to produce two versions of the same report in VFP6. One is in landscape for a detail report, and one is in portrait for the summary report. I create a temporary copy of the report files (FRX & FRT) and open the FRX as a table, then hack the field that has orientation in it as follows.

Replace TmpReportFrx.Expr With "ORIENTATION=0" For TmpReportFrx.ObjType = 1

This assumes that there are no other parameters in this field that you want to preserve. I always clean out this field before distribution, so the only thing in the field is the orientation. There also may be easier methods in VFP9. Depending on your requirements, it may also mean having to alternate calls to each report format to produce them in the sequence you want.

Auguy
 
Auguy,
When you hack the frx from landscape to portrait or vice-versa do you get a landscape page with only a portrait of printed material or do you change the layout of the report as well?
wjwjr
 
I have to agree with that... hacking the FRX in such a way leaves you with "Portrait" headers and footers, and that's not always so pretty....


Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Up to know, in principle I always clean out the printer details from the frx to prevent unwanted results on 'an other machine'.
-Bart
 
Yes, In addition to changing the orientation I adjust other report controls like titles, etc. I Place a "Marker" in the comment field to make the adjustments easier. I also use the "Print When" of the items on the report to control which version of the report they print on. Sample follows.

* Adjust Horizontal Position (Title)
Replace TmpReportFrx.Hpos With (80000 - TmpReportFrx.Width) / 2 For TmpReportFrx.Comment = "Title1"

This approach allows me to maintain one copy of the report and not have to change two versions of the report when making modifications.

Auguy
 
Don,

I also use this same approach too display a list of fields from the report and allow the user to pick which ones to print. I remove the fields, and any heading text, totals fields, labels, etc. related to the fields they do not wnat printed. Then I move all the fields, etc. to the left so the fields (columns) do not have any white space between them. Future plans are to let them select the order of the fields, but not there yet.

Rob
 
Don,

Here is some of code and definitions. Haven't had time to really clean it up. FieldNamePrint is a cursor of the field names, etc. It is created in my base report form and populated in a class that is on the report form. The class reads the field info from the FRX after the user has selected a report and presents a grid to the user with the field names and the PrintMe field. The record type field is copied from the comment field in the FRX, some examples are:

"PGHEAD-Request Gallons" is a Page Header Label
"DTL-Request Gallons" is a Detail Field
"GRPFOOT-Request Gallons" is a Group Footer Total
"SUM-Request Gallons" is a Summary Total

The class also selects only the FRX entries with "DTL" in the comment to populate the FieldNamePrint cursor.

* This code is in Report Form Class
Create Cursor FieldNamePrint (FieldName C(25), PrintMe C(1), RecordType C(10), ReportForm C(30), Hpos N(9,3), Width N(9,3), Active L)

* This is in a procedure in my main proc file
* Spacer Width
nHpos = 104.167

Select FieldNamePrint
Scan
* Print Field = YES
If Not Empty(FieldNamePrint.PrintMe)
* Is This a Report Header Field?
If Not Left(FieldNamePrint.RecordType,7) == "RPTHEAD"
* Original Horizontal Position
nOrgLeft = Hpos
Select TmpReportFrx
* Set New Horizontal Position for All Records With Same Field Name
Scan For Trim(FieldNamePrint.FieldName) $ TmpReportFrx.Comment
Replace Hpos With Hpos - nOrgLeft + nHpos
Endscan
Select FieldNamePrint
* Set Next New Horizontal Position
nHpos = nHpos + Width + 208.333
Endif
Else
* Print Field = NO
Select TmpReportFrx
* Set Print When to False for All Records With Same Field Name
Scan For Trim(FieldNamePrint.FieldName) $ TmpReportFrx.Comment
Replace SupExpr With ".F."
Endscan
Select FieldNamePrint
Endif
Endscan

If you come up with any neew ideas, please foward them to me.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top