Solved

crystal reports and HTML Tags

Posted on 2012-03-27
8
705 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
  • 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 34

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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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 34

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 34

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 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