crystal reports and HTML Tags

I have an asp.net web application.  On one of my pages, I have a text area that displays a very long text field.  That text field has HTML formatting.  

Here is a sample of what it looks like:

She traveled to her homeland, Ethiopia, during the summer after her first year of medical school, where she volunteered at Mother Teresa Hospital and provided care to an impoverished group of patients.<br><br>Gezman is currently working on her senior thesis with a focus on African American women and HIV. Her excellent clinical and interpersonal skills and her mastery over content materials are evident in the outstanding three Letters of Distinction she received in Family Medicine, Primary Care Continuity Clinic, and Psychiatry which, in a pass/fail grading system, are our way of acknowledging a truly extraordinary performance on the required clerkships. She has further distinguished herself with a <b>USMLE Step 1 score of 234.</b><br><br>

I also have a crystal report that displays the above text field data.  When I run that crystal report, the HTML formatting is interpreted correctly and formatting shows (line breaks and bolding).

However, if the user makes any changes to the field in the text area. The HTML formatting changes to
 She traveled to her homeland, Ethiopia, during the summer after her first year of medical school, where she volunteered at Mother Teresa Hospital and provided care to an impoverished group of patients.<br />  <br />  Gezman is currently working on her senior thesis with a focus on African American women and HIV. Her excellent clinical and interpersonal skills and her mastery over content materials are evident in the outstanding three Letters of Distinction she received in Family Medicine, Primary Care Continuity Clinic, and Psychiatry which, in a pass/fail grading system, are our way of acknowledging a truly extraordinary performance on the required clerkships. She has further distinguished herself with a <strong>USMLE Step 1 score of 234.</strong>
<br /><br />  

When that happens, crystal can no longer display the text with the formatting.  

How can I resolve this issue.  Can I control how the text area changes the <br> to <br /> or the <b> to <strong> or alternatively, anything I can do so that crystal is able to understand the modified HTML tags?

Please advise!
SISDaliaAsked:
Who is Participating?
 
SISDaliaConnect With a Mentor Author Commented:
I couldn't get the <BR> to work properly. I ended up replacing the <br/>'s with a <p>

That seemed to work a little better.  However, conceptually speaking the replace in was a good solution.

so I changed Replace (Replace (Replace ({ado.UniqueCharacter}, "<br />", "<br><br>"), "<strong>", "<b>"), "</strong>", "</b>")

to

Replace (Replace (Replace ({ado.UniqueCharacter}, "<br />", "<p><p>"), "<strong>", "<b>"), "</strong>", "</b>")
0
 
mlmccCommented:
I don't know what you mean.

When you say changes to the text field do you mean size?

Are they changing the text in the box?

How is it passed to the report?

mlmcc
0
 
James0628Connect With a Mentor Commented:
I think what SISDalia is saying is that when someone makes a change to the text (eg. corrects a misspelled word), the <br> tags get changed to <br />, and <b> and </b> get changed to <strong> and </strong>.

 Assuming that I'm correct, I have no idea why those tags are being changed.  You would have to look at whatever is being used to edit the text.  If that can be changed so that it doesn't change those tags, that would probably be the best solution.  If you can't do that, I don't think you have any control over the HTML tags that CR understands, but it might be possible to create a formula in CR that would replace the "bad" tags with ones that CR understands.  That would require knowing exactly which tags are being changed and exactly what they're being changed to.

 For your specific examples, a formula like this might work:

Replace (Replace (Replace ({your HTML field}, "<br />", "<br>"), "<strong>", "<b>"), "</strong>", "</b>")


 You would put that formula on the report instead of your HTML field.

 James
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
SISDaliaAuthor Commented:
thanks, I used that in a formula field. The replace is working and both strong is replaced by <br> and <strong> is being replaced by <b>.  

However, for some odd reason, the breaks are still not being interpreted correctly.
I have two <br><br> and it is only giving me one line break.

I've even tried putting four of them <br><br><br><br> and still the same result.

Any ideas what could be going on? I'm attaching a file that has the data in my field.

Also, here is the replace statement you suggested:

Replace (Replace (Replace ({ado.UniqueCharacter}, "<br />", "<br><br>"), "<strong>", "<b>"), "</strong>", "</b>")
uniquecharacter.doc
0
 
SISDaliaAuthor Commented:
I thought I should do a quick test using SSRS to see how my field displays.

If the SSRS will interpret the Html formatting correctly..but it doesnt.

See attached file for how my filed displays in SSRS.
UniqueCharacterinSSRS.PNG
0
 
James0628Commented:
You said "The replace is working and both strong is replaced by <br> ...".  I assume you meant that <br /> (not strong) is replaced by <br>.

 I don't know why you might be having problems with <br>.  I assume that you're saying that <br><br> gives you two breaks on the report at first, but after the field is edited and you change the <br /> strings back to <br>, you don't get two breaks anymore?  If so, then maybe something else is being changed when the field is edited.

 If <br><br> never gives you two breaks on the report (including when the field has not been edited), that's presumably a separate issue (not related to the editing), and maybe that's just a product of how CR interprets HTML, in which case there may not be much that you can do about it.  You could try adding a space (you might have to use &nbsp) after every <br>, but even if that gives you the two breaks, it might affect the formatting in other ways that you don't want.

 You probably already know this, but, FWIW, if you want to look at the HTML codes in the field, or check the results from the Replace functions in that formula, you can turn off HTML interpretation for the field.

 I'm not sure what you were trying to say about SSRS, but I've never used it, so I don't really know anything about it.

 James
0
 
James0628Commented:
If <br><br> worked before the edit, I don't know why it wouldn't work after, but at least you found a workaround.

 James
0
 
SISDaliaAuthor Commented:
solution needed to be tweaked a bit as original didn't solve the problem.
0
All Courses

From novice to tech pro — start learning today.