1217220 - Columns are aligned differently when using tabs with RTF Text Interpretation in Crystal Reports

SAP Knowledge Base Article - Public

1217220 - Columns are aligned differently when using tabs with RTF Text Interpretation in Crystal Reports

Symptom

  • Columns alignment incorrect.
  • Columns are not aligned the same way in Crystal Reports than in MS Word.
  • In Crystal Reports, when reporting off a database field containing Rich Text Format (RTF) Code, the columns do not line up as they do in Microsoft Word and WordPad. The database field has RTF Text Interpretation selected in Crystal Reports and tabs are used within the RTF code to generate columns.

Environment

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

Reproducing the Issue

  1. In Crystal Reports, create a report off any data source.
        
  2. Create a formula that contains RTF tags that uses multiple tabs tags (/tab), to align text in columns, like:
        
     '{\rtf1\ansi{\fonttbl\f0 Arial;}Bob\tab\tab\tab 123\par John\tab\tab\tab 456\par Sam\tab\tab\tab 789}\f0}'
      
  3. Insert the formula on the report, and set the Text Interpretation format to RTF.
     
  4. When viewing the report in Crystal Reports, it display the RTF text like:       
     Tabs - CR.png   
  5. When viewing the same RTF text in MS Word, it displays the text like:  
     Tabs - MS Word.png  
              
    Notice the tab alignment is different in Crystal Reports, than it is in MS Word:
      
     Tabs.png
      

Cause

  • Columns alignment is different because Crystal Reports uses a 1/4 inch tab width as opposed to a 1/2 inch tab width used by Microsoft Word and Microsof WordPad.

Resolution

  • There is unfortunately no options to change the tab width when using the RTF Text Interpretation in Crystal Reports.
     
  • A workaround to have more consistant space between text when viewing the RTF code in Crystal Reports, versus when viewed in MS Word, will be to:
    • Use spaces instead of tabs in the RTF code, and
    • Format the database field with a fixed character width font such as Courier
            
  • Note: If the columns do not align as desired when using spaces instead of tabs in your RTF code, modify the RTF code until it displays the desired alignment.

 

Keywords

RTF TEXT INTERPRETATION COLUMNS FORMAT FIELD TAB Crystal Reports RTF Text interpretation Format column , c2015238 , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

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