Method, device, equipment, medium and product for generating self-defined format report

By using a custom report generation method and text parsing and format conversion rules to generate node tags, the flexibility of report format and the consistency of front-end and back-end rendering methods are achieved, thus solving the problem of inconsistent report content between the front-end and back-end.

CN116227461BActive Publication Date: 2026-11-20HANGZHOU DBAPPSECURITY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202211591385.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-12
Publication Date
2026-11-20
Estimated Expiration
2042-12-12

AI Technical Summary

Technical Problem

In existing technologies, inconsistencies in format during the front-end and back-end report generation process lead to significant differences in report content, and the front-end report editing flexibility and format expansion capabilities are insufficient.

Method used

By defining the output format requirements of the report, obtaining text parsing rules and format conversion rules, and using regular expressions and abstract syntax trees to generate node tags, the report's custom format generation is realized, unifying the rendering methods of the front-end and back-end.

Benefits of technology

It improves the flexibility of report formats, ensures consistency between front-end and back-end report output, and solves the problem of inconsistent rendering methods between front-end and back-end.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116227461B_ABST
    Figure CN116227461B_ABST
Patent Text Reader

Abstract

The application relates to a self-defined format report generation method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: determining a corresponding text analysis rule based on the output format requirement of the report; obtaining an analysis result corresponding to each line of text information of the report based on the text analysis rule; obtaining a node label corresponding to the analysis result based on a format conversion rule corresponding to the text analysis rule; and generating the report based on the node label. The method realizes self-definition of a report analysis rule, improves the flexibility of a report format, and uses the analysis rule to unify the rendering mode of the front end and the back end of the report, thereby solving the problem that the output results of the front end and the back end of the report are inconsistent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of report generation technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for generating custom format reports. Background Technology

[0002] In the report generation process, the front-end and back-end are usually handled separately. However, the front-end report editing format is relatively simple, which can easily lead to a lack of flexibility in the overall layout and a weak ability to expand the report format for subsequent additions. Furthermore, when the reports generated by the front-end are exported or subscribed to and sent by the back-end, the rendering methods of the front-end and back-end are different, resulting in significant differences in the report content. Summary of the Invention

[0003] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for generating custom format reports that can improve the flexibility of report formats and unify the front-end and back-end report rendering methods, in order to address the above-mentioned technical problems.

[0004] Firstly, this application provides a method for generating custom format reports, the method comprising:

[0005] Based on the output format requirements of the report, the corresponding text parsing rules are determined;

[0006] Based on the text parsing rules, obtain the parsing results corresponding to each row of text information in the report;

[0007] Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results;

[0008] The report is generated based on the node labels.

[0009] In one embodiment, obtaining the parsing results corresponding to each line of text information in the report based on the text parsing rules includes:

[0010] Based on the text parsing rules, obtain the corresponding regular expression;

[0011] Based on the regular expression, the parsing results corresponding to the text information in each line are obtained.

[0012] In one embodiment, the method further includes: converting the parsing result into an abstract syntax tree. , The format conversion rules corresponding to the text parsing rules are determined based on the abstract syntax tree.

[0013] In one embodiment, the parsing result includes the text content and text type of each line of text information.

[0014] In one embodiment, generating the report based on the node label includes:

[0015] Based on the output format requirements, add or delete the node labels corresponding to the text information in each line;

[0016] The report is generated based on the added or deleted node labels.

[0017] In one embodiment, after generating the report based on the node label, the process further includes:

[0018] Store the text parsing rules and format conversion rules corresponding to the report.

[0019] Secondly, this application also provides an apparatus for generating custom format reports, the apparatus comprising:

[0020] The rule determination module is used to determine the corresponding text parsing rules based on the output format requirements of the report;

[0021] The result acquisition module is used to acquire the parsing results corresponding to each line of text information in the report based on the text parsing rules.

[0022] The result conversion module is used to obtain the node tags corresponding to the parsing result based on the format conversion rules corresponding to the text parsing rules;

[0023] The report generation module is used to generate the report based on the node labels.

[0024] Thirdly, this application also provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0025] Step 1: Based on the output format requirements of the report, determine the corresponding text parsing rules;

[0026] Step 2: Based on the text parsing rules, obtain the parsing results corresponding to each line of text information in the report;

[0027] Step 3: Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results;

[0028] Step 4: Generate the report based on the node labels.

[0029] In one embodiment, obtaining the parsing results corresponding to each line of text information in the report based on the text parsing rules includes:

[0030] Based on the text parsing rules, obtain the corresponding regular expression;

[0031] Based on the regular expression, the parsing results corresponding to the text information in each line are obtained.

[0032] In one embodiment, the method further includes: converting the parsing result into an abstract syntax tree. , The format conversion rules corresponding to the text parsing rules determined based on the abstract syntax tree.

[0033] In one embodiment, the parsing result includes the text content and text type of each line of text information.

[0034] In one embodiment, generating the report based on the node label includes:

[0035] Based on the output format requirements, add or delete the node labels corresponding to the text information in each line;

[0036] The report is generated based on the added or deleted node labels.

[0037] In one embodiment, after generating the report based on the node label, the process further includes:

[0038] Store the text parsing rules and format conversion rules corresponding to the report.

[0039] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the contents of the first aspect described above.

[0040] Fifthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the contents of the first aspect described above.

[0041] The aforementioned method, apparatus, computer equipment, storage medium, and computer program product for generating custom format reports determine corresponding text parsing rules based on the output format requirements of the report; obtain parsing results corresponding to each line of text information in the report based on the text parsing rules; obtain node tags corresponding to the parsing results based on the format conversion rules corresponding to the text parsing rules; and generate the report based on the node tags. This achieves customization of report parsing rules, improves the flexibility of report formats, and unifies the rendering methods of the report's front-end and back-end using parsing rules, thus solving the problem of inconsistent output results between the front-end and back-end of the report. Attached Figure Description

[0042] Figure 1 This is an application environment diagram of a method for generating custom format reports in one embodiment;

[0043] Figure 2 This is a flowchart illustrating a method for generating a custom-formatted report in one embodiment.

[0044] Figure 3 This is a flowchart illustrating step S204 in one embodiment;

[0045] Figure 4 This is a flowchart illustrating step S208 in one embodiment;

[0046] Figure 5 This is a flowchart illustrating a method for generating a custom-formatted report in an example embodiment.

[0047] Figure 6 This is a structural block diagram of a device for generating custom format reports in one embodiment;

[0048] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0050] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0051] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following objects are in an "or" relationship. The terms "first," "second," and "third" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.

[0052] The method for generating custom format reports provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. Data storage system 106 can store report-related data that server 104 needs to process. Data storage system 106 can be integrated on server 104 or placed on the cloud or other network servers. On server 104, based on the output format requirements of the report, the corresponding text parsing rules are determined; based on the text parsing rules, the parsing results corresponding to each line of text information in the report are obtained; based on the format conversion rules corresponding to the text parsing rules, the node tags corresponding to the parsing results are obtained; based on the node tags, the report is generated. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, smart TVs, etc. Server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.

[0053] In one embodiment, such as Figure 2 As shown, a method for generating custom format reports is provided, which can be applied to... Figure 1 Taking the application environment in [the document] as an example, the following steps are included:

[0054] S202, Based on the output format requirements of the report, determine the corresponding text parsing rules.

[0055] Optionally, based on the type of report to be obtained, select the report output format requirements and determine the text parsing rules corresponding to the report text. The text parsing rules are used to extract text content using regular expressions corresponding to the report type.

[0056] The report types include HTML, Word, PDF, Excel, etc.

[0057] S204. Based on the text parsing rules, obtain the parsing results corresponding to each line of text information in the report.

[0058] Optionally, the report text is divided into lines according to their number of lines, and regular expressions are used to parse each line of text information using text parsing rules to obtain the parsing results for each line of text information. The parsing results include the text content and text type of each line of text information.

[0059] S206, Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results.

[0060] Optionally, in S204, the report text is parsed line by line. After obtaining the parsing result of the report text, the parsing result is converted into a text type corresponding to the report type according to the output format requirements of the report using format conversion rules, thereby obtaining the node label corresponding to the text type.

[0061] Optionally, the parsing result can be transformed into an abstract syntax tree. , Based on the abstract syntax tree, the format conversion rules are determined, and the parsing results are converted into the corresponding report type text type.

[0062] S208, Generate the report based on the node labels.

[0063] In the above-described method for generating custom format reports, the corresponding text parsing rules are determined based on the output format requirements of the report; based on the text parsing rules, the parsing results corresponding to each line of text information in the report are obtained; based on the format conversion rules corresponding to the text parsing rules, the node tags corresponding to the parsing results are obtained; and based on the node tags, the report is generated. This method realizes the customization of report parsing rules, improves the flexibility of report formats, and uses parsing rules to unify the rendering methods of the report front-end and back-end, solving the problem of inconsistent output results between the report front-end and back-end.

[0064] In one embodiment, such as Figure 3As shown, obtaining the parsing results corresponding to each line of text information in the report based on the text parsing rules includes the following steps:

[0065] S302, Based on the text parsing rules, obtain the corresponding regular expression.

[0066] Optionally, a regular expression is a text pattern used to describe one or more strings to match when searching text. Regular expressions can be customized according to text requirements, thus allowing you to obtain the parsed results corresponding to each line of text.

[0067] S304, Based on the regular expression, obtain the parsing result corresponding to the text information in each line.

[0068] In the above embodiments, the corresponding parsing results are obtained by using regular expressions corresponding to each line of text information, thereby realizing the customization of parsing rules and improving the parsing efficiency of report text.

[0069] In one embodiment, such as Figure 4 As shown, generating the report based on the node labels includes the following steps:

[0070] S402, based on the output format requirements, add or delete the node labels corresponding to the text information in each line.

[0071] Optionally, during report generation, the output content may be added or deleted. This can be achieved by simply adding or removing the node labels corresponding to each line of text in the report. Furthermore, the order of the node labels can be adjusted according to the needs of report generation and display.

[0072] S404, Generate the report based on the added or deleted node labels.

[0073] In the above embodiments, by adding or deleting node tags corresponding to each line of text information, the final generated report meets the output format requirements, thereby adjusting the report structure and improving the flexibility of the report format.

[0074] In one embodiment, after generating the report based on the node tags, the method further includes storing the text parsing rules and the format conversion rules corresponding to the report.

[0075] Optionally, the front-end and back-end often do not have consistent reporting rules when generating and displaying reports, which can easily lead to inconsistencies between the reports generated by the front-end and those exported by the back-end. Therefore, the text parsing rules and format conversion rules corresponding to the reports are stored so that the front-end and back-end use the same set of reporting rules when generating reports.

[0076] In the above embodiments, by storing the text parsing rules and format conversion rules corresponding to the reports, the front-end and back-end use the same set of text parsing rules and format conversion rules when generating reports, so that the front-end and back-end report exports are consistent, and a unified front-end and back-end report rendering method is achieved.

[0077] In one example embodiment, such as Figure 5 As shown, a method for generating reports with custom formats is provided, which is applied to the front end to generate HTML format reports. The specific steps are as follows:

[0078] S501, according to the text parsing rules of HTML format reports, uses regular expressions to parse each line of text information in the newly created report line by line to obtain the parsing results.

[0079] Suppose a line of text contains the message "123abchttps: / / www.xxx.com". The regular expression in the text parsing rules of an HTML report is: / (?). <text> \w*)|(? <url>The parsed result of url(\w*)) / after applying a regular expression is: 123abc|url('https: / / www.xxx.com').

[0080] S502 transforms the parsed result into an abstract syntax tree.

[0081] The parsed result 123abc|url('https: / / www.xxx.com') is transformed into an abstract syntax tree: {type:'a', attrs:{'url':'https: / / www.baidu.com'}, text:'123abc'}.

[0082] S503, based on the type definition of each line of text in the abstract syntax tree, transform the parsing result into the corresponding text type and obtain the node label. In the above abstract syntax tree, type is 'a', so the parsing result structure of this line is transformed into... Node labels.

[0083] S504 generates an HTML report based on the node tags corresponding to each line of text information and displays it on the front end. It stores the text parsing rules and format conversion rules for each line of the HTML report.

[0084] When generating HTML reports, node tags can be added or removed based on the report content.

[0085] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0086] Based on the same inventive concept, this application also provides a custom format report generation apparatus for implementing the custom format report generation method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more custom format report generation apparatus embodiments provided below can be found in the limitations of the custom format report generation method described above, and will not be repeated here.

[0087] In one embodiment, such as Figure 6 As shown, a device for generating custom format reports is provided, including: a rule determination module 62, a result acquisition module 64, a result conversion module 66, and a report generation module 68, wherein:

[0088] The rule determination module 62 is used to determine the corresponding text parsing rules based on the output format requirements of the report.

[0089] The result acquisition module 64 is used to acquire the parsing results corresponding to each line of text information in the report based on the text parsing rules.

[0090] The result conversion module 66 is used to obtain the node tags corresponding to the parsing result based on the format conversion rules corresponding to the text parsing rules.

[0091] The report generation module 68 is used to generate the report based on the node labels.

[0092] In one embodiment, the result acquisition module 64 includes: acquiring the corresponding regular expression based on the text parsing rules; and acquiring the parsing result corresponding to each line of text information based on the regular expression.

[0093] In one embodiment, the result acquisition module 64 includes: converting the parsing result into an abstract syntax tree. , The format conversion rules corresponding to the text parsing rules are determined based on the abstract syntax tree.

[0094] In one embodiment, the parsing result includes the text content and text type of each line of text information.

[0095] In one embodiment, the report generation module 68 includes:

[0096] Based on the output format requirements, add or delete the node labels corresponding to the text information in each line; generate the report based on the added or deleted node labels.

[0097] In one embodiment, the report generation module 68 includes: storing the text parsing rules and the format conversion rules corresponding to the report.

[0098] The modules in the aforementioned custom format report generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0099] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores report-related data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a method for generating custom-formatted reports.

[0100] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0101] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0102] Step 1: Based on the output format requirements of the report, determine the corresponding text parsing rules;

[0103] Step 2: Based on the text parsing rules, obtain the parsing results corresponding to each line of text information in the report;

[0104] Step 3: Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results;

[0105] Step 4: Generate the report based on the node labels.

[0106] In one embodiment, the processor further performs the following steps when executing the computer program:

[0107] Based on the text parsing rules, obtain the corresponding regular expression;

[0108] Based on the regular expression, the parsing results corresponding to the text information in each line are obtained.

[0109] In one embodiment, the processor further performs the following steps when executing the computer program:

[0110] The parsing result is transformed into an abstract syntax tree. , The format conversion rules corresponding to the text parsing rules are determined based on the abstract syntax tree.

[0111] In one embodiment, the parsing result includes the text content and text type of each line of text information.

[0112] In one embodiment, the processor further performs the following steps when executing the computer program:

[0113] Based on the output format requirements, add or delete the node labels corresponding to the text information in each line; generate the report based on the added or deleted node labels.

[0114] In one embodiment, the processor further performs the following steps when executing the computer program:

[0115] Store the text parsing rules and format conversion rules corresponding to the report.

[0116] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0117] Step 1: Based on the output format requirements of the report, determine the corresponding text parsing rules;

[0118] Step 2: Based on the text parsing rules, obtain the parsing results corresponding to each line of text information in the report;

[0119] Step 3: Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results;

[0120] Step 4: Generate the report based on the node labels.

[0121] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0122] Based on the text parsing rules, obtain the corresponding regular expression;

[0123] Based on the regular expression, the parsing results corresponding to the text information in each line are obtained.

[0124] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0125] The parsing result is transformed into an abstract syntax tree, and the format conversion rules corresponding to the text parsing rules are determined based on the abstract syntax tree.

[0126] In one embodiment, the parsing result includes the text content and text type of each line of text information.

[0127] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0128] Based on the output format requirements, add or delete the node labels corresponding to the text information in each line; generate the report based on the added or deleted node labels.

[0129] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0130] Store the text parsing rules and format conversion rules corresponding to the report.

[0131] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0132] Step 1: Based on the output format requirements of the report, determine the corresponding text parsing rules;

[0133] Step 2: Based on the text parsing rules, obtain the parsing results corresponding to each line of text information in the report;

[0134] Step 3: Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results;

[0135] Step 4: Generate the report based on the node labels.

[0136] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0137] Based on the text parsing rules, obtain the corresponding regular expression;

[0138] Based on the regular expression, the parsing results corresponding to the text information in each line are obtained.

[0139] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0140] The parsing result is transformed into an abstract syntax tree, and the format conversion rules corresponding to the text parsing rules are determined based on the abstract syntax tree.

[0141] In one embodiment, the parsing result includes the text content and text type of each line of text information.

[0142] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0143] Based on the output format requirements, add or delete the node labels corresponding to the text information in each line; generate the report based on the added or deleted node labels.

[0144] In one embodiment, when the computer program is executed by the processor, it further performs the following steps:

[0145] Store the text parsing rules and format conversion rules corresponding to the report.

[0146] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0147] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0148] 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.

[0149] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.< / url> < / text>

Claims

1. A method for generating a custom-formatted report, characterized in that, The method includes: Based on the output format requirements of the report, the corresponding text parsing rules are determined; Based on the text parsing rules, obtain the parsing results corresponding to each row of text information in the report; The parsing result is transformed into an abstract syntax tree, and the format conversion rule corresponding to the text parsing rule is determined based on the abstract syntax tree; Based on the format conversion rules corresponding to the text parsing rules, obtain the node tags corresponding to the parsing results; The report is generated based on the node labels; Store the text parsing rules and format conversion rules corresponding to the report; When generating reports on the front end and the back end, the same set of text parsing rules and format conversion rules are used to ensure that the reports generated on the front end and the back end are exported in a consistent manner, so as to achieve a unified front end and back end report rendering method. The step of obtaining the node tags corresponding to the parsing result based on the format conversion rules corresponding to the text parsing rules includes: Based on the type definition of each line of text in the report in the abstract syntax tree, the parsing result is converted into the corresponding text type, and the node label is obtained.

2. The method for generating custom format reports according to claim 1, characterized in that, The step of obtaining the parsing results corresponding to each line of text information in the report based on the text parsing rules includes: Based on the text parsing rules, obtain the corresponding regular expression; Based on the regular expression, the parsing results corresponding to the text information in each line are obtained.

3. The method for generating custom format reports according to claim 1 or 2, characterized in that, The parsing results include the text content and text type of each line of text information.

4. The method for generating custom format reports according to claim 1, characterized in that, The process of generating the report based on the node labels includes: Based on the output format requirements, add or delete the node labels corresponding to the text information in each line; The report is generated based on the added or deleted node labels.

5. A device for generating custom format reports, characterized in that, The device includes: The rule determination module is used to determine the corresponding text parsing rules based on the output format requirements of the report; The result acquisition module is used to acquire the parsing results corresponding to each line of text information in the report based on the text parsing rules. The result conversion module is used to convert the parsing result into an abstract syntax tree, determine the format conversion rule corresponding to the text parsing rule based on the abstract syntax tree, and obtain the node label corresponding to the parsing result based on the format conversion rule corresponding to the text parsing rule; the step of obtaining the node label corresponding to the parsing result based on the format conversion rule corresponding to the text parsing rule includes: converting the parsing result into the corresponding text type according to the type definition of each line of text in the report in the abstract syntax tree, and obtaining the node label; The report generation module is used to generate the report based on the node tags and store the text parsing rules and format conversion rules corresponding to the report. When generating reports on the front end and the back end, the same set of text parsing rules and format conversion rules are used to ensure that the reports generated on the front end and the back end are exported in a consistent manner, so as to achieve a unified front end and back end report rendering method.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Text resolution system and method

    CN101488123A

  • Report generation method and device

    CN110232178A

  • Implementation mode of cross-platform electronic report

    CN114118018A

  • Statistical data analysis report display method and device

    CN114817649A

  • Process document automatic generation method and device, computer equipment and storage medium

    CN115268933A