crystal reports templates? - c#

Asp.net provide master pages, similarly in Winforms we concept of visual inharitence. Same parent-child concept is in many difference technolgoes.
Kindly guide me how I can make a template or parent report and inharit other reports from this layout.

Templating is not provided from Crystal Reports, actually.
You can, instead, use some workaraunds to help report design:
Create reports called Header.rpt and Footer.rpt and import them as Sub-reports in Page Header and Page Footer** [if you change Header.rpt you have to open each report and click re-import sub report to update it]
After editing, you can save a chart as a template so, when you create a new one, you can use same configuration for style, colors, etc
Keep an empty report somewhere with title, style, fonts, margins already set and use it as a template for new reports (instead of starting from a real empty one)
Save client's logo into DB so (you can change it dynamically at runtime) and use it in header-footer-anywhere

Related

How to displays only selected fields from the report at runtime in c# winforms using crystal report?

I am developing an win forms application for now i want to generate a crystal
report that is dynamically. Means if my table contains 30 fields so i will
design my 30 fields on front end just take checkbox or dropdown so, based up
on the user selection i want to generate report i.e,dynamically. So i have
already but i got a bunch of errors just like as asking prompt message for
enter a value.(If i have set list of values option as "Dynamic" too)
Those issues are not solvable me i irritated a lot.
Can you give me any reference or procedure to make report as dynamic in my
win forms using c# and database as SQL.
Thanks help me out.
In case of dynamic Report with dynamic fields, I afraid you have to create the report programmatically. So you can iterate over all existing objects in your report in ReportDocument and either take them out or add them to the report depending on the date you want to visualize.

How do I create a report in a WPF MVVM application without refering to a database

I'm trying to create a report in my WPF application.
I'm using Visual Studio 2010, C# and MVVM
I have researched alot and only found articles on the net that deal with Crystal Report by using a database. In my application, I don't communicate with the database directly. We use a web service. It communicates with the database and writes all the data in xml files. We get our info via stored procedures.
Hopefully that is not a problem.
Anyway, on one of my User Controls, I have a datagrid that is populated with data from the database. I store this data using a List and Observable Collection. So retreiving the data is easy.
But I would now like to export the data into a report for the user to print.
As I said, I've read up on reports, and they all use some form of dataset or datatable. But as I've stated, we don't use the database directly.
I have downloaded the SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads just to ensure I can use Crystal Reports.
I have an idea that I must create a new User Control or Window View and set the datacontext via ViewModel. On this form should be a Report Viewer control, that would be populated. But I don't know what to pass through, if I can do something like this. Can I send over the List/ObservableCollection that has the data I want saved to the form, and bind it to the report control? Using [this] as an example 2, this is kind of the direction I'm looking for
Or is there another way of creating a report without using a database?
I just generally want to create a report in my existing WPF project. A new window or user control is opened and the report viewer is loaded here, with the data I have in a gridview. Using WPF and MVVM, how do I achieve this.
I also have Component One if anybody knows how to use this. The website itself doesn't offer great tutorials on the subject of thier report views.
Please let me know if there is anything else you need from me, and I'll make edits where I can
I think you're on the right track by creating a user control that uses the data grid. I think the next thing you want to look into for printing some kind of reports is DocumentPaginator. Using this approach you can print to .XPS files, print the user control right to paper, or/and use a third-party XPS to PDF converter.
Here is an example to get you started!
Just started looking at this myself, firstly you can add a DataSource based on either your EF context or your web service. You can then use the built in reporting toolset (which is based on the SQL Server Report Services (though you dont need this to host them)).
Though you'll need to use the Windows Forms host control :(
MSDN walkthrough about hosting reports in WPF

How do i make use of .rdlc reports created using the VS 2008 Report Wizard?

I have a c# project where i created a dataset, then when through the steps of creating 3 reports via the Report Wizard. The rdlc files are now in my project and i have a reportviewer control in my Winforms project. The question is, after going through the process of setting up the dataset and reports, how do i get any of them to display in the reportviewer? When i try to set the ReportEmbeddedResource to be one of the rdlc files, i get a message in the viewer saying the source of the data has not been set. I did that when i created the data set and the report.
Any ideas?
Here is a detailed tutorial on how to use Local Reports : http://msdn.microsoft.com/en-us/library/ms252075%28v=vs.90%29
I had to do this last year, Local Reports are kind of a headache. The problem is .rdlc files do not fill their data sets (they ignore all the <Query tags. So, what I had to do is write a custom .ascx that would parse the <Query> tags in the .rdlc, fill the DataSets, and pass the new file to the ReportViewer control.
Basic steps:
1. Build a set of input fields based on the QueryParameters inside any <Query> tags. This usually involved cascading comboboxes since parameters can be dependent.
2. When the user submits the form, fill the DataSet associated with each <Query>.
If you look at the way you input parameters in VS 2008 when you test an RDL, the control you will make does exactly that.
All of this had to be done because of a client request to not have to authenticate when running the report...ugh. The fun thing is, I never found a complete schema for RLD/RDLC XML so I had to look at a lot of report files to figure out all the variations.
EDIT: I missed the part where you said WINFORMS. My scenario was for Webforms, though it might still apply I've never used the ReportViewer control in Winforms.

Reporting Services 2005 Report with Disclaimers page after each section

Details:
I am using Reporting Services 2005 in a C# Application with Visual Studio 2008 to generate reports based on a SQL Server 2005 database. The application views the report locally using the .net report viewer and no report server is used. There is a page break in the report after each person. I am currently using just one report table for the .rdlc file to generate the report.
Question:
My client wants to put a disclaimers page after the grouping has ended for each person listed on the report. The client wants to be able to adjust the disclaimer page on the fly through the user interface, before running the report. Please offer suggestions on how I can accomplish this.
Any help is appreciated.
Thanks,
Jeremy
An alternative solution would be to create another report for the sole purpose of rendering the Disclaimer content. The Disclaimer report can then be embedded (via a subreport: see http://msdn.microsoft.com/en-us/library/ms160348.aspx) into your existing reports thereby allowing you to dynamically modify the content of the Disclaimer separately.
You could store the actual Disclaimer content within a SQL Server Database table and update it via any number of the typical simple standard .NET controls that are at your disposal.
This has the advantage of no character restrictions as per the prior recommendation.
Do you mean they want to adjust it on the fly PRIOR to executing the report or after?
If before, could you not use a parameter, with the disclaimer template as the default value and submit it to the report when they are done? You could then put the parameter in the group footer.
If after then...good luck :) The report is rendered into whatever format chosen. If you are retrieving the report in html and have the rendered file perhaps custom parsing could be done but seems a bit naff. Been a while with SRS, hopefully the param could work for you.

Inheritance in Reporting Services

Is there any way you can implement inheritance in Reporting Services? I would like to have a master report, that contains the standard header and footer + some info in the beginning of the report, as well as containing some report parameters. Then I would like to create a new report that inherits the master reports design and then I could add spesific content to that report. Then if I needed to change a header logo or something, I could just alter the master report and that change would propagate to all inherited reports. I'm looking for similar functionality as the asp.net masterpage gives on websites.
Is this at all possible using Reporting Services 2005, Visual Studio 2008 and c# ? Or is there any workarounds that could help me achieve this?
I render all reports to pdf by the way.
I had the same problem - but could not solve it in the given time so I put all the header, footer and sidebar information I needed on every report in subreports and integrated the subreports on all needed reports.
it's a very quick and dirty - copy-paste solution but it works now.
you should be able to achieve this using sub reports

Categories