Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     How to strip HTML from data content to display in PDF report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to strip HTML from data content to display in PDF report
 Login/Join
 
Expert
posted
I have some data that must be displayed in a PDF report. The data contains HTML tags because it is also displayed in HTML pages. I need to strip the HTML tags before displaying it in the PDF report. The issue is compounded by the fact this is a compound PDF report - I had originally thought using HTMLFORMTYPE=PDF would work, but it doesn't, and even if it did, how would I combine that HTMLFORMTYPE code with the rest of the compound PDF components.

Any ideas?

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Can you give a sample of the HTML and the complexity of the size, etc ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
An example:

<FONT color=#000000><P><FONT color=#000000>Results are closed as of January 31, 2011. </FONT></P><P><FONT color=#000000>Zzzzz xxx dddd rrrr tttt. QQQQQ ffff. Tgggggggg ddddd lllll dddddddd rrrrrrr.</FONT></P><P>test21</P></FONT>


I'm looking into using an Oracle function, perhaps this might be easier on the database side...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Is it a single line of HTML or multiple, and how will the be needed ?

I have an idea.

The basics is to TABLE, and use STRREP the < and > characters to {crlf}< and >{crlf}.
Save to a file. Reread with a new master, then toss all lines that have < or > or are blank.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
How about adding a -IF [FORMAT] EQ 'PDF' THEN 'one thing' ELSE 'another thing'?


WF 7.7.04, WF 8.0.7, Win7, Win8, Linux, UNIX, Excel, PDF
 
Posts: 175 | Location: Pomona, NY | Registered: August 06, 2003Report This Post
Member
posted Hide Post
I had the same need so I wrote an SQL procedure to handle it. Here is the code I used:
Create PROCEDURE striptags
 (IN Dirty varchar (4000),
  OUT Clean varchar (4000))
language sql
Begin
 Declare @Clean VARCHAR(4000);
 Declare @Start int;
 Declare @End int;
 set @Clean=Dirty;
 While locate('<', @Clean) > 0 And
      locate('>', @Clean)>0 DO
  Set @Start = locate('<', @Clean);
  set @End = locate('>', @Clean);
    if @start=1 THEN
      set @Clean= substr(@Clean,(@END+1),(length(@Clean)-@end));
    ELSEIF @start>1 and @start<length(@Clean) THEN
      set @Clean=substr(@Clean,1,(@start-1))||
        substr(@Clean,(@end+1),(length(@Clean)-@end));
       elseif @end=length(@Clean) then
        set @Clean=substr(@Clean,1,(@start-1));
      END IF;
     END while;
 set Clean=@Clean;
END


WF 7.7.02
iSeries/Windows
 
Posts: 8 | Registered: December 02, 2011Report This Post
Expert
posted Hide Post
I tried to keep it somewhat simple by using the Oracle PL/SQL regexp_replace function:

SQL SQLORA
select
regexp_replace ( regexp_replace ( comment_text, '&|nbsp;', ' ', 1, 0, 'i' ), '<[^>]*>', ' ' ) as comment_text
from report_comments
where report_cde = 'report1'
and section = 'status'
and line_num = 1
;
TABLE ON TABLE HOLD AS HCOMMENT1
END


But, of course, it's not so simple as I have three nested function calls! And I just realized this does not take care of &nbsp; and other like HTML character entities...

(Updated with simplified code that takes care of HTML tags and &nbsp; - which is good enough for me...).

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Why didn't I think of this before.

How about MARKUP.

DEFINE FILE CAR
TAGGEDLINE/A300 = '<FONT color=#000000><P><FONT color=#000000>Results are closed as of January 31, 2011. </FONT></P><P><FONT color=#000000>Zzzzz xxx dddd rrrr tttt. QQQQQ ffff. Tgggggggg ddddd lllll dddddddd rrrrrrr.</FONT></P><P>test21</P></FONT>';
END
 
TABLE FILE CAR
HEADING
"<TAGGEDLINE"
PRINT COUNTRY
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
 TYPE=REPORT, MARKUP=ON, SIZE=9, ORIENTATION=LANDSCAPE, $
ENDSTYLE
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
I found an old post where you revealed MARKUP to the world! Unfortunately it doesn't take care of hyperlinks and there's a mailto hyperlink in the text Frowner


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Well there was always that chance that all the tags were not going to be removed/evaluated.

Back to the oracle function I guess.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
Does the data have to contain the html tags?

Usually in the reports, I do what alex says.

-IF [FORMAT] EQ 'PDF' THEN 'one thing' ELSE 'html tag'?


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Report This Post
Expert
posted Hide Post
"Does the data have to contain the html tags?"

The data is designed to be displayed in HTML and contains HTML. I now need to show it in PDF.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     How to strip HTML from data content to display in PDF report

Copyright © 1996-2020 Information Builders