SAP Knowledge Base Article - Public

1217261 - How to format specific words or characters within a string in Crystal Reports?

Symptom

  • In Crystal Reports, there is no option to format occurrences of a specific word or character. For example, there is no option to bold or underline specific text within a string field.
  • How can you format occurrences of a specific word or character within a string field in Crystal Reports?

Environment

  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
         
  • SAP Crystal Reports for Enterprise 4.0
  • SAP Crystal Reports for Enterprise 4.1
  • SAP Crystal Reports for Enterprise 4.2

Resolution

  • To format occurrences of a specific word or character within a string field, use HTML tags, and format the field to use the HTML Text Interpretation feature. 
                
  • For example, to bold all occurrences of the word "Bikes" in the Customer Name field of the Xtreme sample database:
         
    1. Create a Formula, and use the function 'Replace' to add HTML tags <b> in the text to make it bold, like:
         
         Replace({Customer.Customer Name}, "Bikes","<b>Bikes</b>")
            
    2. Insert the above Formula Field on the report instead of the database field 'Customer Name'
          
    3. Right click on the Formula Field just inserted on the report, and select "Format Field..."
          
    4. In the "Format Editor" window, under the tab "Paragraph", set the "Text interpretation" option to: "HTML"
        
         HTML Text Option.png
          
          
    5. Click "OK" to accept the change.
       
       
  • Sample report demonstrating the above example: Formatting Words Using HTML.rpt
       
  • For a list of supported HTML Tags to format the text, see the SAP Knowledge Base Article: 1217084

Keywords

FORMAT WORD CHARACTER HTML REPLACE BOLD STRING UNDERLINE ITALICS Crystal Reports Formatting fields Word or character formatting HTML , c2015491 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016

Attachments

Formatting Words Using HTML.rpt