Word Report Example

  • Last update:  2024-01-15
  • Overview

    Before studying this document, you need to learn and install the Word Report plugin in Word Report Pluginand complete the basic permission assignment. This document mainly introduces how to create a Word report.

    Procedure

    The following figure shows the overall procedure of creating a Word report.

     1.png

    Prerequisite

    1. Word reports can only be used in HTTPS projects.

    2. You have purchased the legitimate copies of Microsoft Office and log in to MicroSoft through the purchased account.

    3. You have installed the plugin before using the Word report function. For details, see Word Report Add-ins Installation Instruction.

    4. In the remote server environment, you cannot simultaneously open templates in both the designer and Word to modify, preview, and save templates.

    Server Configuration

    iconNote:
    The plugin versions in the local designer and on the remote server should be consistent.

    Users with remote design permissions can switch the designer to the remote server. Choose File (on the designer toolbar) > New Word Report > New Microsoft Word Report. The designer will create a CPT file and automatically open Microsoft Word, as shown in the following figure.

     2.gif

    Click Blank document in Word to go to the setting page, click FineReport on the menu bar, click Server Configuration, enter the remote server address, username, and password in the right dialog box, and click Log In.

     3.gif

    General Report Creation

    Method One

    Click Save in FineReport and create a general report in the report project. Select a report path, name the template, and click Confirm. Then a dialog box displaying "Saved successfully" pops up. Return to the designer and click the refresh icon on the report management panel. Then you can view the created general report. Double-click the report to go to the template edit page. You can view that cell A1 to cell K60 have been merged into one area, where the Word content is displayed in real time during preview.

     4.png

    4.1.png

    Method Two

    Save the created CPT file in the designer and name the file Example, as shown in the following figure.

     5.png

    Click the refresh icon on the report management panel. You can view the created general report. Double-click the report to go to the template edit page. You can view that cell A1 to cell K60 have been merged into one area, where the Word content is displayed in real time during preview.

     6.png

    Return to Word and open the created file, as shown in the following figure.

     7.png

    Resource Preparation

    The Word Report plugin allows you to reference the current template's resources and server-mounted resources.

    Create the required items such as data columns, parameters, tables, charts, and components in the designer. After preparing resources, save the report and click Refresh in Word. Then you can view that the corresponding resources have been displayed in the resource center.

    iconNote:
    To make the modifications of resources in the report take effect in Word, you must first save the report.

     8.png

    Resource Insert

    Formula Insert

    The Word report allows you to insert formulas (in the same format as that in FineReport). Place the cursor on the position where you want to insert a formula in Word, click Formula in the upper left corner, and enter the formula in the pop-up window, as shown in the following figure.

     9.png

    9.1.png

    Cell Insert


     10.png

    The following table introduces how to reference cells.

    Formula
    Definition

    {{=A2}}

    References cell A2 from the first sheet of the current template and returns the last value in all extended values of cell A2 by default. 

    For example, if all extended values of cell A2 are 1, 2, and 3, the formula returns 3 as the result.

    {{=A2!}}

    References cell A2 from the first sheet of the current template and returns all values from the cell. 

    For example, if all extended values of cell A2 are 1, 2, and 3, the formula returns 1, 2, and 3.

    {{=1:A2}}

    References cell A2 from the second sheet of the current template and returns the last value in all extended values of cell A2 by default.

    1: represents the index coordinate of the sheet, which is calculated from 0.

    A2: represents the specific cell retrieved from the second sheet.

    {{=1:A2!}}

    References cell A2 from the second sheet of the current template and returns all extended values of cell A2 from the second sheet.

    Data Column Insert

    The Word report allows you to reference data columns of the current template and the platform-mounted template, and to reference template datasets and server datasets.

    Click Resource Center and click the Data Column icon on the right of the page to view data columns of the current template and the platform-mounted template. Place the cursor on the position where you want to reference a data column in Word and reference the needed data column with a double click, as shown in the following figure.

    11.png 

    Table Insert

    The Word report allows you to reference the current template and the area (namely the table) selected from  the platform-mounted template, and to manually insert tables into Word and reference the data columns of the current template into the inserted tables.

    Report Area Reference

    Place the cursor on the position where you want to insert a table, select the needed table from the platform-mounted template in Resource Center on the right of the page, double-click the corresponding sheet name, enter the position of the table to be inserted in the pop-up Select Table Area dialog box, set Size Setting and Display Format During Preview/Export, and click Confirm, as shown in the following figure.

    1. If you set Size Setting to Custom Size, the system generates a placeholder image with its size and position adjustable in Word. The size and position of the table after preview are consistent with those of the placeholder image. If you set Size Setting to Original Table Size, the table size in Word remains unchanged.

    2. If you set Display Format During Preview/Export to Table for the referenced table resources, you can edit the table after export. If you set Display Format During Preview/Export to Image, the table is displayed as an image and cannot be edited after export.

    3. You can set the cell styles (including the border, spacing, paragraph spacing, indentation, justified alignment, and bottom alignment) when referencing the table from the report. Alternatively, you can set the table styles in the report in advance.

    iconNote:

    1. The name of the cell to be entered must be in the format of an uppercase letter plus an integer like A1.

    2. You cannot reference the cell styles if the cell is referenced by inserting a formula.

     12.png

    Data Column Reference

    Place the cursor on the position where you want to insert a table in Word, click Insert to insert a table, set the table style, click Resource Center in FineReport, reference corresponding data columns in the table, and replace = in the formula with |. Meanwhile, set the sequence number in the first column of the table and select Repeat as header row at the top of each page in Table properties, as shown in the following figure.

    iconNote:
    Only data columns in the current template can be referenced. You can configure simple vertical expansion without the setting of condition attributes and parent-child cell relationships. You can only set the sequence number and determine whether to repeat the header row in the table.

     13.png

    13.1.png

    13.2.png

    Effect Preview

     14.png

    Chart Insert

    The Word report allows you to reference charts from the current template and the platform-mounted template. Place the cursor on the position where you want to insert a chart, click Resource Center in the upper left corner, click the Chart icon on the right, select the needed chart, and double-click the chart name to insert the chart, as shown in the following figure.

    iconNote:
    You cannot inset extension charts.

     15.png

    Parameter Query

    1. The Word report allows you to customize parameters in templates and reference the customized parameters, avoiding complex recalculations. Parameters can be directly defined through formulas, as shown in the following figure.

     16.png

    2. The Word report allows you to reference the parameters defined in reports and add widgets on the parameter panel to achieve the query effect, as shown in the following figure.

    iconNote:
    Only template parameters and global parameters can be referenced. Dataset parameters cannot be referenced.

    Dynamic Text Repeat

    In Word, you can repeat the fixed content for several times by adding the dynamic text repeat widget. The number of repetitions can be calculated through formulas. The widget content can include fixed texts, FineReport formulas, data columns, and custom parameters.

    iconNote:
    Avoid centering the repeatable dynamic text in a paragraph.

    Click Repeatable Dynamic Text in the upper left corner, enter the number of repetitions in the pop-up window, click OK, and enter the content to be repeated in the text widget, as shown in the following figure.

    The formula for the number of repetitions is count(UNIQUEARRAY(ds2.select(Salesperson))), which calculates the number of salespersons in the ds2 dataset.

    The formula for the content to be repeated is {{=Value("ds2","Salesperson")}}'s total sales volume is {{=2:C2!}}, which displays the total sales volume (referencing the value in cell C2 of sheet 3) corresponding to the salesperson in the ds2 dataset.

     17.png

    Component Insert

    Click Resource Center, click the Component icon on the right to select the needed component from the applied components in the FRM template, and double-click the component name to insert the component, as shown in the following figure.

     18.png

    Resource Hiding

    If you do not want to display the report and resources at the same time during the resource preview, you can hide the resources.

    1. You can directly hide rows/columns or set the row height/column width to 0 through condition attributes, as shown in the following figure.

     19.png

    2. If you want to hide the bottom sheet bar, which appears during the preview if resources exist in other sheets, you can add a Loading End event for the template, as shown in the following figure.

     20.png

    JavaScript codes are as follows:

    $(".fr-tabpane-controlbuttons.ui-state-enabled").hide()
    $(".fr-tabpane-tabscontent-bg").hide();


    Word Directory Adaptation

    The Word Report plugin allows you to adjust the template through the built-in directory function of Word, which is illustrated in the following sections.

    1. The table of contents and page numbers can be automatically updated with the report content. You can click the table of contents to jump to the corresponding body part when previewing the Word report. After enabling the PDF rendering function, you can use functions such as the table of contents, highlighting, column conversion, printing, query, and rotation when previewing the report in the browser, as shown in the following figure.

    21.gif

    2. The exported Word document is consistent with the Word report, retaining the content such as the table of contents and navigation. Additionally, the content such as column conversion and highlighting added in the report will also be saved when you click the Save icon on the toolbar to save the report (with the comment content) to the local computer, as shown in the following figure.

     22.png

    Displaying Data Queried by the Default Value in Preview

    If you hope that the query result of the default value can be directly displayed during the preview for the Word report template for which parameter query has been set, you can deselect Display Nothing Before Query in Attribute of the parameter panel.

     23.png

    Template Preview

    You are advised to use Chrome to preview the Word report. You can preview the report effect in both Word and the designer.

    1. In Word: click Save in the FineReport tab and click Preview.

    2. In the designer: click Data Entry Preview.

    iconNote:
    To make the modifications in Word take effect during preview, you must first click Save before clicking Preview, otherwise, the modifications do not take effect.

    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