p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

Go Back   p2p.wrox.com Forums > .NET > Other .NET > Crystal Reports
I forgot my password
Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other programmers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 12th, 2004, 03:00 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: Albuquerque, NM, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default CrystalReportViewer1.PrintReport

I'm trying to set up a print button on the report viewer screen. The code in the book (CR for VS.Net, 2nd Edition) indicates that

CrystalReportViewer1.PrintReport

... should present a print dialog box, which would be perfect. However, when I type in the code, I receive a notice that "Print
Report is not a member of CrystalDecisions.Web.CrystalReportViewer". I've worked at setting up various references to see if I just didn't have references set up properly, but that's not where my problem seems to be. I really want to get this working, because there are a host of other members, according to the book, that I want to include in this project.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old November 6th, 2004, 03:02 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2004
Location: Karachi, Sindh, Pakistan.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The topics that we have covered here are :

1) Introduction

2) Getting a feel of it - Using an existing Crystal Report file in your .aspx page

3) Crystal Reports Walkthrough - using the Pull Model

4) Crystal Reports Walkthrough - using the Push Model

5) Exporting the Report file into other formats



INTRODUCTION


Crystal Report comes in various flavors and the one that is required for building reports for .NET is "". It exposes a rich programming model with which we could manipulate its properties and methods during runtime. If you are developing your .NET applications using Visual Studio .NET then you won’t have to install any additional software as it is already built into Visual Studio .NET.



---- Advantages -----

Some of the major advantages of using are :

- Rapid report development

- Can extend it to complicated reports with interactive charts

- Exposes a report object model using which it can interact with other controls on the web form

- Can programmatically export the reports into widely used formats like .pdf, .doc, .xls, .html and .rtf

Â

---- The Architecture ----

The various components that make up a simple implementation of Crystal Report as a 2-tier architecture, required for web applications are

The Client :

The client only needs a browser to access the reports which are embedded into the .aspx pages.

The Web Server hosts the :

- Crystal Report Engine (CREngine.dll)

Along with other tasks like merging the data with the report file, exporting reports into different formats, etc., it is the Report Engine that converts your Crystal Report into plain HTML that is passed on to your .aspx page.

- Crystal Report Designer (CRDesigner.dll)

The reports are created from scratch using the Crystal Report Designer, with which you could design the titles, insert data, formulas, charts, sub-reports, etc.

- The .rpt Report file

The first step to implement a report into your web application would be to create it using the Crystal Report Designer interface. You will find some ready-made .rpt samples provided with the default installation.

- The Data Source

The way your .rpt file gets the data depends on which method you choose. You can choose to make Crystal Report itself to fetch your data without writing any code for it or you can choose to manually populate a dataset and pass it on to the report file. We will look at the various possibilities a little later in this article.

- Crystal Report Viewer web form Control (CRWebFormViewer.dll)

The Crystal Report Viewer control is a web form control that can be inserted into your .aspx page. It can be thought of as a container that hosts the report on the .aspx page.Â



Note : In a more complex implementation, the reporting server and the web server could be on different physical servers, where the web server would make an HTTP request to the reporting server. The Crystal Reports could also be implemented as a web service.



---- Implementation Models -----

Fetching the data for the Crystal Report could be done by using any of the following methods :

- Pull Model :

where in Crystal Report handles the connection to the database using the specified driver and populates the report with the data, when requested.

- Push Model :

where it is the developer who has to write code to handle the connection and populate the dataset, and pass it on to the report. The performance can be optimized in this manner by using connection sharing and manually limiting the number of records that are passed on to the report.



---- Report Types ----

Crystal Report Designer can load reports that are included into the project as well as those that are independent of the project.

- Strongly-typed Report :

When you add a report file into the project, it becomes a ‘strongly-typed’ report. In this case, you will have the advantage of directly creating an instance of the report object, which could reduce a few lines of code, and caching it to improve performance. The related .vb file, which is hidden, can be viewed using the editor’s ‘show all files’ icon in the Solution Explorer.Â

- Un-Typed Report :

Those reports that are not included into the project are ‘un-typed’ reports. In this case, you will have to create an instance of the Crystal Report Engine’s 'ReportDocument' object and manually load the report into it.



---- Other things you should know ----

- Though the Crystal Report Viewer control comes with some cool in-built options like zooming, page navigation, etc., it does not have a custom print option. You will have to depend on the browser’s print feature.

- An un-registered copy of will remain active only for the first 30 uses, after which the ‘save’ option will be disabled. To avoid this, all you have to do is register the product with www.crystaldecisions.com for which you are not charged.

- The default installation will service only 5 concurrent users. To support more users, you will have to buy additional licenses from www.crystalDecisions.com





GETTING A FEEL OF IT – USING AN EXISTING CRYSTAL REPORT FILE IN YOUR .aspx PAGE



Lets take a look at how we could get this done the fast way to get a feel of how a Crystal Report file would look like in your web form.



1) Drag and drop the "Crystal Report Viewer" from the web forms tool box on to the .aspx page
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old November 6th, 2004, 03:04 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2004
Location: Karachi, Sindh, Pakistan.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Client Side javascript: window.Print

function PrintWindow(){
if (navigator.appName == "Microsoft Internet Explorer") {
     var PrintCommand = '< O B J E C T ID="PrintCommandObject" WIDTH=0 HEIGHT=0 ';
PrintCommand += 'CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">';
     document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
     PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = ""; }
else { window.print();} }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old November 8th, 2004, 11:42 AM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: Albuquerque, NM, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I should have posted earlier to this. My problem was that I was attempting use a windows form in a web application. This has been a major point of confusion for me in this project.

I overcame this problem by creating an export file into *.pdf at the same time that the report is being viewed. This export file is captured in a small frame on the web page that is the size of a dot. When I click on the print button, my code now opens the print dialog box for the adobe acrobat file, which is exactly what I was wanting.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old May 11th, 2008, 11:34 PM
Registered User
 
Join Date: May 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I am actually looking for what you are doing. I've manage to export my report to *.pdf by prompting user to open,save or cancel. How do you capture to small frame on web page and open the print dialog box for the adobe acrobat file? Can you assist me on that? Thanks!


Quote:
quote:Originally posted by toekneel
 I should have posted earlier to this.  My problem was that I was attempting use a windows form in a web application.  This has been a major point of confusion for me in this project.

I overcame this problem by creating an export file into *.pdf at the same time that the report is being viewed.  This export file is captured in a small frame on the web page that is the size of a dot.  When I click on the print button, my code now opens the print dialog box for the adobe acrobat file, which is exactly what I was wanting.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PrintReport() Problem ...Plz Help chansimone Crystal Reports 1 December 1st, 2004 04:15 PM



All times are GMT -4. The time now is 11:47 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 2010 Wiley Publishing, Inc