Cell Alignment by Condition Attribute

  • Last update:June 05, 2025
  • Overview

    Problem

    You can use the Alignment function in Cell Attribute to set the alignment for entire rows or columns of cells uniformly, as shown in the following figure.

     1.png

    But how can you set different alignments for cells in a certain row (or column) under specific conditions?

    For example, you can set Horizontal Alignment to Left for cells containing California and set Horizontal Alignment to Right for cells containing New York, as shown in the following figure.

     2.png

    Solution

    You can add a New Value condition attribute with New Value set to an HTML formula and set Display Content to Display by HTML.

    AlignmentNew Value Formula
    LeftCONCATENATE("<div>"+$$$+"</div>")

    Center

    CONCATENATE("<div>"+$$$+"</div>")

    Right

    CONCATENATE("<div>"+$$$+"</div>")

    Example

    Data Preparation

    Create a general report, and create a database query ds1 with the SQL statement SELECT * FROM Sales_Volume.

     3.png

    Template Designing

    Drag the dataset fields into the corresponding cells, center the content, and set Data Setting to List for cell A2. Design the table style, as shown in the following figure.

     4.png

    Condition Attribute Setting

    1. Select cell A2, add two condition attributes, and rename the attributes Left Alignment for California and Right Alignment for New York respectively.

     5.png

    2. Left Alignment for California: Set New Value to the formula CONCATENATE("<div>"+$$$+"</div>") when the cell value is California.

    The formula CONCATENATE() is used to combine multiple strings into one single string.

     6.png

    3. Set Right Alignment for New York similarly. Set New Value to the formula CONCATENATE("<div>"+$$$+"</div>").

     7.png

    Cell Display Content Setting

    Select cell A2, and choose Cell Attribute > Others, and set Display Content to Display by HTML, as shown in the following figure.

     8.png

    Effect Display

    PC

    Save the template and click Pagination Preview. The effect is the same as that shown in section "Problem."

    Mobile Terminal

    The report can be previewed on both the DataAnalyst app and the HTML5 terminal. The following figure shows the effect.

     9.jpg

    Template Download

    For details, you can download the template Cell Alighment by Condition Attribute.cpt.

    Attachment List


    Theme: Report Features
    • 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