Stimulsoft Reports has the ability to format text using standard HTML formatting tags.


Important: Only a limited range of HTML tags are supported - for example you cannot use div span.  If you need to achieve bullet points or numbers within your text your choices are to enter them manually or to use the RTF text editor component.


Sometimes it is necessary to make part of a text expression look Bold, Italic, or Underlined. For example you may wish to achieve something like this:



The fifth word is bold



HTML tags can help achieve this. The output shown above could be generated using the following expression:



The fifth word is <b>bold</b>



It is possible to get a similar result without using HTML by using the Rich text component, but there are some difficulties and the Rich text component works very slowly, so using HTML tags is often the best way to achieve the desired result.


HTML tags can be included only in the text part of expression, in other words their use is possible only in the Text property of the Text component.


Important: HTML tags can be included only in the text part of an expression.


For example, the following expressions are correct:



This is a simple <i>expression {1+2}</i>


This is a simple <i>expression</i> {1+2}


This is a simple expression <i>{1+2}</i>



These expressions however are incorrect:



The is a simple <i>expression {1</i>+2}


The is a simple <i>expression {1+2</i>}


The is a simple expression {<i>1+2}</i>



In the examples above the HTML tags are placed within the body of an expression that will be calculated by C# or VB.Net, shown by the curly braces, so they are impossible to process.


Important: Do NOT place HTML tags inside the curly braces of any expression or the expression will fail.


Available Tags

There are few limitations  - most valid HTML style tags can be inserted, with the exception of ordered list and unordered list tags.  If you need to generate such lists you can use the Rich Text control or create the layout manually.


Important: You cannot use Ordered and Unordered List tags within expressions.


HTML tags can be nested to an unlimited depth. For example:



This is a <b>simple <i>expression {1+2}</i></b>



If a tag is not closed, then the tag works to the end of the text line.


If HTML tags are used in a text expression then any line breaks in that expression are ignored. If you need to enforce a line break in your text, use the <br> tag.


Note. Use the <br> tag to break a line when using HTML tags.


Activating HTML Tags

It is important to know that by default HTML tags in expressions are simply ignored. To allow the use of HTML tags it is necessary to set the AllowHtmlTags property of the Text component to true.


Important: Set the AllowHtmlTags property to true to allow the use of HTML tags in the text expression.