Formatting fields

<< Click to Display Table of Contents >>

Navigation:  Delphi HTML Report Library > Tables >

Formatting fields

To specify format of a fields use “format” attribute of a FIELD tag.

For numeric fields, format are same as for Delphi FormatFloat function, for date fields – as for FormatDateTime function.

By default, numeric fields uses # ### ### ##0.## format.

 

Alignment of fields could be specified by align  (left, right, center) attribute. Right is default alignment for numeric fields and left for all others.

 

“empty” attribute could be used to set default value for empty cells.

 

Complex formatting of a field could be perfomed by a template-cell template.

Default cell template looks like

 

<td {{{attributes}}}>{{value}}</ td>

 

In the template you can use variables and cycle pseudo-sections, for example, you can make text bold only in first row:

 

   {{#-first}}<b>{{/-first}}

    {{value}}

   {{#-first}}</b>{{/-first}}

 

Also field can be formatted using template attribute. In this attribute # is substituted by current cell value and @FIELD@ by field value.

 

To use HTML formatting in a cell value, set FIELD.html attribute to true. Field value will be placed to the output HTML without encoding of special HTML symbols.