TX Text Control Blog

Retrieving template information using the ReportingCloud Web API

Björn Meyer

Blogged by Björn Meyer on August 11, 2017 and tagged with reportingcloud, reporting.


ReportingCloud provides an extensive API to manage templates. You can upload, list, count, delete and download templates from the ReportingCloud template storage. But it also provides endpoints to retrieve data structure information from a template.

The endpoint template/info returns information about the template including the merge field and merge block structure in a hierarchical form.

GET https://api.reporting.cloud/v1/templates/info

After calling this method with the template name as a request parameter, it returns a JSON string with the template information similar to this:

The returned object is of type TemplateInfo which contains all fields at root level and all nested merge blocks including contained merge fields:

TemplateInfo object

KeyValue typeValue description
templateNameStringThe filename of the template in the template storage.
mergeBlocksList of ReportingCloud MergeBlock objectsContains all merge blocks in the template.
mergeFieldsList of ReportingCloud MergeField objectsContains all merge fields in the template.

MergeBlock object

KeyValue typeValue description
nameStringThe name of the MergeBlock.
mergeBlocksList of ReportingCloud MergeBlock objectsContains all merge blocks in the template.
mergeFieldsList of ReportingCloud MergeField objectsContains all merge fields in the template.

MergeField object

KeyValue typeValue description
dateTimeFormatStringSpecifies a string format which is applied to date / time values.
nameStringGets and sets the name of the field.
numericFormatStringSpecifies a string format which is applied to numeric values.
preserveFormattingBooleanSpecifies whether the formatting is preserved.
textStringGets and sets the text of the field.
textAfterStringGets and sets the text after the field.
textBeforeStringGets and sets the text before the field.

In most cases, hierarchical data is used to design the template. But there are also use cases where data is shaped based on the data structure in a template. The work flow would be similar to this:

  • Retrieve template information
  • Create data object based on contained data structure
  • Merge template with newly created pre-shaped data object

To illustrate how to iterate through the hierarchical data, the following code shows how to fill a tree view in .NET using the .NET ReportingCloud wrapper:

The following screenshot shows the populated tree view in a sample .NET Windows Forms application:

ReportingCloud Template Browser

If you want to test this on your own, register today for a free 30-day trial license.

Happy coding!

 
 
Call us: +1 704-544-7445 (United States)
 
 

Products

Support

Downloads

Corporate

Buy Now

About Text Control

Founded in 1991, Text Control is an award-winning Visual Studio Industry Partner and leading vendor of word processing and reporting components for Microsoft development technologies. The products help thousands of developers add comprehensive word processing functionality to their applications. Text Control is 100% self-owned and independent of all investor decisions. Customers benefit from these years of experience, large user-base, and at the same time, appreciate developing with a mature, reliable product.

SD Times 100SD Times 100SD Times 100SD Times 100SD Times 100SD Times 100Visual Studio 2015 Launch PartnerVisual Studio 2013 Launch PartnerVisual Studio 2012 Launch PartnerVisual Studio Partner