When displaying notes from Ungerboeck on a Crystal Report, there are two fields available for use from the table CC025_NOTES_EXT.
The first is CC025_NOTE_TEXT. This is just the text of the note that has been entered by the users of Ungerboeck. It can be dropped onto a report like any other field or displayed in a text box.
The second is CC025_HTML_TEXT. This is the note text including any formatting users may have included when entering the note into Ungerboeck including fonts, colors and styles. It must be manipulated before it can be included on the Crystal report.
The first step is to strip out any HTML tags that Crystal Reports may not be able to interpret. USI uses a standard formula for this, which is included in the text file attached to this article. Create a new formula in Crystal Reports using the text in this file.
The second step is to add the field to the report. If you drop the formula onto the report file and run the report, you will notice that all the HTML tags are visible as text. To cause Crystal Reports to display the field properly, right click on the field and select Format Field. Under the paragraph tab, there is a setting called Text Interpretation. Change the dropdown to HTML Text. Now your report will properly display the formatted text.
For both fields of Notes, it will be best to also select the "Can Grow" option of the field as the size of note text can vary greatly.
Comments
11 comments
The problem with this is the Formula provided doesn't quite work for all scenarios, we ended up creating a view that called a Function to strip right back the HTML to only allow bold tags and replace div's with br's.
0 upvotes
I have replaced the formula from the txt file and still displaying an error message of:-
Error in formula note_html: 'stringvar HTMLnote:= {CC025_NOTES.CC025_HTML_TXT}; stringVar colon; NumberVar intPosition :=InStr (HTMLnote, ">"); HTMLnote := Replace (HTMLnote, "<P>", "<BR>")
0 upvotes
Hi Kris-
If this is what you have exactly in your Crystal formula, it looks like the problem is the field name. The field is CC025_HTML_TEXT. You have HTML_TXT. Can you update your formula and give it another try?
0 upvotes
Hi Emily
Sorry Emily its my typing it does read TEXT and not TXT in the message and within my formula but I am still displaying error message when running my report.
Thanks
Kris
0 upvotes
Hi Kris-
Could you please paste in what you are using for a formula?
0 upvotes
Hi Emily
I was using:
stringvar HTMLnote := {CC025_NOTES_EXT.CC025_HTML_TEXT};
stringVar colon;
HTMLnote := Replace(HTMLnote, "<DIV>", "");
HTMLnote := Replace(HTMLnote, "</DIV>", "<BR>");
HTMLnote := Replace(HTMLnote, "<P>", "<BR>");
HTMLnote := Replace(HTMLnote, "</P>", "</BR>");
HTMLnote := Replace(HTMLnote, "<BR><BR>", "<BR>");
"<FONT style='font-size: 8pt'>" & HTMLnote & "</FONT>";
I have replaced it with:
stringvar HTMLnote := {CC025_NOTES_EXT.CC025_HTML_TEXT};
stringVar colon;
NumberVar intPosition := InStr(HTMLnote, ">");
HTMLnote := Replace(HTMLnote, "<P>", "<BR>");
HTMLnote := Replace(HTMLnote, "</P>", "</BR>");
IF inStr(htmlnote, "<FONT") > 0 Then
(
If intPosition > 0 Then
"<FONT style='font-size: 8pt; text-align:center'>" & Left(HTMLNote, intPosition) & Mid(HTMLnote, intPosition + 1) & "</FONT>"
Else
"<FONT style='font-size: 8pt; text-align:center'>" &HTMLnote & "</FONT>";
)
Else
(
)
and I still getting the same error message about the error within the formula
0 upvotes
Hi Kris-
The formula looks valid, so I think the problem is the data being provided by the database. Do you receive this error no matter what the report parameters are?
A few things to try:
First, make sure that the option in the formula for Null values is set to Default Values for Null, not Exceptions for Nulls.
Second, take a look at the HTML for the specific note you are trying to use and make sure the text wasn't copied from Word. The best way to tell is to look for references for MsoNormal in the HTML. Text copied in from Word often has invalid HTML in it that can cause Crystal Reports to crash.
0 upvotes
Hi
Can we display tables in crystal that are entered in the note?
Thanks
Kris
0 upvotes
Hi Kris-
The HTML supported in Crystal reports is unfortunately very limited. See https://archive.sap.com/discussions/thread/3210329 for the full list, but, unfortunately, tables are not part of it.
0 upvotes
Hi
Is there a way to display a URL text within crystal to match the note format, i.e. blue, underline.
The formula I have for CC025_HTML_TEXT is below
stringvar HTMLnote := {CC025_NOTES_EXT.CC025_HTML_TEXT};
stringVar colon;
HTMLnote := Replace(HTMLnote, "<DIV>", "");
HTMLnote := Replace(HTMLnote, "</DIV>", "<BR>");
HTMLnote := Replace(HTMLnote, "<P>", "<BR>");
HTMLnote := Replace(HTMLnote, "</P>", "</BR>");
HTMLnote := Replace(HTMLnote, "<BR><BR>", "<BR>");
"<FONT style='font-size: 8pt'>" & HTMLnote & "</FONT>";
Thanks
Kris
0 upvotes
No, crystal supports only limited html. Below is the information of what tags/style attributes it does support.
Supported HTML Tags
Any tags outside of these in the html are not supported in crystal and will not be supported in note fields.
html
body
div (causes a paragraph break)
tr (causes only a paragraph break; does not preserve column structure of a table)
span
font
p (causes a paragraph break)
br (causes a paragraph break)
h1 (causes a paragraph break, makes the font bold & twice default size)
h2 (causes a paragraph break, makes the font bold & 1.5 times default size)
h3 (causes a paragraph break, makes the font bold & 9/8 default size)
h4 (causes a paragraph break, makes the font bold)
h5 (causes a paragraph break, makes the font bold & 5/6 default size)
h6 (causes a paragraph break, makes the font bold & 5/8 default size)
center
big (increases font size by 2 points)
small (decreases font size by 2 points if it's 8 points or larger)
B
i
s
strike
u
The supported HTML attributes are:
align
face
size
color
font-family
font-size
font-style
font-weight
In Crystal Reports 2008 Service Pack 2 and above, the following additional HTML tags and attributes have been added to the supported list:
The supported HTML tags are:
ul ( bulleted list ) Important Note: The bullet will not show up as a regular size bullet, but as a small dot.
ol ( ordered list )
0 upvotes
Please sign in to leave a comment.