This recipe demonstrates how data with HTML tags is retrieved for rendering in a report template using a HTML Callback. It also shows how certain HTML parameters are updated at the composite datasource level using regular expressions. Another point to take note would be setting the Image Resolution property of the Callback to at least 300 dpi to achieve print quality.
Steps taken:
- Create a composite datasource (Strip-Tags_CMP.ds) using “Derivative”, to get rid of the tags from the tabular datasource (data.ds). Enter the following script into the “Derivative Properties > JavaScript” tab:function removeTagsActions()
{
//var getActs = Actions.replace(/|<([^>]+)TEXT([^>]+)>|||<([^>]+)FONT>/ig,’’);
var getActs = Actions.replace(/|<([^>]+)TEXT([^>]+)>|/ig,’’);
getActs = getActs.replace(/10/g, “2”);
getActs = getActs.replace(/<([^>]+)P>/ig,"
“);
return getActs;
}function removeTagsAgenda()
{
//var getAgens = Agenda.replace(/|<([^>]+)TEXT([^>]+)>|||<([^>]+)FONT>/ig,’’);
var getAgens = Agenda.replace(/|<([^>]+)TEXT([^>]+)>|/ig,’’);
getAgens = getAgens.replace(/10/g, “2”);
getAgens = getAgens.replace(/<([^>]+)P>/ig,”
“);
return getAgens;
}function removeTagsParticipants()
{
//var getPars = Participants.replace(/|<([^>]+)TEXT([^>]+)>|||<([^>]+)FONT>/ig,’’);
var getPars = Participants.replace(/|<([^>]+)TEXT([^>]+)>|/ig,’’);
getPars = getPars.replace(/10/g, “2”);
getPars = getPars.replace(/<([^>]+)P>/ig,”
“);
return getPars;
}function removeTagsMins()
{
//var getMins = Minutes.replace(/|<([^>]+)TEXT([^>]+)>|||<([^>]+)FONT>/ig,’’);
var getMins = Minutes.replace(/|<([^>]+)TEXT([^>]+)>|/ig,’’); getMins = getMins.replace(/10/g, “2”);
getMins = getMins.replace(/<([^>]+)P>/ig,”
");
return getMins;
} - Create a report template (test-Template.rml) with “HTML Callback” elements to read contents without tags from the composite datasource.
To download the necessary files for this recipe, refer to the attached ZIP file.
RenderReportWithCallbacks.zip (6.4 KB)