Home
Analytics
How to display dynamic text HTML with no formatting
BirtCalgar
I am printing some rich text from the database using HTML format dynamic text.
The text is displayed perfectly with color bolding, etc. However, the client wants the text displayed using the same font as the rest of the PO. (ie. no color, bolding, etc)
If I choose auto or somthing other than HTML then I see the formatting codes.
Is there any way the rich text can be displayed with a font of my choosing?
Thanks
Find more posts tagged with
Comments
Clement Wong
You need to strip out the HTML formatting, and there are several approaches to this. Here are a few options:<br />
<br />
Option 1: Depending on the database you are using, you can change the SQL query to output a new column as raw text using a predefined function or string substitutions. For example, if you have SQL Server, there is a sample UDF to remove the HTML tags @ <a class='bbc_url' href='
http://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/'>http://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/</a><br
/>
<br />
Option 2: In your BIRT design, use a dynamic text control, and strip out the HTML formatting using a Javascript search/replace. Please note that this covers basic tags, and further testing with your data is required.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>row["yourTextField"].replace(/<(?:.|\n)*?>/gm, '');</pre>
Then, you can change your control with the font that matches the rest of your report.