Skip to main content
Windward

Basic Programming Example

engine-wiki-logo.pngOverview

This section takes you through a basic example of embedding the Windward .NET Engine. Once the .NET Engine is embedded into a .NET software application, you can generate reports and documents.

Details

The Windward .NET Engine is a set of DLL files. Your application accesses it through one basic class. This basic class is subclassed for each output format, as each format has its own options that you can set.

You must add all of the DLLS in the Windward "dll" folder as references to your project.You can link to the copies in that folder or link to the copies in the GAC(if you installed to the GAC).

Source Code

The .NET Engine takes two input streams, the template and the data, and creates an output stream – the final report.  Our first program we are going to write a method that is passed the three streams. 

This example creates a PDF report using and XML data source and default settings.

using System.IO;
using net.windward.api.csharp;


namespace RunReport
{
    /// <summary>
    /// Generate a PDF report using an XML file as the datasource. For this use case this is the entire set of code needed
    /// to use Windward Reports. For different output formats and/or different datasources, the code will change.
    /// </summary>
    public class GenerateReport
    {
        /// <summary>
        /// Generate a PDF report using an XML file as the datasource.
        /// </summary>
        /// <param name="template">The report template.</param>
        /// <param name="report">The generated report.</param>
        /// <param name="xmlData">The XML data file.</param>
        public static void GeneratePdfReport(Stream template, Stream report, Stream xmlData)
        {
            // generally called once when your app starts, not in here.
            Report.Init();
            // create the report.
            ReportPdf proc = new ReportPdf(template, report);
            proc.ProcessSetup();
            proc.ProcessData(new XmlDataSourceImpl(xmlData, false), "");
            proc.ProcessComplete();
        }
    }
}
  • Was this article helpful?