PDA

Click to See Complete Forum and Search --> : landscape with Data Report !!!! ????? anywone with a magik Dll


Thom_rek
Oct 5th, 2001, 06:19 AM
HI all

anyone knows how to print a data report in landscape.


Thanks


BEST REGARDS

jim mcnamara
Oct 5th, 2001, 12:58 PM
Have you tried:

Printer.Orientation = vbPRORLandscape

And.

This doesn't work with every printer, plus you have to know the actual command for the printer (like esc#0P;) to set landscape mode printing. The Escape api sends raw data to the printer -
in other words GDI doesn't touch it like it does for everything else.


Declare Function Escape Lib "gdi32" Alias "Escape" ( _
ByVal hdc As Long, _
ByVal nEscape As Long, _
ByVal nCount As Long, _
ByVal lpInData As String, _
lpOutData As Any _
) As Long

Dim i
Const PASSTHROUGH = 19
Dim outputdata as string
Dim controlStr as String
controlStr = |||chr(27) & whatever|| ' you have to know this part
it is not always an escape sequence.
i= Escape( Printer.hdc, PASSTHROUGH, Len(controlStr), controlStr, vbNull)
' print your report here.

Abu haider
Oct 5th, 2001, 10:28 PM
I will tell you two secrets about the DataReport.
1. You can't make it choose any page size you like.
2. You can't display Images from a Database (But this has nothing to do with you problem).

After a bit of research, I found that the Data Report Takes the Paper size from the default printer settings. So if you go to Settings->Printers and then choose the properties of your printer, you will have some option to change the paper size as well as the orientation. Change it to Landscape, and then run your project, what do you see?

Now, this is not a solution, isn't it? To me, it is the biggest limitation of the DataReport.

I found a work around though.
You may display a message to the user when they try to run the DataReport, say something like "You must choose a Landscape Paper settings". And then bring up the default printer properties using the PrinterProperty API call. So far I remember, the call is something like..


PrinterProperties( Printer.Name )


It is upto the user to select the Landscape from the dialog.
This is still not a solution, I admit that.

Please not that, changing the printer's paper orientation using the API or the Printer Objects Property doesn't work, this is because these methods do it for the application, and it doesn't change the default printer properties.

Once again, the DataReport takes it from the Default Printer Properties.

Hope it helps.

turtle
Dec 27th, 2001, 10:25 AM
The quickest and easiest way that I have found to get the data report to print in landscape is as follows.

Put this code in your click event or what ever command button fires the report off.

DataReport1.Orientation = rptOrientLandscape

2 things that You have to make sure of is:

1- Make sure that the report is not larger than the width of the paper. The width is determined by combining the left margin, width, right margin.

So I usually set the left and right margins at 720 twips (1/2"), and the width to 12000. This makes the total report width 13410. This is smaller than the maximum width of the paper. (16560 twips for 11 1/2" wide paper).

2- Make sure that You put the page orientation code before You refresh the report.

I hope this will be of some help.