[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Printable report components

Jim Archer

3/2/2012 9:58:00 PM

Just wondering if anyone knows what the best, most supported ActiveX report
components are? I'm looking to use in my commercial app. So far I've found 2
that seem any good.

ActiveReports 2.0, but they seem to have moved on to .NET:
http://www.datadynamics.com/Products/ProductOverview.aspx?P...

FastReport:
http://www.fast-report.com/en/products/report-generator-tool-fastrepo...
..html

If anyone has experience with these or know of other good ones, please lemme
know!


--
--------------------------------- --- -- -
Posted with NewsLeecher v5.0 Beta 12
Web @ http://www.newsleecher.c...
------------------- ----- ---- -- -

15 Answers

MikeD

3/2/2012 11:35:00 PM

0



"Jim Archer" <nospam@nothanx.com> wrote in message
news:vvadnak3_pnT38zSnZ2dnUVZ_rGdnZ2d@giganews.com...
> Just wondering if anyone knows what the best, most supported ActiveX
> report
> components are? I'm looking to use in my commercial app. So far I've
> found 2
> that seem any good.
>
> ActiveReports 2.0, but they seem to have moved on to .NET:
> http://www.datadynamics.com/Products/ProductOverview.aspx?P...
>
> FastReport:
> http://www.fast-report.com/en/products/report-generator-tool-fastrepo...
> html
>
> If anyone has experience with these or know of other good ones, please
> lemme
> know!

Well, there's Crystal Reports, which used to be pretty much the standard
reporting component to use. Not so much anymore, but it's still an option
(albeit not a cheap one).

Depending on the complexity of the report, printing directly using VB's
Printer object may suffice. It's relatively easy to use and it's free. If
you want a print preview feature, you can pretty much just substitute a
PictureBox control for the Printer object. What I've done is something like
this:

Private Function ScalePicPreviewToPrinterInches(picPreview As PictureBox) As
Double

Dim Ratio As Double ' Ratio between Printer and Picture
Dim LRGap As Double, TBGap As Double
Dim HeightRatio As Double, WidthRatio As Double
Dim PgWidth As Double, PgHeight As Double
Dim smtemp As Long

' Get the physical page size in Inches:
PgWidth = Printer.Width \ 1440
PgHeight = Printer.Height \ 1440

' Find the size of the non-printable area on the printer to
' use to offset coordinates. These formulas assume the
' printable area is centered on the page:
smtemp = Printer.ScaleMode
Printer.ScaleMode = vbInches
LRGap = (PgWidth - Printer.ScaleWidth) / 2
TBGap = (PgHeight - Printer.ScaleHeight) / 2
Printer.ScaleMode = smtemp

' Scale PictureBox to Printer's printable area in Inches:
picPreview.ScaleMode = vbInches

' Compare the height and width ratios to determine the
' Ratio to use and how to size the picture box:
HeightRatio = picPreview.ScaleHeight / PgHeight
WidthRatio = picPreview.ScaleWidth / PgWidth

If HeightRatio < WidthRatio Then
Ratio = HeightRatio
smtemp = picPreview.Container.ScaleMode
picPreview.Container.ScaleMode = vbInches
picPreview.Width = PgWidth * Ratio
picPreview.Container.ScaleMode = smtemp
Else
Ratio = WidthRatio
smtemp = picPreview.Container.ScaleMode
picPreview.Container.ScaleMode = vbInches
picPreview.Height = PgHeight * Ratio
picPreview.Container.ScaleMode = smtemp
End If

' Set default properties of picture box to match printer
' There are many that you could add here:
picPreview.Scale (0, 0)-(PgWidth, PgHeight)
picPreview.Font.Name = Printer.Font.Name
picPreview.FontSize = Printer.FontSize * Ratio
picPreview.ForeColor = Printer.ForeColor
picPreview.Cls

ScalePicPreviewToPrinterInches = Ratio

End Function



Dim oPrintSource As Object
Dim Ratio As Double


Printer.Orientation = vbPRORLandscape

If chkPrintPreview.Value = vbChecked Then
Load frmPrintPreview
With frmPrintPreview
.Height = Printer.Height * 0.67
.Width = Printer.Width * 0.67
.picPrintPreview.ScaleMode = Printer.ScaleMode
'.picPrintPreview.Move 0, 0, oPrintSource.ScaleWidth * 0.67,
oPrintSource.ScaleHeight * 0.67
.picPrintPreview.Width = Printer.ScaleWidth * 0.67
.picPrintPreview.Height = Printer.ScaleHeight * 0.67
Ratio = ScalePicPreviewToPrinterInches(.picPrintPreview)
CenterControlInForm frmPrintPreview, .picPrintPreview
Set oPrintSource = .picPrintPreview
End With
Else
Ratio = 1
Set oPrintSource = Printer
End If

oPrintSource.Font.Name = "Arial"
oPrintSource.Font.Size = 10 * Ratio
oPrintSource.Font.Bold = True

oPrintSource.Print <whatever>
oPrintSource.Print <whatever>

<more Print statements, etc., etc. etc.>

If chkPrintPreview.Value = vbChecked Then
frmPrintPreview.Show vbModal, Me
Else
oPrintSource.EndDoc
End If



frmPrintPreview is just a form with a picturebox named picPrintPreview.
There are no other controls on it nor any code. Again, this is probably
only viable for simple and straight-forward reports, and it doesn't provide
any additional functionality (for example, saving the report to a PDF or
some other document file). Actually, I take that back. You can possibly
save to a PDF or XPS document if those 'writers" are installed as available
printers, and you can save to a text file using the Generic/Text Only
printer (if installed and configured to output to a file by setting the port
to FILE:).

Another option might be VB6's Data Report designer. By far not the greatest
of reporting tools available, but for some reports it might be fine and it's
also free. There is a way to use the Report Designer without a Data
Environment designer for runtime, but you need to use a DE when designing
the report in the DR designer because you have to have the database fields
available to place onto the DR. But, once the report is created, you can get
rid of the DE and use code similar to this (obviously, the SQL query would
be quite different):

Dim sServer As String
Dim sDBName As String
Dim sUID As String
Dim sPW As String
Dim sConnectionString As String
Dim oRS As ADODB.Recordset
Dim sSQL As String
Dim sShapeSQL As String

On Error GoTo EH

<code to assign first 4 variables omitted>

'********************************************************************************************
'This code eliminates the need for the DataEnvironment designer
sConnectionString = "Data Provider=SQLOLEDB;Provider=MSDataShape;Data
Source=" & sServer & ";Initial Catalog=" & sDBName & ";UID=" & sUID &
";PWD=" & sPW
sSQL = "SELECT Batch, Store, SV, Qty FROM SVOE WHERE BATCH = " &
cboBatch.Text
sShapeSQL = "SHAPE {" & sSQL & "} AS rsReport COMPUTE rsReport BY
'Store'"
Set oRS = New ADODB.Recordset
oRS.Open sShapeSQL, sConnectionString, adOpenForwardOnly,
adLockReadOnly, adCmdText
Set drSVOE.DataSource = oRS
'********************************************************************************************

With drSVOE
.TopMargin = 1440
.LeftMargin = 1440
.RightMargin = 1440
.BottomMargin = 1440

.ReportWidth = Printer.ScaleX(Printer.ScaleWidth, Printer.ScaleMode,
vbTwips) - 2880

.Sections("PageHeader").Controls("lblPageHeader").Caption = "Batch "
& cboBatch.Text
' With .Sections("GroupFooter").Controls("fncQtySum").Font
' .Bold = True
' .Italic = False
' .Underline = False
' End With
.Title = "Super Valu Order Report"
.Caption = Me.Caption
If chkPrintPreview.Value = vbChecked Then
.Show vbModal
Else
.PrintReport ShowDialog:=True, Range:=rptRangeAllPages
'Printing is done asynchronously.
'We have to loop while it's printing so that the DataReport
'doesn't get unloaded (below) before printing is done.
Do While .AsyncCount > 0
DoEvents
Loop
End If
End With

If (oRS.State And adStateOpen) = adStateOpen Then
oRS.Close
End If

Unload drSVOE

Exit Sub

EH:

<your error handler>

End Sub

(This might only work with SQL Server because I'm not sure if the
MSDataShape provider can be used with other RDMSs. This code was originally
written for SQL Server 2000 but is now being run against SQL Server 2008 R2
and it still works fine).

I can't say that I use either of these a lot, but I have used both on
occasion. Again, it all comes down to the complexity of the report.

Mike


ralph

3/3/2012 4:25:00 AM

0

On Fri, 02 Mar 2012 15:57:34 -0600, Jim Archer <nospam@nothanx.com>
wrote:

>Just wondering if anyone knows what the best, most supported ActiveX report
>components are? I'm looking to use in my commercial app. So far I've found 2
>that seem any good.
>
>ActiveReports 2.0, but they seem to have moved on to .NET:
>http://www.datadynamics.com/Products/ProductOverview.aspx?P...
>
>FastReport:
>http://www.fast-report.com/en/products/report-generator-tool-fastrepo...
>html
>
>If anyone has experience with these or know of other good ones, please lemme
>know!

MikeD gave a good summary.

There are obviously several dozen other commercial products out there,
but as you noticed most have moved on to .Net.

I can add that I still use ActiveReports and have for years. It was/is
a pretty decent product. It was my number one recommendation for
years. Has a very small footprint compared to other Report utilities
too.

They don't support it any more but their legacy forums/articles are
still available and you can get help from various "unofficial"
sources. It is still being sold - $499. There may be cheaper sources
around. For awhile they included the ActiveX components with their
newer packages (similar to many other the 3rd party vendors like
Infragistics, etc.), but doesn't look like they do any more. You might
just ask them.

[You can use ActiveReports 4 (.Net) from VB Apps through .Net Interop,
but not recommended unless you are planning to migrate to .Net
eventually. If you do, I highly recommend ActiveReports 4 - they have
added features, but kept the basics, ie, you can actually generate a
report and get it working within the first hour of opening the box.
<bg>]

MikeD also pointed out VB Data Report is available and the price is
certainly right - free. But it is only for the most basic of reports.
The main drawback is it doesn't do images. I still use it for quick 'n
simple reporting for legacy VB apps when I don't need any of the
special features I can get from ActiveReports. Its footprint is tiny.

I also often use DE if I plan on using the Data Report. DE is much
maligned, but does what it does well.

You can also create your own simple report generator from scratch.
Mike Williams has posted tons of useful information within this
newsgroup. You will have to search back quite a few years, over tons
of posts - but worth gathering if you decide to go that route. BUT be
aware while it isn't all that difficult it will take time and won't be
a trivial project.

Crystal Reports is fine. But as noted it has become incredibly bloated
and horribly expensive. It does EVERYTHING now and it often seems
designing and printing a report has got lost in the shuffle somewhere.
Crystal Reports is longer a reporting 'utility' it is a large
application with a major learning curve. Not so bad for anyone that
'grew up' with CR, but daunting for someone who expects to just open
the box and start throwing out reports.

[Most shops/enterprises that adopt CR regularly send people to classes
to learn how to use it. I have often suspected that was by design as
CR makes a ton of money on teaching people how to use it. <g>]

Another option is using Office/Word/Exel if it will be commonly
available. You will probalby have to upgrade your Office skills, but
there are tons of templates and articles to help you get started.
Bulky and slow compared to a dedicated report utility, but the results
can be quite amazing and very professional.

-ralph

MikeD

3/3/2012 6:26:00 AM

0

"ralph" <nt_consulting64@yahoo.net> wrote in message
news:hq23l7lh5soodqgr8tsuenkemm21vsm9v0@4ax.com...

A number of good additional points and ideas. Got a couple of comments
though that Jim may find helpful.

>
> MikeD also pointed out VB Data Report is available and the price is
> certainly right - free. But it is only for the most basic of reports.
> The main drawback is it doesn't do images.

You sure about that? I don't recall ever putting an image on a DR, but there
is a RptImage control. It's very common, even back 13-14 years ago when VB6
came out, to use an image for a company logo in either the page header or
report header. I can't imagine NOT being able to do that with DR. I've just
never had to for the few reports I've ever done with it. I also can't say
that I really agree that it's only "for the most basic of reports". True,
you can't do some things with it that you can with more advanced reporting
tools, but if you really know what you're doing with the DR (and I'll admit
I'm only marginal with it), I'd bet you can create some fairly intricate
reports.

> I also often use DE if I plan on using the Data Report. DE is much
> maligned, but does what it does well.

Gah! I NEVER liked the DE and I never will. <g>

> Crystal Reports is fine. But as noted it has become incredibly bloated
> and horribly expensive. It does EVERYTHING now and it often seems
> designing and printing a report has got lost in the shuffle somewhere.
> Crystal Reports is longer a reporting 'utility' it is a large
> application with a major learning curve. Not so bad for anyone that
> 'grew up' with CR, but daunting for someone who expects to just open
> the box and start throwing out reports.

Bloated is kind of a good term to describe CR I guess. The distribution is
huge for it. What I ended up doing was packaging several of its merge
modules into an MSI file. It's 45.8 MB (Crystal Reports 11) and that doesn't
even include ALL of the merge modules. Also, I believe that you must have
the Developer Edition to have the rights to redistribute the runtime
components (as mentioned, they're packaged in various merge modules for
inclusion in your own MSI setup). But at least as of v11, they still provide
COM/ActiveX components that you can use in VB6. I kind of suspect that's
more for support of VBA and scripting languages that can use COM than it is
for VB6, but so what? Version 11 is the latest version of CR that I've
used. I don't even know what version it's up to now. 13? 14? I think v11
came out in 2006.

> Another option is using Office/Word/Exel if it will be commonly
> available. You will probalby have to upgrade your Office skills, but
> there are tons of templates and articles to help you get started.
> Bulky and slow compared to a dedicated report utility, but the results
> can be quite amazing and very professional.

Definitely an option under specific conditions. Not something you'd want to
do for a "general release" program or one intended primarily for the home
user. But for a business app if Office will be installed on workstations,
yeah, you can make a pretty decent-looking report that way. You'd
definitely want to verify Office (or at least whatever part of Office you'd
use) will be installed though. Contrary to popular belief, not ALL
businesses use MS Office, or perhaps only parts of Office are installed on
workstations (to reduce the number of licenses they have to buy). So you
need to be wary that some workstations may have Word/Excel while other
workstations may not. Of course, I know some businesses where all Office
apps (except maybe Outlook) are installed on a term server and employees
must log on to the term server to use them. Not sure how that licensing
works, but I'm guessing it must be cheaper than installing locally on
workstations.

Mike


ralph

3/3/2012 9:19:00 AM

0

On Sat, 3 Mar 2012 01:25:48 -0500, "MikeD" <nobody@nowhere.edu> wrote:

>"ralph" <nt_consulting64@yahoo.net> wrote in message
>news:hq23l7lh5soodqgr8tsuenkemm21vsm9v0@4ax.com...
>
>A number of good additional points and ideas. Got a couple of comments
>though that Jim may find helpful.
>
>>
>> MikeD also pointed out VB Data Report is available and the price is
>> certainly right - free. But it is only for the most basic of reports.
>> The main drawback is it doesn't do images.
>
>You sure about that? I don't recall ever putting an image on a DR, but there
>is a RptImage control. It's very common, even back 13-14 years ago when VB6
>came out, to use an image for a company logo in either the page header or
>report header. I can't imagine NOT being able to do that with DR. I've just
>never had to for the few reports I've ever done with it. I also can't say
>that I really agree that it's only "for the most basic of reports". True,
>you can't do some things with it that you can with more advanced reporting
>tools, but if you really know what you're doing with the DR (and I'll admit
>I'm only marginal with it), I'd bet you can create some fairly intricate
>reports.
>

It has an rptImage control, but it is not data aware, thus not data
boundable (is that a word? <g>). One can put 'static' pictures on a
report, but not 'dynamic' ones.

The early documentation shows the rptImage control as being used as
though it was ... For example ...

Set Sections("MySectionOne").Controls!Image1.Picture =
LoadPicture(<MyPath\picture.jpg>)

One can setup the initial report to display an image, but it doesn't
work once the report is 'running'. One can kind of fake it by setting
an image, show the report, clear the image, reset the image, refresh
the report, ... repeat. But in practice it isn't that useful.

I would agree that my characterization of "basic" is probably unfair.


>> I also often use DE if I plan on using the Data Report. DE is much
>> maligned, but does what it does well.
>
>Gah! I NEVER liked the DE and I never will. <g>
>

Your opinion of the Data Environment is certainly in line with the
clear consensus in the VB community. Developers stayed away in droves.
I was always surprised at that. The usefulness of Data Bounding and
its cousin data-aware classes in facilitating and simplifying the
collaboration of presentation and business objects was and still is so
obvious - how could it not be appreciated?

Well, unfortunately, because of one major problem - the DE adds
overhead and noticiably impacts performance. Not as much as its
critics would have one believe, but enough, and that tends to detract
interest. <g>

As hind-sight is 20/20 it is obvious now that Microsoft had their
plans set on .Net even before VB6 was released, and that the
development of the Data Environment and Data Report was essentially
halted and shipped before final completion. What we ended up with was
a "Data Report version 0.7" and a "Data Environment version 0.9".

[It should be noted that in all current OOP development platforms -
Data Binding is the default.]

-ralph

ralph

3/3/2012 9:27:00 AM

0

On Sat, 03 Mar 2012 03:18:47 -0600, ralph <nt_consulting64@yahoo.net>
wrote:

Oops.
Instead of ...
>
>One can setup the initial report to display an image, but it doesn't
>work once the report is 'running'. ...

I should have said ...

One can setup the initial report to display an image, but it doesn't
allow it to be changed once the report is 'running'.

-ralph

MikeD

3/3/2012 2:18:00 PM

0



"ralph" <nt_consulting64@yahoo.net> wrote in message
news:opo3l7p44rkp85l0krqcbqla90gbfdv7eo@4ax.com...
> On Sat, 03 Mar 2012 03:18:47 -0600, ralph <nt_consulting64@yahoo.net>
> wrote:
>
> Oops.
> Instead of ...
>>
>>One can setup the initial report to display an image, but it doesn't
>>work once the report is 'running'. ...
>
> I should have said ...
>
> One can setup the initial report to display an image, but it doesn't
> allow it to be changed once the report is 'running'.
>

Glad you made that clarification. So, for example, if you had a company logo
image at design-time, you could add that to the report?


MikeD

3/3/2012 2:32:00 PM

0



"ralph" <nt_consulting64@yahoo.net> wrote in message
news:qth3l71iq50pm4aqrd610g5o10j0kmbe1h@4ax.com...
>
> Your opinion of the Data Environment is certainly in line with the
> clear consensus in the VB community. Developers stayed away in droves.
> I was always surprised at that. The usefulness of Data Bounding and
> its cousin data-aware classes in facilitating and simplifying the
> collaboration of presentation and business objects was and still is so
> obvious - how could it not be appreciated?
>
> Well, unfortunately, because of one major problem - the DE adds
> overhead and noticiably impacts performance. Not as much as its
> critics would have one believe, but enough, and that tends to detract
> interest. <g>
>
> As hind-sight is 20/20 it is obvious now that Microsoft had their
> plans set on .Net even before VB6 was released, and that the
> development of the Data Environment and Data Report was essentially
> halted and shipped before final completion. What we ended up with was
> a "Data Report version 0.7" and a "Data Environment version 0.9".
>
> [It should be noted that in all current OOP development platforms -
> Data Binding is the default.]
>

I've never been a fan of data-binding in general. I've used it for demo and
proof-of-concept apps when I've just had to throw something together as
quickly as possible, but that's it. I've never used data-binding in a
production app. Well, I guess I shouldn't say "never" since I have used the
DR on occasion in production apps and that would have to qualify as being
data-bound. But as I showed in the example I posted, I remove the DE from it
after creating the report. I just feel you lose too much control with
data-binding, and then there's the big issue that you mentioned.

--
Mike


ralph

3/3/2012 6:14:00 PM

0

On Sat, 3 Mar 2012 09:18:23 -0500, "MikeD" <nobody@nowhere.edu> wrote:

>
>
>"ralph" <nt_consulting64@yahoo.net> wrote in message
>news:opo3l7p44rkp85l0krqcbqla90gbfdv7eo@4ax.com...
>> On Sat, 03 Mar 2012 03:18:47 -0600, ralph <nt_consulting64@yahoo.net>
>> wrote:
>>
>> Oops.
>> Instead of ...
>>>
>>>One can setup the initial report to display an image, but it doesn't
>>>work once the report is 'running'. ...
>>
>> I should have said ...
>>
>> One can setup the initial report to display an image, but it doesn't
>> allow it to be changed once the report is 'running'.
>>
>
>Glad you made that clarification. So, for example, if you had a company logo
>image at design-time, you could add that to the report?
>

ha. Yes.

I just re-read my original post and now realize I did make it sound
like DR didn't do ANY images. And that of course is not correct. (Hey.
It was 3am my time. lol)

It is perhaps just as well. "Jet's" handling of images when stored as
OLE Objects was always a bit limited and definitely slooooow. It
looked simple enough and allowed the production of some very pretty
MSAccess applications - but as everyone, that went down that path soon
discovered, it scaled poorly. I could easily see reports with running
times clocked in fractions of an hour. <g>

The alternative would have been some kind of image packaging in a
resource file or insuring a folderpath was always available, and then
writing some kind of bail-out if images couldn't be found, etc.

None of which couldn't have been done - others have managed it - but
like I said it is now apparent MS just stopped.

-ralph

Jim Archer

3/4/2012 4:00:00 AM

0

Thanks guys! That's a lot of good info. So I guess no one's heard of this
FastReports component huh? I did notice they update it frequently, so being
that ActiveReports isn't, it kind of turns me off them. And yeah, I would never
want to roll my own or use the built in POS report feature in VB6. And right,
Crystal Reports is huge and expensive.

All that being said, I am sure I'll have to move to .NET, at least for the main
interface, but that's going to be at least a 4 years or so.


--
--------------------------------- --- -- -
Posted with NewsLeecher v5.0 Beta 12
Web @ http://www.newsleecher.c...
------------------- ----- ---- -- -

MikeB

3/4/2012 12:50:00 PM

0


"Jim Archer" <nospam@nothanx.com> wrote in message
news:qYOdnfS73sk1dc_SnZ2dnUVZ_uWdnZ2d@giganews.com...
> Thanks guys! That's a lot of good info. So I guess no one's heard of
> this
> FastReports component huh? I did notice they update it frequently, so
> being

FastReports more often found with Delphi users.

> that ActiveReports isn't, it kind of turns me off them. And yeah, I would
> never
> want to roll my own or use the built in POS report feature in VB6. And
> right,
> Crystal Reports is huge and expensive.
>
> All that being said, I am sure I'll have to move to .NET, at least for the
> main
> interface, but that's going to be at least a 4 years or so.
>
>
> --
> --------------------------------- --- -- -
> Posted with NewsLeecher v5.0 Beta 12
> Web @ http://www.newsleecher.c...
> ------------------- ----- ---- -- -
>