Display Image in Cell (TOIMAGE)

  • Last update:  2021-03-31
  • I. Overview

    1. Function

    The TOIMAGE function is used to display pictures under a certain path in the report. Support jpg, png, bmp common format pictures, the pictures can be stored in the local disk, can also be stored in the remote server, can also be a picture in the web page.


    2. Function Explanation

    TOIMAGE(path,cache,width,height)

      ParameterMeaning  Parameter Format
     path Picture path, cannot be omitted

    "F:/FineReport_10.0/webroot/logo.png" 

    Note: The slash must be /

     cacheWhether to enable the image caching function, it can be omitted, the default is enabledtrue turns on, false turns off
     widthPicture width, can be omitted, the original width of the default picture is omitted

    Integer: image width in pixels

    Percentage: Image width zoom ratio

     heightPicture height, can be omitted, the original height of the default picture is omitted

    Integer: image height in pixels

    Percentage: Image height zoom ratio

    Example:

    TOIMAGE("D:/1.jpg")

    TOIMAGE("D:/1.jpg",false)

    TOIMAGE("D:/1.jpg",true,200,300)

    TOIMAGE("D:/1.jpg",true,"50%","200%")


    3. Precautions

    1) Use the TOIMAGE function to display the cell picture template. When you select the menu bar "File>Output>Template (built-in data)", the picture will not be output with it.

    2) If the cell property of the TOIMAGE function is used to set "Style>Paragraph Spacing", then the set "Paragraph Spacing" will not take effect when exporting or printing reports.

    3) For the picture returned by the TOIMAGE function, the "picture layout" is set to "default". You can choose other layout methods at "Cell Properties> Style> Alignment> Picture Layout".

    II. Application Scenario

    The TOIMAGE function can directly enter the image path, or reference the image path field stored in the database.


    1. Direct Input

    Pictures can be stored on a local disk or on a remote server. The image storage location is different, the path is written differently.

    Picture storage locationPath Formula
    Local Disk

    The absolute path of the picture, such as

    E:/picture/logo-fanruan.png

    TOIMAGE("E:/picture/logo-fanruan.png")

    Report server webroot directory

    Omit the simplified path of the directory where the project is located, such as

    help/logo-fanruan.png

    TOIMAGE("help/logo-fanruan.png")

    Pictures in the webpage

    Picture network address, such as

    https://www.fanruan.com/images/logo-fanruan.png

    TOIMAGE("https://www.fanruan.com/images/logo-fanruan.png") 

    Note: It is recommended to use WEBIMAGE(path) when displaying pictures in web pages, which can improve the loading speed of Web pictures.

    Note: When the report server webroot is a remote server, the designer must switch to the working directory of the corresponding remote server.


    2. Referencing a field in the database

    1) If the picture is stored in the local disk E, the path is: E:/picture/logo-fanruan.png, and the picture path is stored in the database table, as shown in the following figure:

    1.png

    2) Drag the field "path" to the report cell, select "Advanced" for the cell properties on the right, and enter the formula TOIMAGE($$$) in the "Display Value" position. $$$ represents the current cell value. Steps As shown below:

    2.png

    3) If the path of the picture stored in the database is incomplete, you need to complete the path to display the picture.

    For example, if the image in Disk E above is stored in the database as logo-fanruan.png, the formula of "Display Value" needs to be modified to :TOIMAGE("E:/picture/"+$$$).

    Note: If the user database server and report application server are separated, the pictures should be stored on the report application server, not the database server.

    Attachment List


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