Solved

crystal reports and HTML Tags

Posted on 2012-03-27
8
702 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now