SAP Knowledge Base Article - Public

1669339 - How to print the first line of a paragraph in different font size in Crystal Reports?

Symptom

  • How to format the first line of a paragraph differently?
  • How to print the first line of a paragraph in a different font size in Crystal Reports?

Environment

  • SAP Crystal Reports 2008
  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016

Resolution

  • To format the first line of a paragraph with a different font size, use HTML Tags, and format the field to use HTML Text Interpretation:
      
    1. In Crystal Reports, open the report or create a new report.
         
    2. Create a formula that add html tags to change the formatting of the first line of a paragraph like: 
        
      numbervar lf := instr({String_Field},chr(10));
      if lf = 0 then
      '<big>'&{String_Field}&'</big>'
      else
      '<big>'&Mid({String_Field},1,lf-1)&'</big>'&
      Replace(Mid({String_Field},lf,len({String_Field})),chr(10),'<br>')


      Another formula example will be:
           
      numbervar lf := instr({String_Field},chr(10));
      if lf = 0 then
      '<font size="5">'&{String_Field}&'</font>'
      else
      '<font size="5">'&Mid({String_Field},1,lf-1)&'</font>'&
      Replace(Mid({String_Field},lf,len({String_Field})),chr(10),'<br>')
        
    3. Save the formula and insert it on the report.
         
    4. Right click on the Formula Field just inserted on the report, and select "Format Field..."
        
    5. In the "Format Editor" window, under the tab "Paragraph", set the "Text interpretation" option to: "HTML"
        
        HTML Text Option.png
           
         
    6. Still in the "Format Editor" window, under the tab "Common", check the option "Can Grow"
        
    7. Click "OK" to accept the change.
             
          
  • For a list of supported HTML Tags to format the text, see the SAP Knowledge Base Article: 1217084

Keywords

font style, change font style, print fist line in different style, print first line in bold. , 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