ASP.NET Crystal Report Print Automatically - c#

I would like to know if exists the way to send a crystal report directly to the printer without print dialog. Ex. I have an asp.net page with a crystal report viewer and I want send to print once the report have been loaded into the viewer.
I saw an application what it is doing that but I don't know how that work.
I am using
Visual Studios 2010
Crystal Report for .NET Framework (Version=13.0.2000.0)
C# 4
if have a code sample (will be great!!!!)
I have read lot of resources in internet but nothing give me idea how to do what I need.
Thanks in Advance.
J.S.

It does not working like you think. Method PrintToPrinter generates printout directly to printer. Report preview also do the same. If you are executing both methods then report is generating twice. If you have more pritnout pages then report preview generates only visible pages. In most cases this does not change anything, but if report is generating a lot of time, then you are getting a lot of resources from system and you can expect deadlock on database. You also have to remember that if your report is generating new data per each executing then you will have doubled data.

Good I did it
I Just set this values to the ReportDocument.
CrystalReportDocument.PrintOptions.PrinterName = "Printer Name";
CrystalReportDocument.PrintToPrinter(1, true, 1, 1);
anyways I am open to other ideas and suggestion.

Related

Choosing the right reporting tool

I'm currently rewriting a legacy VB6/Access97 app to a new .NET/MySql one. This old application has more than 100 reports (.rpt Crystal Report XI R2, simple reports nothing too fancy) that need to be created from scratch since the data structure is completely changing.
How should I approach this?
Continue with CRXI(can't really afford to buy anything new), not knownig if is really compatible with VS2013, or just use the ReportViewer in Visual Studio ? How is the learning curve coming from CRXI?
Are there any free service that I can use ?
You might find your question can be answered by reading this Stack Overflow question:
Crystal Reports vs ReportViewer Pros/Cons?
Based on my experience with Crystal Report (1 year) and Report Viewer--RDLC (just learn it recently). I prefer to avoid developing in Crystal Report as possible as I can. Even though I just began learning Report Viewer, I like it more and more as I use it.
The downside of Crystal Report is the difficulty to create well bordered table, since Crystal Report doesn't have border property, while in RDLC, you can specify the border of table easily.
If you excel in creating report in Crystal Report, you might find that creating RDLC for Report Viewer is also easy, but you at first might feel confused since you won't get instant preview of your report while editing your report in Visual Studio, but after you getting hang of it, it will be easy.
Creating, developing, and using RDLC is free. If you develop RDL, you should deploy the report in the server with SQL Server Reporting Services (SSRS) installed, which you will need to buy license for that.
RDLC is Report Definition Language (Client) which use XML and can be opened with Microsoft's Report Viewer.
RDL is Report Definition Language which also use same XML as RDLC and can also be opened with Microsoft's Report Viewer.

How can I generate a report in WPF?

I'd like to know of any tools to generate a report in wpf.
What I want to do is to generate the report and export it immediately to a pdf, csv or just print it. I don't want the client to be able to "adjust" the report from within my application. Also the report tool should give me lots of freedom, since I'm geerating reports from a datagrid that is constantly changing, according to the user's commands (in other words .. it's dynamic)
Does anyone know of any tools that allow me to do that (preferably an open source tool, but I'm not tied to it being open source)?
Reporting isn't specific to WPF. You can look at Crystal Reports, SSRS Reports (both server *.rdl and client embedded *.rdlc), or tools from companies like DevExpress' XtraReports.
The +1 for using SSRS Reports is that there appears to be a Mono project that will allow you to render them, so you're not tied 100% to the Microsoft server stack, if you have that requirement. Look at FYI Reporting from the provided link.
If you are familiar with crystal reports, this may be useful to you. Otherwise you could always use xslt and xml
This answer makes a a compelling arguement for micrsoft or third party reporting compared to xslt "hand made" reports.
Edit: As a first go, it may be adviseable to use the crystal report creation wizard
You can use Crystal Reports, just like we use it in WinForms.
You have several options here.
You can print a visual to pdf using a virtual printer: http://www.pdfforge.org/products/pdfcreator.
There are also XPS to PDF converters.
And, of course, there are numerous WPF based report generators.
You're question is quite clear, so I wasn't sure what exactly you were after.
You may consider using ActiveReports to fulfill your reporting needs as ActiveReports has a viewer and end user report designer control which can work quite well in WPF environment.The End user designer control will also allow your end users modify reports at their will.
Regarding the exporting capabilities , ActiveReports will let you export to PDF,Excel,Word,Tiff,Jpeg,Text etc.And lastly activereport will give you the flexibility you are looking for as it can be bound to datasets,XML,OLedbm,sql,Excel sheets, text,array, objects etc ..
You can visit these links to know more how ActiveReports works on WPF:
http://blogs.gcpowertools.co.in/2011/11/how-to-view-report-created-using-active.html
http://blogs.gcpowertools.co.in/2011/08/how-to-host-active-reports-end-user.html

Crystal Reports load depending on its mood

I have a crystal report viewer on Windows forms.
The report viewer has one report associated with it. I pass 24 parameters programatically. When i try to run the program, sometimes the reports shows and sometimes the software hangs up.
I m passing same data every time to the report. There are no compile time errors. When I do step-debbuging, then every time the report loads perfectly and there are no hang-ups.
What can be reason of this moody opening of report ????
Edit1:
During step debugging, I found that assignment of reportsource to CrystalReportViewer causes the software to hangup.
goldBillReport = new GoldBill();
crystalReportViewer1.ReportSource = goldBillReport; //Hangs after this !!
SetGoldParameters();
Edit 2:
I have changed the scenario now, I take simple windows form, add a crystal report viewer to it. Secondly I create a blank crystal report.
Now I write the following lines in form load event of the windows form which contains viewer.
goldBillReport = new BillReport();
crystalReportViewer1.ReportSource = goldBillReport ;
80% of times when I load the form it shows the blank report (as required). The remaining time it shows nothing and application just hangs. Why ?
Note: My real application is very large. Is it the problem that the program is not getting proper memory space to open the report. If yes then are there any ways to collect garbage ?
Thank you in advance
I would check that you are correctly disposing of your viewer when the form is closed.
Also, I had an issue where the first time I ran a report it was extremely slow. The solution to this was to load a temp report during Application startup (behind a splash screen). This ensured that the Crystal Report DLL's were fully loaded before the user can generate a report. After I did this the reports loaded in few seconds each time.

Free Report Designer(Generator) like Crystal Report , Fast Report and etc

I am looking for a free report designer, like Crystal Report ,Fast Report ,Stimul ,etc for my WinFom Application.My Applaction database is sql server 2005.thanks.
I have tried in google but I didn't find any useful one.Now I am using Microsoft Report in my application.
Update : I have found this one OpenReport,Has anyone exprienced this one?
Personally I have used the built in reports in Visual Studio, they were much easier to work with than Crystal Reports and had no problems in dealing with SQL Server.
If you need a simple report containing not more than 5 pages, you can use the quick demo version of the report. I use it quite successfully.

Crystal 2008 - Can I access the SQL statement programatically at runtime?

We've created a Crystal Report viewer application to house all of our company reports. It's built in such a way that any time we add, modify or delete a report, the viewer application itself does not need to change. The viewer app is completely driven by an XML configure file that tells it what reports are available, where they are, connection information etc. We want to keep it this way too. When we add a new report, we don't want to have to update everyone's viewer application.
The problem is that Crystal talks to our DB directly and we would prefer it didn't. Therefore, for each report, the viewer needs to query the database to retrieve the data each report needs. The problem is that many of our reports allow the user to enter a large number of filter criteria. Ideally, what we would like to be able to do is to have Crystal prompt the user to enter their filter criteria, like it currently does, and then be able to somehow get the SQL statement it would send on to the DB, pass it on to the DB ourselves, and tell Crystal not to. the viewer would then supply the report with data.
Does anyone know if this can be done? An alternative we've considered is to have the viewer prompt the user for the filter criteria, and then build the SQL statement. However, then each report becomes a C# coding project with an update to the viewer. We're trying to avoid that.
Thanks.
Interesting approach. I have only ever done the opposite.
Normally people like to build their own reports using a Crystal client. The report connects to a datasource specified in the report itself.
Using .NET to query the reports needs, set parameters and formulas then view the report is a piece of cake.
Anyway, there are only two methods that I know of called "pull" and "push". Pull is what I just described above. Push is what you described as a solution that you considered but it would involve coding for each report.
I'm afraid what you are trying to do has never been done before. However, I would recommend the "pull" method. It has worked very well for me with a client with dozens of users and hundreds of reports.

Categories

Resources