For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > December 2005 > Reports / Preview / Printing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Reports / Preview / Printing
Kjell

2005-12-11, 7:55 am

Hi

I would like to check with you guys before I go inventing the wheel again.

I need to improve my VB applications reporting / previews and consequently
the printing procedures. so far I managed with simple paper prints without
first showing the report on screen, or using separate procedures for showing
on screen and printing the very same content, it's almost like doing the
report twice.
I even done several Exporting processes to MS-Excel so Excel can take care
of any paper printings.

I've seen some good looking examples for the last couple of years where a
report comes up on screen in a separate window (like a dialog form) looking
like a piece of paper and you can either close it or send it to the printer,
something close to what Adobe is doing, and I guess buying a Adobe writer
license can be one way for me to accomplish this, but I'm looking for a nice
VB6 alternative.

I tried building the report on a form setting background to white and
AutoRedraw to true, but I noticed a few things, I cannot make the size look
like a regular paper (A4) even tried with ScaleWidth and ScaleHeight equals a
A4 in millimetres.
Cannot even make the Form.Height equals a A4 paper in height, and then I
noticed that only the visible part of the form will be printed with PrintForm
function

Simply; I don't know enough about the subject so whatever tip you can
provide is highly appreciated.

Thanks in advance

Kjell Liljegren, Sweden
Joe O

2005-12-11, 7:55 am

If your reports are simple and do not need (much) subreports then you can
use vb's own Data Report.
To use VB's Data Reports go to.... Projects/Components/Designers and check
datareport. Some people use "Data Environment" with Data Report so you may
need to select Data Environment as well. Data Report is cranky and (to me)
is not worth the hair pulling that goes with learning it.

Also you can download samples on how to use Data Report from
http://www.veign.com/vrc_codeview.asp?type=app&id=84
http://www.freevbcode.com/ShowCode.Asp?ID=3026

http://www.planetsourcecode.com/vb/...=51049&lngWId=1

There is also Active Reports from Data Dynamics. This tool is good and easy
to use. It is almost like using MS-Access... its syntax, properties and
objects are vb-like and it is not as convoluted as Crystal Reports or as
crannky and dim-witted as Data Reports. Many users programmers here use
Active Report...
http://www.datadynamics.com/forums/37/ShowForum.aspx

Well the supposed grand-daddy is Crystal Reports. You may want to use that
(with some headache though)



"Kjell" <Kjell@discussions.microsoft.com> wrote in message
news:A8E28333-6A90-49F8-8B51-06045AC0290C@microsoft.com...
> Hi
>
> I would like to check with you guys before I go inventing the wheel again.
>
> I need to improve my VB applications reporting / previews and consequently
> the printing procedures. so far I managed with simple paper prints without
> first showing the report on screen, or using separate procedures for

showing
> on screen and printing the very same content, it's almost like doing the
> report twice.
> I even done several Exporting processes to MS-Excel so Excel can take care
> of any paper printings.
>
> I've seen some good looking examples for the last couple of years where a
> report comes up on screen in a separate window (like a dialog form)

looking
> like a piece of paper and you can either close it or send it to the

printer,
> something close to what Adobe is doing, and I guess buying a Adobe writer
> license can be one way for me to accomplish this, but I'm looking for a

nice
> VB6 alternative.
>
> I tried building the report on a form setting background to white and
> AutoRedraw to true, but I noticed a few things, I cannot make the size

look
> like a regular paper (A4) even tried with ScaleWidth and ScaleHeight

equals a
> A4 in millimetres.
> Cannot even make the Form.Height equals a A4 paper in height, and then I
> noticed that only the visible part of the form will be printed with

PrintForm
> function
>
> Simply; I don't know enough about the subject so whatever tip you can
> provide is highly appreciated.
>
> Thanks in advance
>
> Kjell Liljegren, Sweden



Mike Williams

2005-12-11, 6:55 pm

"Kjell" <Kjell@discussions.microsoft.com> wrote in message
news:A8E28333-6A90-49F8-8B51-06045AC0290C@microsoft.com...

> I need to improve my VB applications reporting / previews and
> consequently the printing procedures. so far I managed with simple
> paper prints without first showing the report on screen, or using
> separate procedures for showing on screen and printing the very
> same content, it's almost like doing the report twice.


You don't need to do that. You can write your report printing code in such a
way that you just pass it the output object (typically a printer or a VB
picture box) and a desired "size ratio" and the report printing code can
perform exactly the same printing tasks regardless of the chosen output
device. When passing it the printer object you pass a size ratio of 1 (so as
to produce a full page report on the printer) and when passing it a VB
picture box you pass it a size ratio anything from 1 downwards, depending on
exactly how you want the on screen output to look (actual size, half size,
page width, full page, etc). All you need to do is to ensure that the
ScaleWidth and the ScaleHeight of the picture box are always set to the same
value as the Width and the Height of the printed page and everything will be
printed and plotted at the correct positions regardless of the actual
ohysical size of the picture box (as long as the aspect ratio is correct).
The only real bother is the fact that the font sizes are unaffected by
ScaleWidth and ScaleHeight so you need to write your report printing routine
so that it uses the "size ratio" you have passed it to set the font size so
that it appears the same in relation to everyhting else. You obviously need
to write a fair bit of code, but it should be worth it in the end.

> . . . and then I noticed that only the visible part of
> the form will be printed with PrintForm function


There are ways of printing complete Forms whether they are entirely visible
on the display or not, but I really wouldn't recommend doing it that way
because the screen is a low resolution device whereas a printer is a high
resolution device.

I remember getting involved in answering a similar question about producing
print previews in this group a few months ago. A fair bit of ground was
covered in that thread. Check it out on Google Groups. If you go to Google
Groups and enter "Re-size Print Preview" in the search box (exactly as
shown) it should take you directly to that thread.

Mike


Kjell

2005-12-11, 6:55 pm

Thanks Joe

I've checked out the web page for Active Reports and that looks really good,
I also thought I'll give the built in Datareport a chance, after all my needs
are modest.

Am I right if I coming to the conclusion that VB Datareport requires ADO
technique and does not work with DAO ???

Anyway, I'm having big problems adapting the first example you listed from
Veign into DAO connection with smallest possible return, I cannot make it
work, It works fine with ADO though.

I must be able to have 2 - 3 recordset results on the report so I found an
article about using a class module as Datasource having two or more
datamembers.

Is there anyone having an example with a class module for datasource with
multiple datamembers and using DAO with it?

Kjell Liljegren, Sweden

"Joe O" wrote:

> If your reports are simple and do not need (much) subreports then you can
> use vb's own Data Report.
> To use VB's Data Reports go to.... Projects/Components/Designers and check
> datareport. Some people use "Data Environment" with Data Report so you may
> need to select Data Environment as well. Data Report is cranky and (to me)
> is not worth the hair pulling that goes with learning it.
>
> Also you can download samples on how to use Data Report from
> http://www.veign.com/vrc_codeview.asp?type=app&id=84
> http://www.freevbcode.com/ShowCode.Asp?ID=3026
>
> http://www.planetsourcecode.com/vb/...=51049&lngWId=1
>
> There is also Active Reports from Data Dynamics. This tool is good and easy
> to use. It is almost like using MS-Access... its syntax, properties and
> objects are vb-like and it is not as convoluted as Crystal Reports or as
> crannky and dim-witted as Data Reports. Many users programmers here use
> Active Report...
> http://www.datadynamics.com/forums/37/ShowForum.aspx
>
> Well the supposed grand-daddy is Crystal Reports. You may want to use that
> (with some headache though)
>
>
>
> "Kjell" <Kjell@discussions.microsoft.com> wrote in message
> news:A8E28333-6A90-49F8-8B51-06045AC0290C@microsoft.com...
> showing
> looking
> printer,
> nice
> look
> equals a
> PrintForm
>
>
>

Joe O

2005-12-11, 6:55 pm


"Kjell" <Kjell@discussions.microsoft.com> wrote in message
news:07A20E10-CA48-4492-B251-2A122DE519FB@microsoft.com...
> Thanks Joe
>
> I've checked out the web page for Active Reports and that looks really

good,
> I also thought I'll give the built in Datareport a chance, after all my

needs[color=darkred]
> are modest.
>
> Am I right if I coming to the conclusion that VB Datareport requires ADO
> technique and does not work with DAO ???
>
> Anyway, I'm having big problems adapting the first example you listed from
> Veign into DAO connection with smallest possible return, I cannot make it
> work, It works fine with ADO though.
>
> I must be able to have 2 - 3 recordset results on the report so I found an
> article about using a class module as Datasource having two or more
> datamembers.
>
> Is there anyone having an example with a class module for datasource with
> multiple datamembers and using DAO with it?
>
> Kjell Liljegren, Sweden
>
> "Joe O" wrote:
>
can[color=darkred]
check[color=darkred]
may[color=darkred]
me)[color=darkred]
http://www.planetsourcecode.com/vb/...=51049&lngWId=1[color=darkred]
easy[color=darkred]
that[color=darkred]
again.[color=darkred]
consequently[color=darkred]
without[color=darkred]
the[color=darkred]
care[color=darkred]
where a[color=darkred]
writer[color=darkred]
a[color=darkred]
I[color=darkred]


Joe O

2005-12-11, 6:55 pm

Kjell... You can't use DAO with DataReport... If you are using DAO in your
project you can open ADO recordset just for the reporting part...

See
http://msdn.microsoft.com/library/d...edatareport.asp


"Kjell" <Kjell@discussions.microsoft.com> wrote in message
news:07A20E10-CA48-4492-B251-2A122DE519FB@microsoft.com...
> Thanks Joe
>
> I've checked out the web page for Active Reports and that looks really

good,
> I also thought I'll give the built in Datareport a chance, after all my

needs[color=darkred]
> are modest.
>
> Am I right if I coming to the conclusion that VB Datareport requires ADO
> technique and does not work with DAO ???
>
> Anyway, I'm having big problems adapting the first example you listed from
> Veign into DAO connection with smallest possible return, I cannot make it
> work, It works fine with ADO though.
>
> I must be able to have 2 - 3 recordset results on the report so I found an
> article about using a class module as Datasource having two or more
> datamembers.
>
> Is there anyone having an example with a class module for datasource with
> multiple datamembers and using DAO with it?
>
> Kjell Liljegren, Sweden
>
> "Joe O" wrote:
>
can[color=darkred]
check[color=darkred]
may[color=darkred]
me)[color=darkred]
http://www.planetsourcecode.com/vb/...=51049&lngWId=1[color=darkred]
easy[color=darkred]
that[color=darkred]
again.[color=darkred]
consequently[color=darkred]
without[color=darkred]
the[color=darkred]
care[color=darkred]
where a[color=darkred]
writer[color=darkred]
a[color=darkred]
I[color=darkred]


Amit Mohod

2005-12-13, 3:55 am

> I must be able to have 2 - 3 recordset results on the report so I found an
> article about using a class module as Datasource having two or more
> datamembers.


Kjell..can u give me the link to the Artical u said about?? I am having same
prob. as u.


--
Regards,
Amit Mohod
AB Softskills, Nashik.
Cell No: 09822939505
Office: +91-253-2382781(255)
"Kjell" <Kjell@discussions.microsoft.com> wrote in message
news:07A20E10-CA48-4492-B251-2A122DE519FB@microsoft.com...[color=darkred]
> Thanks Joe
>
> I've checked out the web page for Active Reports and that looks really
> good,
> I also thought I'll give the built in Datareport a chance, after all my
> needs
> are modest.
>
> Am I right if I coming to the conclusion that VB Datareport requires ADO
> technique and does not work with DAO ???
>
> Anyway, I'm having big problems adapting the first example you listed from
> Veign into DAO connection with smallest possible return, I cannot make it
> work, It works fine with ADO though.
>
> I must be able to have 2 - 3 recordset results on the report so I found an
> article about using a class module as Datasource having two or more
> datamembers.
>
> Is there anyone having an example with a class module for datasource with
> multiple datamembers and using DAO with it?
>
> Kjell Liljegren, Sweden
>
> "Joe O" wrote:
>


Kjell

2005-12-16, 9:55 pm

Sure

this should be a good start for you

http://msdn.microsoft.com/library/d...scollection.asp

Kjell

"Amit Mohod" wrote:

>
> Kjell..can u give me the link to the Artical u said about?? I am having same
> prob. as u.
>
>
> --
> Regards,
> Amit Mohod
> AB Softskills, Nashik.
> Cell No: 09822939505
> Office: +91-253-2382781(255)
> "Kjell" <Kjell@discussions.microsoft.com> wrote in message
> news:07A20E10-CA48-4492-B251-2A122DE519FB@microsoft.com...
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com