Getsuyodev, Programming is mainly used when constructing an application. Programming requires knowledge of application domains, algorithms, and programming language expertise. Programming can be developed in different logic based on developer knowledge.

C# Crystal Reports from XML

Usually, we are generating Crystal Reports from Databases, here in the following section describes how to create Crystal reports from XML file in C#. This is very similar to creating Crystal Reports from the database, the only difference is that you have to select the data source as the XML file at the designing time of Crystal Report in C#.

Generating Crystal Report from XML file is very similar to generating Crystal Report from Databases. The only difference happens when selecting the data source part. Here you have to select Create New Connection – Database Files and select the XML file you want to generate Crystal Reports (In this case you select the Product.xml ).

Select all the fields from Product and click the finish button

Now the designing part is over and the next step is to call the Crystal Reports in C# and view it in Crystal Reports Viewer control.

Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form.

using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace WindowsApplication1
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
            crystalReportViewer1.ReportSource = cryRpt;

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More