Follow

Customizing the HTML Reports

To all easier and complex HTML report customization, HTML report templates now use a powerful templating language. The default reports display the majority and main information from the result XML file in HTML format. These templates can be edited to add, remove, and theme HTML reports however users' decide. The location of these templates that can be edited by any text editor are -

On 64 bit O/S installations: C:\Program Files (x86)\Focused Objective\Kanban and Scrum Simulator\Templates
On all others: C:\Program Files\Focused Objective\Kanban and Scrum Simulator\Templates

For syntax information google for "Microsoft Razor Syntax"

How it works

The XML results of a simulation output are passed into the templating engine in a string called "Context". The built-in reports use the .NET/C# language features to turn this into an XML parsed data structure that can be called within the template.

@using System.Xml.Linq
@using System.Xml
@{
XElement root = null;
XElement stats = null;
if (!String.IsNullOrEmpty(Context))
{
root = XDocument.Parse(Context).Element("results").Element("monteCarlo");
stats = root.Element("statistics");
}
}

The template outside of the @{ } blocks is straight HTML. Most of the template is HTML, and often the easiest way to author the base template is using your HTML editing tool of choice and then adding the special placeholders last.

When a value is needed from the XML document, it is added using the Razor @ syntax, then the C# commands to obtain the right value from the structure created in the first few lines. For example, to get the value from the XML structure:

<results>
  <visual>
    <statistics>
      <intervals count="[this value here]" />
... 

The following razor nugget would be used (stats is created above, it is the starting point for every XML element in the statistics element.

@stats.Element("intervals").Attribute("count").Value


0 Comments

Please sign in to leave a comment.