Solved

Creating Crystal Reports Programmatically in .NET

Posted on 2004-03-26
12
3,493 Views
Last Modified: 2007-11-27
Is it possible to create crystal reports programmatically using VB.NET (or anything.NET) with "Crystal Reports for .NET"

Ie I want to do some kind of CreateObject for the report, create the report sections, add the fields, datasource etc and set everything else programmatically.

I've found articles covering advanced edition but want to do it with just the .NET product if possible.

Thanks
0
Comment
Question by:xassets
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
0
 

Assisted Solution

by:OverTheEdge
OverTheEdge earned 200 total points
Comment Utility
  Unfortunately, Crystal Decisions is very restrictive about allowing you to create reports on the fly. They want you to buy additional licenses to do this. In fact, you have to buy a license for each machine that is going to run your application. This quickly becomes incredibly expensive and I would think that only the largest companies can afford this luxury. This applies for both the CR.NET that you get with Visual Studio as well as using the RDC that comes with CR9 and CR10. The one option you have is that if you want to run your reports using ASP.NET, then you can use the RAS components on the web server. For some reason, Crystal Decisions thinks its okay to let you build reports programmatically as long as you only do it on a web server. What's the reason for that? I have no idea. But I'm guessing its because they are trying to compete with other reporting tools that are server based and marketed towards enterprises with cash to spend.

     HTH,

    Brian Bischof

    http://www.crystalreportsbook.com/123aspx.asp

    A Crystal Reports.NET tutorial for programmers? Its here!
    * Covers ASP.NET and Windows Forms
    * Teaches all phases of report development
    * Alerts you to the bugs and how to get around them
    * Maps out the complex ReportDocument object model
    * Shows how to perform runtime customization
    * Demonstrates all options of connecting with ADO.NET
    * Gives complete code listings for every concept presented

0
 
LVL 4

Author Comment

by:xassets
Comment Utility
OK this is what I typed in response to frodoman's answer....

Thanks for this.

If I'm reading this right, I need some activex component called RDC which doesn't exist in crystal .net. Do I need to buy the developer edition of crystal to get hold of the RDC ?

I'm actually not that bothered about using .NET, and would prefer to call it from vb6. I was referring to .NET just because it comes with a version of crystal. If we need to buy developer edition we will.

The article mentions that the RDC makes calls to a "Report Creation API". If this API exists in .net then I could forget the RDC and just use the API instead ? Is that possible ?

--------------------------------------------------------------------------------

Brian: This will be a web application (with vb6 mid tier) so using ASP.NET to create the reports on the web server is not a problem.

Interesting that the Crystal sales people didn't tell me about that one, wanted me to buy advanced edition instead !

If you can offer any pointers on how to create a "hello world" crystal report on the fly that would be great.

--------------------------------------------------------------------------------

Question you'd both probably know the answer to: Are there any compelling reasons for choosing vb6 + crystal dev edition over .NET, other than price ?

0
 
LVL 4

Author Comment

by:xassets
Comment Utility
would appreciate answers to the above, sorry but the crystal product line is v difficult to understand

What I'm getting at is that I want an web app to compile reports "on the fly", and I want the minimum crystal product to achieve that.

I've been trying to find out how to compile a crystal report using asp.net and its not going well, I just don't know which objects to start with. Any ideas ?
0
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
As far as I know, you'll need either developer or advanced editions to do the dynamic reporting.  I've never used other versions so I can't be certain it's not possible but the documentation I've read indicates that it isn't part of the license (even if you do manage to get the necessary components).  So, developer/advanced would be the minimum product.

If you want some good asp.net tutorials, try this site: http://www.businessobjects.com/products/dev_zone/default.asp  and download the "Underground Office Supply" sample.
0
 
LVL 4

Author Comment

by:xassets
Comment Utility
Thanks frodoman, I'm going to double check on the asp.net licensing stuff with crystal people, but I'll also check out those links.

Can you just answer one more thing:

Instead of creating the whole report at run time, if we had a report template with a set of fields, is it possible using developer edition to hide fields, move fields and change datasource and font etc ? That may be easier to program I reckon.

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 42

Accepted Solution

by:
frodoman earned 300 total points
Comment Utility
I've never done some of it myself (I usually go with static report or completely from scratch myself) - but I believe all of that is possible.  Certainly changing datasource - that's extremely common.  The rest of it seems like it wouldn't be a problem although it may be more work than necessary.  Depending on the situation don't forget that you can conditionally format just about everything w/in the report itself.  Often I'll create a "static" report and pass a parameter to it that will control the font size, hide extraneous fields, etc.

0
 
LVL 4

Author Comment

by:xassets
Comment Utility
Ok thanks for the confirmation

I've found that you can indeed use RAS from ASP.NET, but haven't quite got through to the hello world stage yet. I'll raise another question about that if needed.
0
 

Expert Comment

by:navinkaush
Comment Utility
Hi xassets,
              I am looking for the same kind of stuff , for that you were a month back.
I have to create a web report designer that is end user will be able to create/design reports using web browser from anywhere in the world and other people can view that report.
             User interface will be in .net.
             Also I don't know about licensesing for the same ( Crystal Report )
             Any kind of help, suggestion will be a light for me.
            I look forward to hear from you.
             Thanks in advance
0
 
LVL 8

Expert Comment

by:plq
Comment Utility
Hi navinkaush

Crystal licensing is pretty nasty. I think they're overly greedy and therefore leaving room for competitors to jump in. If you ask Crystal which product, they will always come back and say "advanced edition" no matter what.

For the time being crystal is a good option even so.

You can design RPT files within .NET at design time, but not at run time, and you can issue reports to aspx applications from a server. The server can PDF the reports and you can then call back the report using a url to a pdf file generated by crystal. If its a busy server then crystal will start throwing exceptions just to make you buy a server license.

If you want to design reports at run time, you have to get the advanced edition which has to be bought for you AND for each client. That can be a lot of money.

The actual export to pdf is easy :

        ''The path/location where the exported file will be saved
        Dim exportFilePath As String = Application.StartupPath + "\exported.pdf"

        ''Create an instance of the Chart report
        crReportDocument = New Chart()

        ''Set the options for saving the exported file to disk
        crDiskFileDestinationOptions = New DiskFileDestinationOptions()
        crDiskFileDestinationOptions.DiskFileName = exportFilePath

        ''Set the exporting information
        crExportOptions = crReportDocument.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskFileDestinationOptions
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With

        ''Export the report
        crReportDocument.Export()

        ''Display a message letting the user know the export is complete
        MessageBox.Show("Report exported to: '" & exportFilePath & "'")

0
 

Expert Comment

by:navinkaush
Comment Utility
Yes, I got your point. Just tell me one thing, when we will give the creating/designing of report at run time through programming in asp.net page and finally report will run at server then why they will charge for each client. Client is just using browser and we don't know how many user can use it. it is open to world.
 
 Also , please tell me the possiblity of creating report at run-time. I got some documents that shows it is possible to create report at run time, I am going through those documents. But if you have some knowledge of creating report at run-time . please share with me.
0
 
LVL 8

Expert Comment

by:plq
Comment Utility
Here's crystals licensing statement from their web site
--------------------------
For each internal application that you build, the reporting component can be deployed on a single processor. To deploy the reporting component on additional processors and increase reporting throughout, additional licenses are required.

You may not under any circumstances deploy an application to access the reporting component on more than one processor by combining additional Crystal Reports licenses. To deploy the reporting component on additional processors or servers, processor-based expansion licensing is available.

If you build web applications that will be redistributed, sold or deployed to a third party, you must purchase a copy of Crystal Reports Developer or Advanced Developer for each company you redistribute to.
--------------------------

However, if you build your app using crystal reports with .net, you dont have to pay it unless you want the "increased reporting throughput". Not many apps produce 3 reports per second. Again from the crystal web site for .net lic:

------------------------------
A customized Crystal Reports designer is fully integrated within Microsoft Visual Studio .NET and Borland C#Builder for powerful—yet easy—report design. You may use the integrated designer to create an unlimited number of reports for use within your .NET applications.

For a fully functional, stand-alone designer, as well as over 50 new features and enhancements, upgrade to Crystal Reports 10 Advanced Edition. Reports you create with Crystal Reports 10 Advanced Edition can be used within your .NET application. Best of all, a new, more scalable deployment license comes standard with Advanced Edition.

--- and ---

You may use a single instance of the bundled reporting component for as many applications as you like within a single multi-processor server. You may not increase the scalability of this component by deploying it in a web farm. To increase scalability to meet your production requirements, upgrade to Crystal Reports 10 Developer or Advanced Edition. Learn more  

To redistribute a server or web application that uses the bundled reporting component outside your own organization to third parties, written authorization from Crystal is required. You can get authorization by registering your application online at no extra cost. Register your application

------------------------------

Its all here

http://www.businessobjects.com/products/reporting/crystalreports/licensing/details.asp

------------------------------
I dont think its possible to create a report at run time without advanced edition. Please let me know if you find that I'm wrong !

thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Combine and display field 5 56
Selection formula 7 40
Multiple Parameters in Crystal 11 33
Crystal Report for VS2013 17 36
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now