Click to See Complete Forum and Search --> : printing DataReport in Landscape mode


Lothar Haensler
November 3rd, 1999, 06:24 AM
How do you print a data report in landscape orientation?

Yes, this question has been asked before, but I have searched this forum and found no working solution.

We did set the orientation of the printer object: no luck.
We also used the pageset.DLL from an MSDN article: still no luck.

Does anyone have a working solution?

Chris Eastwood
November 3rd, 1999, 06:30 AM
Hi

Karl E Peterson wrote up an article on this several months back in the VBPJ. You could either try their web site at http://www.vbpj.com, or Karl's at http://www.mvps.org/vb.

Failing that, give me a shout, and I'll try and find it when I get home and post it here.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Lothar Haensler
November 3rd, 1999, 06:52 AM
Hi Chris,
couldn't find anything on the sites you mentioned.
hopefully you find the URL, soon.

Thanks

Chris Eastwood
November 3rd, 1999, 07:45 AM
Unfortunately, I only have the 'hard-copy' magazine code. I remember Karl saying that it's down to a bug in the DataReport and he gave some code as a solution. I'll post it (probably very late) this evening for you.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Chris Eastwood
November 3rd, 1999, 02:18 PM
Hi Lothar

Sorry, it wasn't Karl Peterson, but Phil Weber who wrote the article (not that it matters, because he doesn't have a website).

I've posted the code at :

http://codeguru.developer.com/vb/articles/1926.shtml

- make sure you read the text of the article so you understand the implications of doing it this way though !



Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Lothar Haensler
November 4th, 1999, 01:21 AM
Hi Chris,

Thanks a lot. I'm going to check it out very soon.
Do you know the URL of the original article on vbpj? I can't find <i>anything</i> on their website.

Lothar Haensler
November 4th, 1999, 01:58 AM
:-(
I tried it, and it did NOT work.
It tried your original code and the form was printed in landscape mode, OK.
Then I tried to print a datareport in landscape mode with the following code and
it did not work. The report was printed in portrait mode.

private Sub Command1_Click()
Dim iSaveOrient as Integer
DataEnvironment1.Connections(1).Open
iSaveOrient = Printer.Orientation
SetPrinterOrientation OrientLandscape
DataReport1.PrintReport
Printer.EndDoc
SetPrinterOrientation iSaveOrient
End Sub




This was tested with VB 6 SP3, NT 4 SP 5 on a Lexmark Optra printer.

I also added tons of error handling code to the SetOrientation procedure, but no runtime errors occurred anywhere.
Still, the report is NOT printed in landscape mode.
Any more hints?

Chris Eastwood
November 4th, 1999, 02:10 AM
Hmmm

Well, I copied the code from the downloadable file and the article assures me that it works. You can't get to the original article on http://www.vbpj.com unless you are a 'premier' member (ie. you pay).

You can however download the code from there using the 'Locator' code (really logical !) of 'VBPJ0599' - but you also need to be a registered member (although that's free).

The VBPJ0599 contains all the code from the may edition (zipped) - the one you'll be looking for is something like 'VBPJ0599AP.ZIP' (well, it definately ends in 'AP') - mail me if you can't find it and I'll send it to you.



Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Lothar Haensler
November 4th, 1999, 02:25 AM
OK, I found the code and it looks "OK".
Well, I also issued a service request with MS premier support.

Lothar Haensler
November 4th, 1999, 06:56 AM
what MS says:
if pageset.dll doesn't work, bad luck.
if it does work, good luck, but it (=pageset.dll) is still not a supported product.
Try something better like MS access or a third-party reporting engine.

So much for product support :-(