Custom report generation method and device based on POI-TL

By using the POI-TL custom report generation method and leveraging the binding relationship between templates and operators, the issues of flexibility and style control in Word document generation are resolved, enabling efficient generation and maintenance of complex content.

CN122072818APending Publication Date: 2026-05-22WUHAN HONGXIN TECH SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN HONGXIN TECH SERVICE CO LTD
Filing Date
2026-01-07
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

Existing technologies struggle to handle dynamic content, complex style controls, and arbitrary content combinations when generating Word documents, resulting in insufficient flexibility and an inability to meet the needs of generating complex content.

Method used

The POI-TL custom report generation method is adopted. By pre-setting multiple templates in the file storage system and defining the binding relationship between operators and templates, documents are generated according to the report structure requirements. It supports flexible embedding of charts and images and style control.

Benefits of technology

It enables dynamic and flexible combination of report content and precise control over complex styles, improving document generation efficiency and maintainability, supporting arbitrary configuration and combination, and reducing the difficulty of style maintenance and code modification costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122072818A_ABST
    Figure CN122072818A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computer software, and discloses a user-defined report generation method and device based on POI-TL. The method comprises the steps that multiple templates are preset in a file storage system, each template is preset with a corresponding style, and the templates comprise a blank template, a chart template and a picture template; creating configuration information for each preset template, wherein the configuration information at least comprises a template type and a storage path; defining a plurality of operators used for acquiring report data, and defining a returned data type for each operator; establishing a binding relationship between the operator and a preset template, and creating a document template containing at least one operator according to a report structure requirement; and calling a corresponding operator to obtain data according to the document template, matching to a corresponding preset template based on the binding relationship, rendering the data into document components, and embedding all the document components into a blank template to generate a final report document. The problems that an existing document generation method is poor in flexibility, complex content is difficult to generate, and style control is difficult are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer software technology, and more specifically, to a method and apparatus for generating custom reports based on POI-TL. Background Technology

[0002] In project development, the need to export Word documents is very common. Existing solutions typically require preparing a Word template with fixed content, pre-writing the text content into the template, and using placeholders (such as $ and {}) to represent the variables to be filled. The required data is then queried in the code, and technical tools (such as the POI library) are used to replace the placeholders with the actual data, thus enabling the Word document export function.

[0003] Furthermore, the key implementation steps of the existing technology include: (1) Template preparation: Prepare a Word template in advance, which contains fixed text and placeholders.

[0004] (2) Data query: Query the required data in the code.

[0005] (3) Replace placeholders: Use libraries such as POI to replace placeholders with actual data to complete the generation of Word documents.

[0006] Therefore, it is evident that the existing solution is suitable for document generation needs with fixed content and simple structure, but cannot handle dynamic content generation, resulting in insufficient flexibility. When it is necessary to generate content with arbitrary configurations, selections, and combinations, the existing solution cannot achieve this, especially when it involves the mixed embedding of text, charts, and images, which presents difficulties in generating complex content. Furthermore, it is difficult to meet the need for arbitrary adjustment of styles such as font, font size, and line spacing, meaning that style control is limited. Summary of the Invention

[0007] To address at least one deficiency or improvement need in the prior art, this invention provides a custom report generation method and apparatus based on POI-TL, which solves the shortcomings of the prior art in dynamic content generation, complex style control, and arbitrary content combination. It realizes dynamic and flexible combination of report content and precise control of complex styles, significantly improving the efficiency and maintainability of document generation.

[0008] To achieve the above objectives, according to a first aspect of the present invention, a method for generating custom reports based on POI-TL is provided. The method includes: pre-setting multiple templates in a file storage system, each template having a corresponding style, wherein the templates include blank templates, chart templates, and image templates; creating configuration information for each pre-set template, the configuration information including at least a template type and a storage path; defining multiple operators for obtaining report data, and defining the data type returned by each operator; establishing a binding relationship between the operators and the pre-set templates, and creating a document template containing at least one operator according to report structure requirements; calling the corresponding operator to obtain data according to the document template, matching the corresponding pre-set template based on the binding relationship, rendering the data into document components, and embedding all document components into the blank template to generate a final report document.

[0009] In one exemplary embodiment, the file storage system is a MinIO object storage system; the template style is updated in the file storage system and takes effect immediately.

[0010] In one exemplary embodiment, the configuration information further includes a unique name for identifying the template and / or optional text values ​​for describing the chart; the configuration information is stored in a business database.

[0011] In one exemplary embodiment, the data type returned by the operator includes text, loop text, one-dimensional statistical data, and multi-dimensional statistical data; wherein, the loop text format is predefined as a structured format that includes the number of loop bodies, the content of the loop body, the loop body prefix, the loop body suffix, and the content to be displayed when there is no data.

[0012] In one exemplary embodiment, the unidimensional statistical data and multidimensional statistical data are encapsulated in a predefined data collection object, which includes a name list for storing data item names and a value list for storing the corresponding values ​​of the data items.

[0013] In an exemplary embodiment, the step of rendering data into document components and embedding all document components into the blank template to generate a final report document includes: calling the operator configured in the document template to obtain the corresponding data; determining the target template corresponding to the operator according to the binding relationship; using a rendering tool to fill the target template with the data to generate a byte array of document fragments corresponding to charts, images, or text; and sequentially embedding the byte arrays of each document fragment into the document body structure determined by the blank template to generate the final report document.

[0014] In an exemplary embodiment, the step of sequentially embedding the byte arrays of each document fragment into the document body structure determined by the blank template to generate a final report document includes: for text-type document fragments, adjusting their display style in the final report document according to pre-configured style parameters, wherein the style parameters include at least one of the following: font, font size, bold, and alignment.

[0015] According to a second aspect of the present invention, a custom report generation device based on POI-TL is also provided, comprising: a preset unit for presetting multiple templates in a file storage system, each template having a corresponding style, wherein the templates include blank templates, chart templates, and image templates; a creation unit for creating configuration information for each preset template, the configuration information including at least a template type and a storage path; a definition unit for defining multiple operators for obtaining report data, and defining the data type returned by each operator; a binding unit for establishing a binding relationship between the operators and the preset templates, and creating a document template containing at least one operator according to the report structure requirements; and a rendering generation unit for calling the corresponding operator to obtain data according to the document template, matching the corresponding preset template based on the binding relationship, rendering the data into document components, and embedding all document components into the blank template to generate a final report document.

[0016] According to a third aspect of the invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to execute the above-described custom report generation method based on POI-TL at runtime.

[0017] According to a fourth aspect of the present invention, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described custom report generation method based on POI-TL through the computer program.

[0018] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: (1) This invention provides a custom report generation method based on POI-TL. Through the configurable design of operators and document templates, the report content no longer depends on a fixed template structure. Users can freely select and combine different operators to flexibly customize report chapters and content, easily meeting the needs of report generation with varied content and complex structures, completely solving the problem of insufficient flexibility in existing technologies, and realizing flexible content generation. By pre-setting various types of chart templates and image templates, the generation process of complex elements is standardized. The system can efficiently and reliably embed charts and images with professional-grade styles into Word documents, supporting arbitrary configuration, selection, and combination.

[0019] (2) The styles of documents, charts, and images are pre-set in independent template files. Style adjustments only require modifying the template file to take effect, without the need to modify and redeploy the program code. This greatly reduces the difficulty and cost of style maintenance. Using pre-set blank templates as a basis ensures the integrity of the overall structure and the standardization of the format of the generated document (such as headers and footers, line count, etc.), and solves the compatibility problems that may exist when directly generating Word documents from code (such as the inability to convert to PDF).

[0020] (3) Common charts, reports, and other components are encapsulated into pre-built templates and operators. When developing new reports, there is no need to write code from scratch; only configuration and binding are required, which greatly reduces the amount of repetitive development work and shortens the development cycle. Templates are stored in file systems such as MinIO, making management and updates very convenient. When business requirements change, usually only the template needs to be updated or the configuration adjusted, without modifying the core code. When it is necessary to support new chart types or content formats, only new pre-built templates need to be developed and the corresponding operators configured. The overall system architecture does not need to be changed, and the scalability is excellent.

[0021] (4) Through strict operator definitions and template binding relationships, accurate matching between data and presentation format is ensured. The configuration file-driven approach reduces manual intervention and lowers the risk of data mismatch due to hard-coding errors. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A flowchart illustrating an optional custom report generation method based on POI-TL provided for embodiments of this application; Figure 2A flowchart illustrating another optional custom report generation method based on POI-TL provided for embodiments of this application; Figure 3 An example diagram of an optional preset template provided for an embodiment of this application; Figure 4 Example diagram of another optional preset template provided for embodiments of this application; Figure 5 A schematic diagram of an optional custom report generation device based on POI-TL provided for embodiments of this application; Figure 6 This is a schematic diagram of an optional electronic device provided in an embodiment of this application. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0025] The terms "first," "second," "third," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0026] According to one aspect of the embodiments of this application, a custom report generation method based on POI-TL is provided. The following is in conjunction with... Figure 1 This application describes a custom report generation method based on POI-TL provided in its embodiments.

[0027] Figure 1 This is a flowchart illustrating an optional custom report generation method based on POI-TL provided in an embodiment of this application, as shown below. Figure 1 As shown, the process of this method may include the following steps: S102, a variety of templates are pre-set in the file storage system, and each template has a corresponding style. The templates include blank templates, chart templates and image templates. S104, Create configuration information for each preset template, the configuration information including at least the template type and storage path; S106, Define multiple operators for obtaining report data, and define the data type returned by each operator; S108, Establish the binding relationship between the operator and the preset template, and create a document template containing at least one operator according to the report structure requirements; S110, according to the document template, call the corresponding operator to obtain data, match the corresponding preset template based on the binding relationship, render the data into document components and embed all document components into the blank template to generate the final report document.

[0028] The optional POI-TL-based custom report generation method provided in this application is mainly applicable to various information systems with high requirements for automation, standardization, flexibility, and complexity in document generation. Examples include enterprise-level data analysis and standardized report generation for public utilities.

[0029] Here, POI-TL (Pretty Objects and Template Language) is a declarative Word template engine based on Apache POI. Its core function is to allow users to design template files containing specific syntax (such as {{variable}}) using visual office software (such as Microsoft Word). The program automatically and efficiently generates well-formatted and complex Word documents by binding Java data objects to the templates.

[0030] Combination Figure 1 and Figure 2 As shown, the implementation steps of the custom report generation method are as follows: Step 1: Pre-set multiple templates.

[0031] The file storage system includes a variety of pre-defined templates, such as blank templates, chart templates, and image templates. Each template has pre-defined styles, such as layout, font, and color. For example, a blank template might be a basic document framework, a chart template might have preset styles for bar charts or line charts, and an image template might have preset borders and sizes for inserted images.

[0032] Step 2: Create template configuration information.

[0033] Create configuration information for each pre-built template. This configuration information includes at least the template type (e.g., blank, chart, image) and storage path (for locating the template file). Additionally, it may include metadata such as template version information, creation date, and author.

[0034] Step 3: Define the operator.

[0035] Define multiple operators for retrieving report data. Each operator is responsible for retrieving a specific type of data, and the data type it returns is defined for each operator. For example, you could define a "Retrieve Sales Data" operator that returns a list containing sales amount, sales volume, and sales date; or define a "Retrieve User Information" operator that returns an object containing username, email address, and registration date.

[0036] Step 4: Establish the binding relationship between the operator and the template and create a document template.

[0037] Establish the binding relationship between operators and preset templates. In other words, specify which template the data obtained by a certain operator will be used to populate.

[0038] Based on the report structure requirements, create a document template containing at least one operator. This document template defines the overall structure of the report and the data sources.

[0039] For example, a sales report document template might contain a chart template (used to display sales trends, bound to the "Get Sales Data" operator) and a blank template (used to display a sales summary, bound to the "Get Sales Overview" operator).

[0040] Step 5: Call the operator and render to generate a report.

[0041] Based on the created document template, the corresponding operators are invoked to retrieve data. Based on the previously established binding relationships, the retrieved data is matched to the corresponding preset template. The data is then rendered into document components. For example, the retrieved sales data is rendered into a chart component or a table component. All document components are embedded into a blank template to generate the final report document.

[0042] Optionally, during the rendering process, the data can be formatted to ensure it conforms to the template requirements, such as through data cleaning, transformation, or formatting. Preferably, an error handling mechanism is also included to verify whether the data type returned by the operator is correct and whether the template exists.

[0043] The final generated complete report document can be saved, previewed, or exported in a specific format (such as PDF, Word, etc.).

[0044] Through steps S102 to S110, multiple templates are pre-set in the file storage system, each with a corresponding style. The templates include blank templates, chart templates, and image templates. Configuration information is created for each pre-set template, including at least the template type and storage path. Multiple operators for obtaining report data are defined, and the data type returned by each operator is defined. A binding relationship is established between the operators and the pre-set templates. A document template containing at least one operator is created according to the report structure requirements. Data is obtained by calling the corresponding operator according to the document template. Based on the binding relationship, the corresponding pre-set template is matched, the data is rendered into document components, and all document components are embedded into the blank template to generate the final report document. This solves the problems of poor flexibility, difficulty in generating complex content, and difficulty in style control in existing document generation methods.

[0045] In one exemplary embodiment, the file storage system is a MinIO object storage system; the template style is updated in the file storage system and takes effect immediately.

[0046] It's worth noting that dynamically adding text to Word via code is simple, but adding charts and images is more cumbersome and difficult to perfectly achieve the desired style. To solve this problem, charts and images can be separated into individual templates. When generating charts or images, simply calculate the data, retrieve the corresponding pre-defined template, and the desired table will be rendered. Furthermore, the pre-defined table styles are preset according to the required style, perfectly achieving a WYSIWYG (What You See Is What You Get) experience.

[0047] In this embodiment, the preset initial template may include a preset blank template, a preset icon template, a preset image template, etc.

[0048] Pre-defined blank template: Used to define the format of the main template, such as headers, footers, and line count. The reason for providing a pre-defined initial blank template is twofold: firstly, business requirements may specify the format of the main template, such as line count, headers, and footers; secondly, code-generated blank templates are generally incomplete in structure. While they can generate Word documents, these documents cannot be converted to PDF. Therefore, having a pre-formatted blank main template as an initial template is more convenient and effective.

[0049] Preset chart templates: Supports various chart types, such as Figure 3 and Figure 4 As shown, various chart series are available, including: bar charts, stacked bar charts, percentage stacked bar charts, line charts, line charts with markers, bar charts, stacked bar charts, percentage charts, area charts, area stacked charts, percentage area charts, scatter plots (x-axis must be numerical), radar charts, etc. Single-series charts include: pie charts, donut charts, etc. Each chart template has preset styles to meet your needs.

[0050] Preset image templates: Supports preset image size, floating mode, and other styles to ensure the image displays well in the document.

[0051] Optionally, preset templates are stored in a file system similar to MinIO, allowing users to update and adjust styles at any time. All changes take effect immediately, facilitating updates and maintenance.

[0052] This embodiment provides pre-set chart and image templates of various types, standardizing the generation process of complex elements. The system can efficiently and reliably embed professional-style charts and images into Word documents, supporting arbitrary configuration, selection, and combination.

[0053] In one exemplary embodiment, the configuration information further includes a unique name for identifying the template and / or optional text values ​​for describing the chart; the configuration information is stored in a business database.

[0054] Optionally, to ensure that preset templates are correctly invoked during rendering, the templates need to be configured. The configuration for each preset template includes the following information: seriesType: Indicates the template type (such as single series, multiple series, image, etc.).

[0055] The value indicates the optional text content for the chart in the template.

[0056] The `name` option specifies the template's custom name.

[0057] templatePath: The actual storage path of the template.

[0058] In this way, when a pre-set template is uploaded, a corresponding configuration information is added at the same time, and the template can be used. The configuration information can be stored in the business database.

[0059] In one exemplary embodiment, the data type returned by the operator includes text, loop text, one-dimensional statistical data, and multi-dimensional statistical data; wherein, the loop text format is predefined as a structured format that includes the number of loop bodies, the content of the loop body, the loop body prefix, the loop body suffix, and the content to be displayed when there is no data.

[0060] For example, for any content that needs to be exported, there must be a corresponding operator (a method for obtaining the required data). This could be a database query or statistical analysis, or a model analysis. The type of result calculated by each operator is fixed: text, circular text, one-dimensional data, or multi-dimensional data. The metadata information of each operator, as well as the data type it returns, should also be added to the operator definition table.

[0061] Generally, the data types are as follows: (1) Text: Plain text is relatively simple and may be a result of a large model analysis. This type can be directly read into the main template (blank template).

[0062] (2) Looping text: The general format of this type of text is as follows: "Date 1~Date 2, Department 1 has X people, compared to the previous period xx%, Department 2 has x people, compared to the previous period xx%, overall xxxxx". For this format, a text template can be predefined [number of loops: content of loops: prefix of loops: suffix of loops: content to display when there is no data]. After the operator returns the corresponding data according to the format, it is parsed into plain text according to the format definition.

[0063] In one exemplary embodiment, the unidimensional statistical data and multidimensional statistical data are encapsulated in a predefined data collection object, which includes a name list for storing data item names and a value list for storing the corresponding values ​​of the data items.

[0064] (3) Single-dimensional and multi-dimensional statistical data: Data can be filled in according to the custom object, as defined below: public class MetricItemCollectionResult { private List <string>nameList; private List <List<Tuple2<String, BigDecimal> >>valueList; } By using this embodiment to predefine standardized data types, when adding new data types or modifying data formats, only the corresponding operators or templates need to be adjusted, without changing the system's core rendering engine, which greatly improves the system's scalability and maintainability.

[0065] In one exemplary embodiment, rendering the data into document components and embedding all document components into the blank template to generate the final report document includes: Call the operators configured in the document template to obtain the corresponding data; Based on the binding relationship, the target template corresponding to the operator is determined, and the data is filled into the target template using a rendering tool to generate a byte array of document fragments corresponding to charts, images, or text. The byte arrays of each document fragment are sequentially embedded into the document body structure determined by the blank template to generate the final report document.

[0066] In this embodiment, the rendering utility class is WordUtils. By passing in the data returned by the operator and the binding relationship between the operator and the preset template, the utility can find the configuration information of the preset template based on the binding relationship, read the template through the path in the configuration, and then render the data returned by the operator onto the chart. The rendered chart is then converted into a byte array and returned to the main program for nesting and merging into the main template. If it is a text type, a preset template is not needed; it is directly merged into the main template as paragraphs. The functions of WordUtils are defined as follows: setting title styles; rendering tables and returning table types; rendering ordinary nested documents and returning byte arrays for nesting; rendering a single-series chart and returning byte arrays for nesting; rendering a multi-series chart and returning byte arrays for nesting; generating a Word document byte array containing text content based on text parameters; and converting Word documents to PDF.

[0067] Furthermore, the document template is defined. Operators, preset templates, and binding relationships are determined. Calling any operator determines the specific style to be rendered. The document template is a collection of operators, including titles, chapters, and the operator configurations required for each chapter. Users can freely combine operators according to their needs to generate different report structures.

[0068] At this point, given a predefined document template, the corresponding operator can be obtained. By understanding the binding relationship between the operator and the preset template, it can be determined how the operator should be rendered. Then, simply call the corresponding method of the tool to merge the rendering results into the main template in sequence.

[0069] In one exemplary embodiment, the step of sequentially embedding the byte arrays of each document fragment into the document body structure determined by the blank template to generate the final report document includes: For text-type document fragments, their display style in the final report document is adjusted according to pre-configured style parameters, which include at least one of the following: font, font size, bold, and alignment.

[0070] Specifically, during the rendering of the main template, the styles of the text can be adjusted by reading the configuration, such as whether to bold, center, font, and font size. After rendering the configuration, an XWPFDocument object can be obtained, which can be directly exported via OutputStream.

[0071] The system calls the corresponding operators based on the document template to retrieve data. Based on the binding relationship between the operators and preset templates, the data is rendered into corresponding charts, text, and other content. The rendered results are embedded into the main template to generate a complete Word document. Styles are adjusted according to configured parameters such as bolding, centering, font, and font size. The document is then generated as a Word document or converted to PDF for user download.

[0072] Specifically, when type trend analysis is required, the custom document structure is shown in Table 1.

[0073] Table 1

[0074] For example, displaying dispute type statistics as a bar chart; displaying month-on-month dispute statistics as a table; and displaying the total number of disputes over the past six months as a line chart.

[0075] In this embodiment, when business requirements change, typically only the template needs to be updated or the configuration adjusted, without modifying the core code. When new chart types or content formats need to be supported, only new pre-built templates need to be developed and the corresponding operators configured; the overall system architecture remains unchanged, demonstrating excellent scalability.

[0076] According to another aspect of the embodiments of this application, a device data classification apparatus for implementing the above-described custom report generation method based on POI-TL is also provided. Figure 5 This is a schematic diagram of an optional custom report generation device based on POI-TL according to an embodiment of this application, as shown below. Figure 5 As shown, the device may include: The preset unit 502 is used to preset multiple templates in the file storage system. Each template has a corresponding style. The templates include blank templates, chart templates, and image templates. The creation unit 504 is used to create configuration information for each preset template, the configuration information including at least the template type and storage path; Definition unit 506 is used to define multiple operators for obtaining report data, and to define the data type returned by each operator; Binding unit 508 is used to establish the binding relationship between the operator and the preset template, and to create a document template containing at least one operator according to the report structure requirements; The rendering generation unit 510 is used to call the corresponding operator to obtain data according to the document template, match the corresponding preset template based on the binding relationship, render the data into document components, and embed all document components into the blank template to generate the final report document.

[0077] It should be noted that the preset unit 502 in this embodiment can be used to execute the above step S102, the creation unit 504 in this embodiment can be used to execute the above step S104, the definition unit 506 in this embodiment can be used to execute the above step S106, the binding unit 508 in this embodiment can be used to execute the above step S108, and the rendering generation unit 510 in this embodiment can be used to execute the above step S110.

[0078] Through the above modules, multiple templates are pre-set in the file storage system, each with a corresponding style. The templates include blank templates, chart templates, and image templates. Configuration information is created for each pre-set template, including at least the template type and storage path. Multiple operators for obtaining report data are defined, and the data type returned by each operator is defined. The binding relationship between the operators and the pre-set templates is established, and a document template containing at least one operator is created according to the report structure requirements. Data is obtained by calling the corresponding operator according to the document template, and the corresponding pre-set template is matched based on the binding relationship. The data is rendered into document components, and all document components are embedded into the blank template to generate the final report document. This solves the problems of poor flexibility, difficulty in generating complex content, and difficulty in style control in existing document generation methods.

[0079] According to another aspect of the embodiments of this application, a storage medium is also provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the custom report generation methods based on POI-TL described in the embodiments of this application.

[0080] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: S1, a variety of templates are pre-set in the file storage system, and each template has a corresponding style. The templates include blank templates, chart templates and image templates. S2 creates configuration information for each preset template, the configuration information including at least the template type and storage path; S3 defines multiple operators for obtaining report data and defines the data type returned by each operator; S4, Establish the binding relationship between the operator and the preset template, and create a document template containing at least one operator according to the report structure requirements; S5, according to the document template, call the corresponding operator to obtain data, match the corresponding preset template based on the binding relationship, render the data into document components and embed all document components into the blank template to generate the final report document.

[0081] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.

[0082] The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, as well as magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.

[0083] According to another aspect of the embodiments of this application, an electronic device for implementing the above-described custom report generation method based on POI-TL is also provided, which may be a server, a terminal, or a combination thereof.

[0084] Figure 6 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application, such as... Figure 6 As shown, it includes a processor 602, a communication interface 604, a memory 606, and a communication bus 608. The processor 602, communication interface 604, and memory 606 communicate with each other via the communication bus 608. Memory 606 is used to store computer programs; When processor 602 executes a computer program stored in memory 606, it performs the following steps: S1, a variety of templates are pre-set in the file storage system, and each template has a corresponding style. The templates include blank templates, chart templates and image templates. S2 creates configuration information for each preset template, the configuration information including at least the template type and storage path; S3 defines multiple operators for obtaining report data and defines the data type returned by each operator; S4, Establish the binding relationship between the operator and the preset template, and create a document template containing at least one operator according to the report structure requirements; S5, according to the document template, call the corresponding operator to obtain data, match the corresponding preset template based on the binding relationship, render the data into document components and embed all document components into the blank template to generate the final report document.

[0085] Optionally, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single thick line, but this does not indicate that there is only one bus or one type of bus. The communication interface is used for communication between the aforementioned electronic device and other devices.

[0086] Memory may include RAM or non-volatile memory. Volatile memory, for example, at least one disk storage device. Alternatively, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0087] As an example, the memory 606 described above may include, but is not limited to, the preset unit 502, creation unit 504, definition unit 506, binding unit 508, and rendering generation unit 510 in the POI-TL-based custom report generation device described above. Furthermore, it may include, but is not limited to, other module units in the POI-TL-based custom report generation device described above, which will not be elaborated upon in this example.

[0088] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0089] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0090] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0091] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0092] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0093] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0094] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0095] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0096] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0097] The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of embodiments of this disclosure upon considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described herein. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

[0098] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0099] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.< / string>

Claims

1. A method for generating custom reports based on POI-TL, characterized in that, include: The file storage system has a variety of pre-set templates, each of which has a corresponding style. The templates include blank templates, chart templates, and image templates. Create configuration information for each preset template, the configuration information including at least the template type and storage path; Define multiple operators for retrieving report data, and define the data type returned by each operator; Establish the binding relationship between operators and preset templates, and create a document template containing at least one operator according to the report structure requirements; Data is retrieved by calling the corresponding operator based on the document template, and the corresponding preset template is matched based on the binding relationship. The data is rendered into document components and all document components are embedded into the blank template to generate the final report document.

2. The custom report generation method based on POI-TL as described in claim 1, characterized in that, The file storage system is the MinIO object storage system; the template style is updated in the file storage system and takes effect immediately.

3. The custom report generation method based on POI-TL as described in claim 1, characterized in that, The configuration information also includes a unique name for identifying the template and / or optional text values ​​for describing the chart; the configuration information is stored in the business database.

4. The custom report generation method based on POI-TL as described in claim 1, characterized in that, The data types returned by the operator include text, loop text, one-dimensional statistical data, and multi-dimensional statistical data; wherein, the loop text format is predefined as a structured format that includes the number of loop bodies, the content of the loop body, the loop body prefix, the loop body suffix, and the content to be displayed when there is no data.

5. The custom report generation method based on POI-TL as described in claim 4, characterized in that, The single-dimensional and multi-dimensional statistical data are encapsulated in a predefined data collection object, which includes a name list for storing data item names and a value list for storing the corresponding values ​​of the data items.

6. The custom report generation method based on POI-TL as described in claim 1, characterized in that, The step of rendering data into document components and embedding all document components into the blank template to generate the final report document includes: Call the operators configured in the document template to obtain the corresponding data; Based on the binding relationship, the target template corresponding to the operator is determined, and the data is filled into the target template using a rendering tool to generate a byte array of document fragments corresponding to charts, images, or text. The byte arrays of each document fragment are sequentially embedded into the document body structure determined by the blank template to generate the final report document.

7. The custom report generation method based on POI-TL as described in claim 6, characterized in that, The step of sequentially embedding the byte arrays of each document fragment into the document body structure determined by the blank template to generate the final report document includes: For text-type document fragments, their display style in the final report document is adjusted according to pre-configured style parameters, which include at least one of the following: font, font size, bold, and alignment.

8. A custom report generation device based on POI-TL, characterized in that, include: A preset unit is used to preset multiple templates in a file storage system. Each template has a corresponding style. The templates include blank templates, chart templates, and image templates. A creation unit is used to create configuration information for each preset template, the configuration information including at least the template type and storage path; Define a unit to define multiple operators for obtaining report data, and define the data type returned by each operator; The binding unit is used to establish the binding relationship between operators and preset templates, and to create a document template containing at least one operator according to the report structure requirements; The rendering and generation unit is used to call the corresponding operator to obtain data according to the document template, match the corresponding preset template based on the binding relationship, render the data into document components, and embed all document components into the blank template to generate the final report document.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.