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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html formatting

Status
Not open for further replies.

swiss2007

Technical User
Aug 13, 2007
92
US
I have a crystal report designed using crsystal reports V11.
A few fields in the database are stored in html tags.

When I show these fields in the report, the html format is showing
up.

When I right click on the fields ----> Format field ----> Paragraph
----> Text interpretation ----> HTML Text

the html tags are gone but the formatting is still not accurate.
I also tried using crHTMLText in Format editor.

For ex, line break concatenates all the values within a field.
underlined formatting is gone.
Bold formatting is gone.
Color coding formatting is gone.

Is there any way to retain these formattings in crystal reports.

Thanks.


 
I think you need to provide several samples of the field before and after you add the HTML text formatting so we can see what tags are being used, and which ones are failing.

-LB
 
Thanks lb.

I have the following text field in the application in 4 lines
A
B
CD
EFG

No matter how I format the field in the front end application, in crystal report when I set the field formatting to html text, it shows up as ABCDEFG without the tags and other formatting like line break, Italics, underlines are lost .

Below are the examples as to how the above text is stored in the database.
Without any formatting:
A<br /> B<br /> CD<br /> EFG<br />

If underlined
<span style="text-decoration: underline;">A<br /> B<br /> CD<br /> EFG</span><br />

If Italics
<span style="font-style: italic;">A<br /> B<br /> CD<br /> EFG</span><br />


If Bold
<span style="font-weight: bold;">A<br /> B<br /> CD<br /> EFG</span><br />

if numbered
<ol> <li>A</li> <li>B</li> <li>CD</li> <li>EFG</li></ol>

if bulleted
<ul> <li>A</li> <li>B</li> <li>CD</li> <li>EFG</li></ul>

If underlined, Italics and Bold, then its saved as
<span style="font-style: italic; font-weight: bold; text-decoration: underline;">A<br /> B<br /> CD<br /> EFG</span>
 
I did the following for a field I processed for reporting a few months ago.. I ADMIT, for anyone reading this, I am sure there is a better way to do it but I needed it quick and only for two fields and this worked for me!!!
Tried to add the modifications for your application..

create a formula ---
Code:
replace(                  //remove spaces 1
replace(                  // replace <br /> with a line feed 1
mid({@wirk},instr({yourhtmlfield},';">')+3,(instr({yourhtmlfield},'</span>')-instr({yourhtmlfield},';">')-3))       // get string before and after htm format tags
,"<br />",chr(10))       // replace <br /> with a line feed 2
," ","")                 // remove spaces 2

place in details
right click
format field
select font
click the formula button on the right next to style and enter this code
Code:
if instr(left({yourhtmlfield},instr({yourhtmlfield},';">')),"italic")>0 
    and
    instr(left({yourhtmlfield},instr({yourhtmlfield},';">')),"bold")>0 
        then crbolditalic
else if instr(left({yourhtmlfield},instr({yourhtmlfield},';">')),"italic")>0 then critalic
else if instr(left({yourhtmlfield},instr({yourhtmlfield},';">')),"bold")>0 then crbold

right click field again
format field
select font
click the formula button on the right next to underline and enter this code
Code:
instr(left({yourhtmlfield},instr({yourhtmlfield},';">')),"underline")>0

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
my apologies.. that was my field ... rpelace with yours ,.... {yourhtmlfield}

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top