Skip to main content
Windward

WindwardReports.jar Utilities

engine-wiki-logo.pngOverview

The WindwardReports.jar file that is part of the install includes some useful utilities.

CheckJdbc

Checks what JDBC parameters to use when connecting to a database. Parameters are:

  • jdbc_classpath - the classpath for the JDBC driver. Examples are:

    • SQL Server: com.microsoft.jdbc.sqlserver.SQLServerDriver

    • Oracle: oracle.jdbc.driver.OracleDriver

  • database_name - the connection string used to connect to a specific database. Examples are:

    • SQL Server: com.microsoft.jdbc.sqlserver.SQLServerDriver

    • Oracle: jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=database_name

  • username [optional] - The username used when connecting to the database

  • password [optional] - The password used when connecting to the database

JoinReports

JoinReports.joinPdf() combines multiple reports into a single PDF document.

This operates differently from importing multiple templates into a master DOCX or XLSX template.

When you use the import tag, the imported template is converted into an element in the master template. For example, importing an XLSX file into a DOCX file converts the worksheets into Word tables. A Word table does not have the concept of hidden rows/columns, etc. and so that meta information is lost.

JoinReports keeps each document in its native template format. Each is then rendered to PDF and the PDF pages are then joined together in a single PDF document. This way you can combine DOCX and XLSX templates and both render their PDF pages as they would directly.

The API is passed an array of ProcessReport objects (and an OutputStream for the generated PDF report). If you are combining a number of static documents this is overkill and requires a couple of additional lines of code. However, if you want to build up distinct reports, applying data to templates, then combine those generated reports, this supports that use case.

ListServers

Net.windward.tools.ListServers (no parameters) will list out all Windward servers running on the network listing their version number, IP address, and server name (repeating the IP address if it has no name).

OutTagFormat

net.windward.tools.OutTagFormat is a quick way to find what format a <wr:out …/> tag will generate for a given string, type and pattern attributes. It also displays the output generated both by Windward Reports and the underlying Java classes. Both are displayed because some Java implementations differ in their formatted output, and this is something Windward Reports cannot control.

RunReport

Process an XML and RTF file into a report. This is a sample program that runs a report from the command line. The most common usage is:

java net.windward.xmlreport.RunReport template.rtf report.htm –xml order.xml

The three filenames can be anything you want. They are:

  • template.rtf - the report template. It can also be template.docx, template.xml, template.xlsx, template.pptx, or template.html

  • report.htm, which is the report created. This file can have an extension of RTF, HTML, PDF, TXT, WordML, SpreadsheetML, or XLS and will create a report in the appropriate format. For details and limitations of the WordML, SpreadsheetML, and XLS formats, please refer to the Template Creator’s Guide.

  • order.xml - the XML data to use for the report.

Here’s an example of using RunReport from the command line.

RunReport template_file output_file [-xml xml_file | -sql connection_string | -oracle connection_string | -ole oledb_connection_string] [key=value | ...]

The template_file can be a rtf or xml (WordML) file.

The output file extension determines the report type created:

output.htm - HTML file with no CSS

output.html - HTML file with CSS

output.pdf - Acrobat PDF file

output.rtf - Rich Text Format file

output.sml - SpreadsheetML file (rename to .xml to use)

output.txt - ASCII text file

output.xhtml - XHTML file with CSS

output.xml - WordML file

The datasource is identified with a pair of parameters

set username=user password=pass for database connections

must come BEFORE each -sql, ... part

-xml filename - passes an xml file as the data source

-sql connection_string - ex: //localhost:1433;DatabaseName=Northwind

-oracle connection_string

-ole connection_string

You can have 0-N key=value pairs that are passed to the data source Map property

ShowFonts

net.windward.tools.ShowFonts will display all fonts Java is aware of on your system. Run this and if it throws an exception, then there is a bug in the Java font layout code and there is no way Windward can do a work around. The source code to this class is in WindwardReports.jar.

This class makes no calls to Windward. If this program cannot run, then it is a Java bug, not a Windward bug.

UUEncode

net.windward.util.UUEncode will uuencode a file. This is useful for uuencoding bitmap files that will be placed directly in an XML file. To create a uuencoded file, run the program as “java net.windward.util.UUEncode image.jpg image.uue”

  • image.jpg - the binary file to uuencode.

  • image.uue - the created file that is a uuencode of the binary file.  

XMLPerf

net.windward.tools.XmlPerf will read in an XML file and evaluate an XPath search. It lists the time and memory footprint both before and after to give a measure of how fast dom4j can handle files of a given size and complexity.