QlikTip #39: Displaying Html content within QlikView (Minimalistic HtmlTextBox Object Extension)

Abstract and Motivation

By default QlikView’s TextBox object does not interpret Html content. It will just show the full Html code loaded into the TextBox object. This also does not change if you are using the WebClient (Ajax client or Mobile client).

This article shows how easy this can be achieved by creating a simple object extension.

Minimalistic HtmlTextBox Extension

I call this extension “Minimalistic HtmlTextBox Extension” because I could think of a lot of nice features which could be implemented for such a control. But for the first step let us just display Html …

After deploying the object extension to the appropriate directory create a new sheet object using the context menu in either the Ajax client or within the QlikView Desktop (using WebView):

Just drag and drop this object type to your existing sheet.
The next step is easy:

  • Either enter a static string containing the Html
  • or define a field in your data modell into which you have loaded your Html content from any datasource.

Example static string:


='<b>This is the header</b><br/><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>'

This will result into:

Example using a field:

 =Only(FieldWithHtml)
 

You can certainly use more advanced formattings like the following example:

Scrolling:

If the QV object is not large enough horizontal and vertical scrollbars will be displayed automatically:

Properties:

The following properties will be copied from the QV-object to control responsible for displaying the Html content:

  • height and width
  • Font size, family (if not overruled by CSS within the Html code

Ideas for Improvements

There are a lot of possibilities how this could be improved:

  • Stylesheets: Add a possibility to reference style sheets
  • Other formatting: Support not only Html but for example also BBCode or Wiki formatting
  • Security: Remove Javascript and other possible harmfull code !!!

Download “Minimalistic HtmlTextBox” Extension:

MinimalisticHtmlTextBox on GitHub (5 KB)

Tested on:
QlikView 11 SR1, Windows 7 x64, Internet Explorer v9, Firefox v14, Google Chrome v21

Bookmark and Share

and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

22 Comments