Wordlayout+ and Rich Text Content Controls

As mentioned in my previous post, the full functionality of Rich Text Content Controls (RTCC) is now available with Wordlayout+. In standard Wordlayout, RTCC could also be used, in fact, but more or less only in the same way as plain text content controls. RTCC offer almost unlimited possibilities, because the content of a RTCC can be rather anything (except other RTCC), for example text lines, pictures, tables and whole Word documents. Indeed, the content of an RTCC is stored as a small Word document in Flat Open XML format (see for example https://blogs.msdn.microsoft.com/ericwhite/2008/09/29/the-flat-opc-format/)

I will give you now an exciting example, about the possibilities of RTCC with Wordlayout+…… Consider the following Word document:

rt_sampledoc

This has been created with a sample NAV report together with Wordlayout+. The layout of the report is not too complex:
rt_samplelayout

In fact, it consists of a repeater around a single table row. In the first column of the table is a plain text control bound to text variable hl1 and with property “Allow multiple paragraphs” set to true for manual line breaks. In the second column is a RTCC bound to the text variable hl2.

And here is the report design:
rt_samplereport

The Integer DataItem is filtered to Number=FILTER(1..5) to show five lines of output.

And here is the code of the report:
rt_samplereport_code

For the manual line break in the first column’s plain text control, the crlf variable has been defined. The line break of the RTCC is accomplished with a function called from Codeunit WLMgt – Wordlayout Mgt.

The sample report together with the codeunit (NAV 2016) can be downloaded here:

https://cldup.com/C0ly5S9c8i.zip

Note, that you need Wordlayout+ to run the report with the expected result. Wordlayout+ can be downloaded from the previous blog post.

The main advantage of the RTCC is the dynamic space usage. An image content control, for example, always consumes the same space, regardless of it is showing a picture or not. In Wordlayout+ it is shown as an empyt 1 pixel white picture in that case.
Another advantage is, that you can use formatted text (bold, italic) and you can easily implement further features into Codeunit Wordlayout Mgt. to suit your needs.

One thought on “Wordlayout+ and Rich Text Content Controls

  1. Notes:
    – If you get an exception “Invalid parameter” from System.Drawing.Image.FromStream, then most probably the Blob content, you want to output is either empty or in an invalid format (only jpeg, png and bmp is currently supported in Codeunit Wordlayout Mgt. but this could be extended).

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s