How can I add HTML formatting to a Freeform report?

Document ID : KB000010754
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

This is a simple example of how you can add HTML formatting to a Freeform report

Instructions:

1.     Quick examples

1.1.  HTML Links

SQL:

select '<B><a href="http://google.com/">www.www.www</a></B>' as Customer, '<B><I><font color=red>' || t.CUSTOMER_ID || '</font></I></B>' as ID from T_CUSTOMERS t where customer_name like '%C%'

 

or

 

select '<a href="http://google.com/">  '||customer_name||' </a> ' as Customer, '<B><I><font color=red size = +4>' || t.CUSTOMER_ID || '</font></I></B>' as ID from T_CUSTOMERS t

 

Connection string:

dsn=oblicore;uid=oblicore;pwd=oblicore

 

Parameters:

 

<custom>

    <chart>

           <precision> 5 </precision>

    </chart>

    <ContainsHTML>1</ContainsHTML>

    <!--<headstyle>

     <titlerow bgcolor="value or color name"></titlerow>

     <firstcolumn bgcolor="value or color name"></firstcolumn>

    </headstyle>-->

</custom>


1.2.  HTML Links to images

SQL:

select '<b><a href="http://mad.walla.co.il/archive/198734-5.jpg"> ' || t.CUSTOMER_NAME || ' </a></b>' as Customer, t.CUSTOMER_ID as ID from T_CUSTOMERS t

 

Connection string:

dsn=oblicore;uid=oblicore;pwd=oblicore

 

Parameters:

<custom>

    <chart>

           <precision> 5 </precision>

    </chart>

    <ContainsHTML>1</ContainsHTML>

    <!--<headstyle>

     <titlerow bgcolor="value or color name"></titlerow>

     <firstcolumn bgcolor="value or color name"></firstcolumn>

    </headstyle>-->

</custom>

1.3.  HTML Font sizing and colors

SQL:

select '<font size = +2>'  || t.sys_config_name || '</font>' as Name , t.sys_config_id, t.sys_config_parent from t_system_configurations t

 

or:

 

select '<a href="http://google.com/">  '||customer_name||' </a> ' as Customer, '<B><I><font color=red size = +4>' || t.CUSTOMER_ID || '</font></I></B>' as ID from T_CUSTOMERS t

 

Connection string:

dsn=oblicore;uid=oblicore;pwd=oblicore

 

Parameters:

<custom>

    <chart>

           <precision> 5 </precision>

    </chart>

    <ContainsHTML>1</ContainsHTML>

    <!--<headstyle>

     <titlerow bgcolor="value or color name"></titlerow>

     <firstcolumn bgcolor="value or color name"></firstcolumn>

    </headstyle>-->

</custom>

2.     Advanced HTML guide HTML Links

2.1.  Overview

 

New additions described in this document are aimed to give to user the ability to represent certain data with easy styling/linking by some HTML definitions in data table of freeform report. Rules for these kinds of representation described below.

 

2.2.     HTML in cell data

 

  • Freeform Cell data will support some <limited> HTML definitions
  • The HTML definitions will be eliminated in the CSV & CSV data only export results, i.e. text only will be exported.
  • HTML (A, B, I, Font) and content will be taken from the freeform query results, fully prepared by user according to described rules below.

·       The Html tags that are supported are: <B> (Bold) , <I> italic , <A href=”ddd”> Link, <Font> font

·       When adding illegal tags (none  of the above) the tags would be shown as text

 For example the output text might look like this

 <I<Text Text </I><G>

(G is illegal tag so the all the sentence shown as text).

All HTML elements must be between the opening and closing anchor tags.

·       There won’t be any check for correct opening or closing of tags. For example:

<B>dgdgdgg</B> :Legal

</B>dgdgdgg<B> :Legal too

<B><I>dgdgdgg<B> :Legal too

·       In addition, some <HEADSTYLE> definitions will become available for the Freeform reports: background color of heading row and background color of first column.

·       The colors will be supported by Export/Send to PDF/HTML and Booklets.

·       Numeric data for column will be recognized automatically for charting, even if the data come in HTML tags, i.e. charts functionality will be kept as before SR4.

·       In all the tags there is no case sensitive validation, thou the tags could be in lower case or upper case.

 

2.3.     Link

·             Clicking on the link will open a page according to the URL in a new window (a new explorer).

·             The link to that address is represented by the text (cell data) between the opening and closing <a> tags.

·             URL address is under user responsibility.

·             Syntax:

 

<A HREF=” http://bestcustomer.com” > || data to be showed || </A>

·             There must be “<a” in the start with out any white space between the ‘<’ and the ‘a’

·             Between the ‘a’ and ‘href=’ there is at least one white space and there could be any other characters (<a bla bla href=www.hh > is Legal).

·             FF Links , by default,  are bold, blue with under link.

·             There is no validation for the URL and it could be with or without any quote marks.

 

 

Query example:

 

“Select '<A HREF=http://bestcustomer.com/?cust=”  ‘ || t.customer_code  || ‘ ”>' || t.customer_name || '</A>' as CustomerName from T_CUSTOMERS t”

 

Html Result:

 

<A HREF=” http://bestcustomer.com/?cust=sap” target=”_blank”>SAP World</A>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2.4.     Bold

 

·             Text should be rendered in bold.

·             Syntax:

“<B>” || data to be showed || “</B>”

 

Query example:

 

“Select '<B>' || t.customer_name || '</B>' as CustomerName from T_CUSTOMERS t”

 

Html Result:

 

·             <B> This text displays boldface. </B>

·             This tag is legal without any white space or extra characters. For example:

·          <B> Legal

·          < B> not Legal

·          <B hfhfhfh> not legal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2.5.     Italic

 

·             Text should be rendered in italic.

·             Syntax:

“<I>” || data to be showed || “</I>”

 

Query example:

 

“Select '<I>' || t.customer_name || '</I>' as CustomerName from T_CUSTOMERS t”

 

Html Result:

 

<I>This text is italic. </I>

 

·             This tag is legal without any white space or extra characters. For example:

·          <I> Legal

·          < I> not Legal

·          <I hfhfhfh> not legal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2.6.     Font

 

·             Text should be rendered according to the attribute of the font tag

·             All font tag attributes are supported.

·             Syntax:

“<Font att1=XXX>” || data to be showed || “</Font>”

 

Query example:

 

“Select '<Font color=red>' || t.customer_name || '</Font>' as CustomerName from T_CUSTOMERS t”

 

Html Result:

 

<Font color=red>This text is red. </Font>

 

This tag must follow this rules:  

·        There must be “<font” in the start with out any white space between the ‘<’ and the ‘font’

·        After that there could be closing tag ‘>’ or at least one space and any other characters.

·          For example the following are Legal:

<Font> legal

<font color=red> legal

<font bla bla> legal

·            But these are not:

       <Font > illegal

<Fonty> illegal

 

 


 

2.7.     Parameters XML

 

·        New tag by the name ContainsHTML will be added to freeform report xml.

·        This definition will take effects on Escaping attributes.

 

  <ContainsHTML>1/0</ContainsHTML>

1 – If user adds HTML to freeform report.

0 – Simple freeform data, like before.
The ContainsHTML definition is optional; the default is 0 (backward compatibility).

 

 

In addition, new elements may be defined at <custom> level:

<custom>

...

     <HEADSTYLE>

           <TITLEROWBGCOLOR="#979797"></TITLEROW>

           <FIRSTCOLUMNBGCOLOR="red"></FIRSTCOLUMN>

     </HEADSTYLE>

...

 

2.8.                         HTML specifications for booklet (RTF) converter

 

HTML element

Minimal attributes

Comments

<B>www</B>

None

Bold

<I>www</I>

None

Italic

<A HREF=”http:// amazon.com”>Amazon</A>

HREF

Link. HREF attibute contains the URL value.

<FONT COLOR=”RED” SIZE=”+2” FACE=”ARIAL”>Good thing</FONT>

COLOR

Face color

SIZE

Font size, either in absolute values (pixels) or relative (+1 or -2)

FACE

Name of font name / family.

 

  • HTML tabs are case insensitive

 

Any combination of HTML elements to be supported.