HTML and Rich Text Format in Dynamics NAV Reports

Using Reports ForNAV, you can add HTML and Rich Text Format (RTF) content to your reports. This means that you can write HTML and RTF directly in the Designer, or you can use content stored in your NAV database.

 

Editing HTML in the Designer

You can add HTML to your reports by using the label control. When you add a label and click the Assist Edit, the Label Tasks window opens. Here you can edit the multilanguage caption.

In the next window, to add a language caption, click Add.

 

To open a text editor, in the Text field, click

In the Text Editor, remember to use the drop-down button and select Save As HTML if you want to preserve the images and text formatting.

 

You can use other save formats if you prefer them to HTML.

 

Merging Data and Using Source Expressions

You can merge data or use complete source expressions in line with your HTML content.

On the Insert tab of the editor, to show the normal editor for source expressions, click Fields. Here you can choose fields from data items and the current report. These source expressions are evaluated when the report runs and will blend in with the rest of your content.

 

Using HTML and RTF from the Database

In addition to the editor shown previously, you can also use HTML and RTF stored in the Microsoft Dynamics NAV database. This data is typically stored in text or BLOB fields.

Adding a field in the report with HTML is almost as simple as adding any other field. You drag the field to the report. The report might need a little help understanding the content of your field. The field itself can contain different types of text such as RTF, HTML, or plain text. Therefore, it looks at the first characters and tries to determine the type of text in the field.

The report assumes that HTML content starts with the <!DOCTYPE prefix and RTF contents starts with {\rtf1\ prefix. Consequently, if you have HTML in your database that does not start with this prefix, you simply add it in the source expression.

For example:

‘<!DOCTYPE>’ + Item.”HTML Description”

 

Note

The HTML functionality is available from version 3.0.0.1440 and later.

 

HTML Tag Support

Supported Tags

The table below lists HTML tags supported by the ForNAV label control. External links are currently processed for inline pictures and style sheets (css files). The ID and Class attributes are interpreted for all tags, including the unlisted ones. These attributes are used to specify a style applied to the document part defined by a certain tag.

Tag

Attribute(s)

Notes

a

   

b

   

base

   

basefront

size
color
face

 

big

   

blockquote

   

br

   

center

   

code

   

div

page-break-before
page-break-after
page-break-inside
background-color

Only if set to always.
Only if set to avoid.
Only if set to avoid.

font

size
color
face

 

hr

   

h1-h6

align

 

head

   

html

   

i

   

img

align
scr
height
width

If not specified, the image is considered as inline.

li

type
value

 

link

href
type
media

 

meta

   

ol

type
value
align

 

script

 

Text inside this tag is ignored.

small

   

span

   

strike

   

strong

   

style

   

sub

   

sup

   

table

align
bgcolor
border
bordercolor
cellpadding
cellspacing
width

 

td

align
bgcolor
bordercolor
colspan
height
nowrap

rowspan
valing
width

Supported in the Internet Explorer only.

Sets the TableCellPropertiesBase.NoWrap property.
RichEditControl’s interpretation of this attribute is different from the HTML browser.

th

any allowed

 

tr

align
bgcolor
bordercolor
height
valign

Supported in the Internet Explorer only.

title

 

Text inside this tag is ignored.

u

   

ui

   

Unsupported Tags:

  • <base> tag with href attribute;
  • <div> tag with border, align and float css attribute;
  • <li> tag with list-style-image css attribute;
  • <margin> tag;
  • <tab> tag;
  • <table> tag with cols attribute;
  • <td> tab with bordercolor and nowrap attributes;
  • !important declaration;
  • word-wrap and break-word css properties;
  • css3 shapes;

<ui> tag with type attribute.