TX Text Control Blog

All Google Fonts now available in ReportingCloud

Björn Meyer

Blogged by Björn Meyer on August 22, 2017 and tagged with reportingcloud, reporting, web api, google fonts.


Making the web more beautiful, fast, and open through great typography.

This is the motto of Google Fonts. The advantage of ReportingCloud is a consistent rendering of documents. What you see in the ReportingCloud template editor is exactly what you get when merging a document using the Web API.

We just rolled out all 2000+ Google Fonts to our ReportingCloud servers. From now on, you can use these fonts in your templates and create your documents with this enormous selection of beautiful fonts.

The endpoint fonts/list returns the available fonts that can be used in your ReportingCloud templates:

GET https://api.reporting.cloud/v1/fonts/list

When creating templates in the ReportingCloud editor, all fonts are listed in the font drop-down in the Home ribbon tab:

All Google Fonts now available in ReportingCloud

Test this on your own and create a ReportingCloud trial account today.

Happy coding!

New ReportingCloud MergeSettings option: Merge HTML content into merge fields

Björn Meyer

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


One of the most requested features for ReportingCloud is a way to merge formatted content into merge fields. We have added this feature to the API and rolled it out last weekend.

The MergeSettings object used in the Merge method received the new property mergeHtml that specifies whether field data can contain formatted HTML content or not.

If this property is set to true, field data can contain simple HTML formatting such as <strong>, <em> and <u>. The complete field data string must be enclosed in an <html> tag element:

In most cases, this feature has been requested to merge formatted comments into templates. Consider the following sample template:

New ReportingCloud MergeSettings option: Merge HTML content into merge fields

The following code uses the ReportingCloud .NET Wrapper which is available as a NuGet package:

The screenshot below shows the formatted HTML that has been merged into the merge field:

New ReportingCloud MergeSettings option: Merge HTML content into merge fields

The initial font name, font-size, color and font background color will be maintained on updating the text during the merge process.

Test this on your own and create a ReportingCloud trial account today.

Happy coding!

AutoCorrect using TX Text Control and TX Spell .NET

Björn Meyer

Blogged by Björn Meyer on August 17, 2017 and tagged with sample, windows forms, tx spell .net.


AutoCorrect can be very annoying on a smartphone - we all know this. But if you are used to it and then start typing on a computer keyboard, you are missing this time saving feature.

AutoCorrect using TX Text Control and TX Spell .NET

TX Spell .NET provides a very powerful spell checking and suggestion engine that can be used to implement AutoCorrect with a few lines of code:

Based on the analysis of thousands of test documents, the expected suggestion is ranked at position 1 or 2 in more than 97% of all cases. The algorithm includes the measurement of the distance between the keys on the currently used keyboard. Many different factors are evaluated and rated to create the accurate list of suggestions.

Essentially, the KeyPress event is used to trap keystrokes when a delimiter such as a space, a '.' or a ',' is typed in. Afer that, the misspelled word at the current input position is checked and replaced with the first suggestion of the TX Spell .NET suggestion engine.

This implementation checks also, if you intentionally typed a word incorrect. The second time you "correct" the correction, AutoCorrect is not applied to the same word again.

AutoCorrect using TX Text Control and TX Spell .NET

Happy coding!

Quick tip: Merging cells in tables

Björn Meyer

Blogged by Björn Meyer on August 14, 2017 and tagged with windows forms, wpf, tables.


Cell merging is a very easy task using TX Text Control. The method MergeCells of the Table object merges all selected table cells in a table.

In order to select the desired table cells, the Select method can be used. Adjacent cells can be merged horizontally, vertically and both:

Horizontal:

Quick tip: Merging cells in tables

Vertical:

Quick tip: Merging cells in tables

Block:

Quick tip: Merging cells in tables

The following code shows how to use the Select method to select a block of cells from row 1 to row 2 and column 2 to column 3:

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!

Older blog entries

 
 
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