Skip to main content
13-Aquamarine
August 22, 2024
Question

How to use HTMLTextFilter.filterHTMLText() to filter HTML Tags from Formatted or Rich Text.

  • August 22, 2024
  • 10 replies
  • 2042 views

Requirement is in Report I want same structured Description as I have on CN : 

--> I have Description on CN like :

This is New CN to make Changes in Part ,
• Do the Proper Marking on Parts
• Update the associated parts as well

 

--> Output I am getting after using that API is :

<p>This is New CN to make Changes in Part ,<br clear="none" />• Do the Proper Marking on Parts<br clear="none" />• Update the associated parts as well</p><p> </p>

 

--> For that I am using below API but it is not working as expected  :

 HTMLTextFilter.filterHTMLText(cn.getLongDescription().getRichText().toString(),
"com/ptc/core/richtext/jasperrichtextfilter.xsl", true, false);

 

 

 

10 replies

HelesicPetr
22-Sapphire II
August 23, 2024

Hi @@_1647 

So you have correct output with HTML tags don't you?

the HTML text filter class may not work as you wish.. Use different method for HTML formatted input. 

 

You could have described your expectation. 

PetrH

@_164713-AquamarineAuthor
13-Aquamarine
August 23, 2024

We don't want output with tags.

We want output the way we have on WC UI.

But in ootb Jasper report also they are using same class : HTML text filter 

And I copied same method and providing correct required arguments as well .

But Here we don't get any error.

 

@_164713-AquamarineAuthor
13-Aquamarine
August 23, 2024

Required Output in is as bellow well structured:

 

This is New CN to make Changes in Part ,

• Do the Proper Marking on Parts

• Update the associated parts as well