Jump to content
Changes to the Jaspersoft community edition download ×

How I can download JasperReports.dll?


vikkumarash

Recommended Posts

I am tying to implement JasperReport in ASP.Net and its showing missing JasperReports dll.

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using JasperReports.Data;
using JasperReports.Engine;
using JasperReports.Engine.Data;
using JasperReports.Engine.Export.Html;
using JasperReports.Engine.Query;
using JasperReports.Engine.Util;
using JasperReports.Engine.Xml;

namespace JasperReportsDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            // Define the JasperReport Server URL and credentials
            string serverUrl = "http://xxx.xx.x.xx:8080/jasperserver";
            string username = "abc";
            string password = "abc";

            // Define the report template path
            string reportPath = "/reports/SalesReport.jrxml";

            // Define the report parameters
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("StartDate", DateTime.Now.AddDays(-30));
            parameters.Add("EndDate", DateTime.Now);

            // Define the report data source
            DataTable salesData = new DataTable("SalesData");
            salesData.Columns.Add("SalesDate", typeof(DateTime));
            salesData.Columns.Add("SalesPerson", typeof(string));
            salesData.Columns.Add("Product", typeof(string));
            salesData.Columns.Add("Quantity", typeof(int));
            salesData.Columns.Add("Price", typeof(double));

            for (int i = 1; i <= 100; i++)
            {
                salesData.Rows.Add(new object[] {
                    DateTime.Now.AddDays(-i),
                    "Sales Person " + i,
                    "Product " + i,
                    i * 10,
                    i * 100
                });
            }

            // Create the report data source
            JRDataSource dataSource = new JREmptyDataSource();
            dataSource = new JRBeanCollectionDataSource(salesData);

            // Generate the report output
            JasperPrint report = JasperFillManager.FillReport(reportPath, parameters, dataSource, new JdbcConnectionProvider(serverUrl, username, password));

            // Export the report to HTML
            HtmlExporter exporter = new HtmlExporter();
            exporter.ExportReport(report, new MemoryStream());
            string htmlData = exporter.GetHtmlContent();

        }
    }
}

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...