Loading...

Displaying Notes on a Crystal Report

Comments

11 comments

  • Ian Collins

    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.

  • Kris Corrigan

    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>")

  • Emily Crank

    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?

  • Kris Corrigan

    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

  • Emily Crank

    Hi Kris-
    Could you please paste in what you are using for a formula?

  • Kris Corrigan

    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
    (

         HTMLnote;
    

    )

    and I still getting the same error message about the error within the formula

  • Emily Crank

    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.

  • Kris Corrigan

    Hi

    Can we display tables in crystal that are entered in the note?

    Thanks

    Kris

  • Emily Crank

    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. 

  • Kris Corrigan

    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

  • Dustin Banks

    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)

    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 )

Please sign in to leave a comment.