Picture Below Text

  • Last update:January 18, 2021
  • I. Description

    Application scenario: a chart field and a common field should be displayed in a cell hierarchically. For example, a field holds a picture, and B field holds some strings.

    The background is a field A, and the displayed content is the value of B field, which is similar to a equal layer of PPT. The lower layer picture is the background, and the upper layer displays finereport string, as shown in the following figure:

    企业微信截图_16073991822087.png

    II. Implementation ideas

    Finereport can be implemented through custom functions. Define two parameters name and image to receive the fields in the template respectively, and then return an image with name to display the text on the image.

    III. Steps

    1. Writing custom functions

    For the code of defining stringimage, see:

    https://github.com/finereport-overseas/example/blob/release/10.0/src/main/java/com/fr/function/StringImage.java


    2. Compiling custom functions

    Put the compiled StringImage.class in

    %FR _HOME%\webapps\webroot\WEB-INF\classes  because StringImage.java Belongs to package com.fr.function So StringImage.class Need to put under the directory

    %FR _HOME%\webapps\webroot\WEB-INF\classes\com\fr\function.


    3. Registering custom functions

    After generating the class of the function, you need to register in the designer to use the function. Open server > function manager and select the stringimage class just defined, as shown in the following figure:

    企业微信截图_1607399063622.png

    The function name can be customized, and the use description of the function can be added, as shown in the above figure.


    4. Using custom functions

    After the custom function is registered, it can be used directly when making reports.

    1) First of all, a new table needs to be created in the database to store the contents of pictures and words (see uploading pictures for the method of uploading pictures to the database), as shown in the following figure:

    Note: the built-in SQLite does not support displaying pictures.

    2) Making templates

    Drag cell A1 into the name field, cell B1 into the picture field, and cell A2 into the formula = stringimage (A1, B1), as shown in the following figure:



    Save the template preview to achieve the effect of picture below and text above, as shown in the following figure:


    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • 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