Skip to main content
Windward

Generate Code

Overview

When you've tweaked your template and have everything running smoothly in AutoTag, you're ready to ensure that all your hard work will transition into your integration of the Windward Engine with ease. The Generate Code feature helps you by automating some of this integration through generating platform-specific code that you can simply paste into your project, and then directly run your template from the Windward Engine. This allows you to rapidly prototype templates and test them in your application integration, increasing your delivery time and alleviating any bumps in the road.

Languages Supported

.NET Engine

  • C#
  • VB.NET

 

Java Engine

  • Java

 

RESTful Engine

  • C#
  • Java
  • PHP
  • Python
  • Ruby
  • Typescript
  • VB.NET

You Only Use This Once

You do not need to run Generate Code for every template. You run this once to get started copying the sample code to your application. You then will add to that code to pass in the template you want to run and to write the generated report to the stream you want the output in.

Over time you may find you need to add additional variables that are passed in when you run the report, or possibly even another datasource. Do not re-run generate code in this case, just add these items to your code.

How it Works

Windward templates contain attributes that need to be called with unique code from the Windward Engine.  These include each of your data sources and any variables you’ve created:

  • Data sources. These data sources have unique connection strings for SQL and file path references for XML and other file-based data sources.
  • Variable Mapping – You must enter each of the variables created in your template into a hash-map in order to use them in the Windward Engine.

 

In order to call these attributes and run a report, the Windward Engine has 8 major steps that need to be defined in your code.  The Generate Code function takes care of these steps for you:

 

  1. Initialize the Engine – This process allocates the memory and sets up the basic structure. This should be specifically tailored to your server/computer’s configuration.
  2. Open Input and Output File streams – This is the first step that the Generate Code button assist you with.  It will help you create the streams to your file path locations of your template (input) and generated final report (output)
  3. Datasource Connection – This is the second step that the Generate Code button assist you with. SQL data sources require a connection string with username, password, server and database.  File based data sources require a path to the datasource file.
  4. Instantiate the report object for desired output –  Depending on the output you want to produce you will create an object using ReportXXXX(template, output), where XXXX is the file format you with to create, ie. DOCX, PDF,  XLSX, etc.
  5. Run the Report Process – this will setup the template with the defined data source and begin processing the tags against each data source.
  6. Add Variable Value Mapping - This is the third step that the Generate Code button assist you with.  It will help you create the code for assigning a value to the variables that you have defined in your template
  7. Datasource Nickname Mapping This is the fourth step that the Generate Code button assist you with.  If you are using more than one data source, then nicknames need to be assigned to differentiate which data source a tag is pulling its information from.  You have to map a nickname to each data source connection you defined earlier in order to successfully process each.
  8. Clean up – the final part of the processes closes out all file streams and releases the memory used back to the OS.

 

That is a LOT of steps if you just need to test your template. AutoTag’s Generate Code tool greatly simplifies this process.

 

Steps to Use Generate Code

  1. Open a working, tagged template inside of Microsoft Office. 
  1. Navigate to the AutoTag Manager tab and click Generate Code.

  1. Select your platform and language from the top tabs in the Generate Code window.

  1. Click Generate Code, then click the Copy to Clipboard button at the bottom.
  2. Open your project and paste the code in your main project file, save and compile.

 

Congratulations! You have now run your template by code in the Windward Engine.

 

NOTE:  You must add references to your project for any files it uses like templates and file based data sources before you can compile.