Solved

crystal reports and HTML Tags

Posted on 2012-03-27
8
707 Views
Last Modified: 2012-04-07
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!
0
Comment
Question by:SISDalia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37774699
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
 
LVL 35

Assisted Solution

by:James0628
James0628 earned 500 total points
ID: 37775279
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
 

Author Comment

by:SISDalia
ID: 37778906
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:SISDalia
ID: 37779101
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
 
LVL 35

Expert Comment

by:James0628
ID: 37780446
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
 

Accepted Solution

by:
SISDalia earned 0 total points
ID: 37797090
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
 
LVL 35

Expert Comment

by:James0628
ID: 37799434
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
 

Author Closing Comment

by:SISDalia
ID: 37818674
solution needed to be tweaked a bit as original didn't solve the problem.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Send email using HTML and PHP in separate file 5 39
Text too large in Chrome 17 60
Record locking on classic ASP 3 38
How to pass values to HTML-5 attribute dynamically? 24 45
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question