I. Overview
1. Problem description
Sometimes, the expanded value of the same cell has different lengths, but the difference is not very big. It is hoped that their lengths can be the same when displayed to achieve the effect of alignment.
As shown in the figure below, the length of the expanded value of the unit and the name is different, and the text is aligned at both ends after processing.
2. Realization ideas
1) Use HTML tags to change the space between text.
2) Use spaces to concatenate strings.
II. Example
1. Data preparation
Create a new built-in dataset.
2. Report design
1) Design the report style as shown below.
2) Select cell B2, set Cell Attributes>Display>Formula Form, and add the following formula:
if(len($$$)=5,"<div style='letter-spacing:1.8px;'>"+$$$+"</div>",if(len($$$)=8,"<div style='letter-spacing:-1.2px;'>"+$$$+"</div>",$$$))
Note 1: Because of the analysis of the three cases where the units have lengths of 5, 7, and 8, the unit of the median length of 7 is kept unchanged, the length of 5 increases the interval, and the length of 8 shortens the interval. Users need to adjust according to the actual number of words in their own application scenarios.
Note 2: Due to the font and size, the specific value of the increase or decrease needs to be adjusted according to your actual situation.
3) B2 cell setting uses Display by HTML.
4) Select cell C2, set Cell Attributes>Display>Formula Form, and add the following formula:
if(len($$$)=2,left($$$,1)+" "+right($$$,1),$$$)
Note: A blank character is spliced in the middle of the formula. Please switch the input method to full-width and press the space bar again.
3. Effect preview
Note: When previewing on the mobile terminal, the HTML tag part of the H5 effect needs to be adjusted in addition to the specific interval.
III. Template download
Refer to the completed template:%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BasicApplication\Justify_text.cpt
Click to download: