Justify text

  • Last update:  2021-04-14
  • 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.

    1.png


    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.png


    2. Report design

    1) Design the report style as shown below.

    3.png

    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.

    4.png

    3) B2 cell setting uses Display by HTML.

    5.png

    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.

    6.png


    3. Effect preview

    7.png

    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: 

    Justify_text.cpt


    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy