Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying HTML Fields

Status
Not open for further replies.

matt300

Technical User
Dec 8, 2004
6
GB
I have a database field which is in HTML I would like to display this on a report (Crystal Reports 9).
I have turned on HTML interpretation unfortunatly this displays the text with with font settings which are in the HTML. I would like this text to be displayed in a standard font ie verdana
as per the users requirements.

Does anyone know how I can overide the HTML settings? obviously if I turn of the HTML Interpretation then I will get all the HTML encoding.

Thanks in advance.
 
Hi,
I'm confused ( not a rare thing ) - You want HTML but only some of it??

Maybe you could the Replace function to change the font tag --





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi sorry did not mean to confuse.

I have a field called notes. This is in HTML. I just want to display the text of this notes field without any HTML formatting as I want CR9 to display the text in the same font as the rest of the report.

ie.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<STYLE type=text/css> P, UL, OL, DL, DIR, MENU, PRE { margin: 0 auto;}</STYLE>

<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY leftMargin=1 topMargin=1 rightMargin=1><FONT face=Tahoma size=2>
<DIV>Display this text</DIV></FONT></BODY></HTML>

I would want displaying as
Display this text

I would then let CR9 apply any formatting to the font.

Thanks again.
 
As Turk suggested, you might just be able to use the Replace() function to look for and replace any FONT tags. Another option would be to try to get rid of all of the tags. The STYLE tags would have to be handled differently, but for the rest, you could loop through the field until all of the tags are gone:
Code:
StringVar tmp := {Table.Field};
NumberVar LPos;
NumberVar Rpos;
StringVar Repl;

//First, deal with any STYLE tags
while InStr(tmp,"<STYLE") > 0 do(
  LPos := InStr(tmp,"<STYLE");
  RPos := InStr(tmp,"</STYLE>") + 7;
  Repl := Mid(tmp, LPos, RPos - LPos + 1);
  tmp := Replace(tmp, Repl, ""););
//Next, get rid of any remaining tags
while InStr(tmp,"<") > 0 do(
  LPos := InStr(tmp,"<");
  RPos := InStr(tmp,">");
  Repl := Mid(tmp, LPos, RPos - LPos + 1);
  tmp := Replace(tmp, Repl, ""););
tmp;
With the given example, this formula should work.

-dave
 
Thanks all for your prompt response I will do a replace on all the tags.
I was wondering if there would be any quicker way of doing this but obviously not.

Thanks again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top