CN111325012B - word report generation method and system - Google Patents

word report generation method and system Download PDF

Info

Publication number
CN111325012B
CN111325012B CN202010074875.1A CN202010074875A CN111325012B CN 111325012 B CN111325012 B CN 111325012B CN 202010074875 A CN202010074875 A CN 202010074875A CN 111325012 B CN111325012 B CN 111325012B
Authority
CN
China
Prior art keywords
document
modules
report
sub
report data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010074875.1A
Other languages
Chinese (zh)
Other versions
CN111325012A (en
Inventor
曹臻
李国辉
李凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qianxin Technology Group Co Ltd
Secworld Information Technology Beijing Co Ltd
Original Assignee
Qianxin Technology Group Co Ltd
Secworld Information Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qianxin Technology Group Co Ltd, Secworld Information Technology Beijing Co Ltd filed Critical Qianxin Technology Group Co Ltd
Priority to CN202010074875.1A priority Critical patent/CN111325012B/en
Publication of CN111325012A publication Critical patent/CN111325012A/en
Application granted granted Critical
Publication of CN111325012B publication Critical patent/CN111325012B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a word report generation method, which comprises the following steps: obtaining a target word template file, wherein the target word template file comprises a plurality of sub-modules, and the sub-modules are configured with corresponding document tags; acquiring report data, wherein the report data is configured with corresponding document tags; analyzing the target word template file to obtain a target xml file corresponding to the target word template file; circularly analyzing the report data according to the document tags to obtain the number of sub-modules corresponding to each document tag; circularly copying the sub-modules corresponding to the document labels to obtain a plurality of label modules; and replacing the report data into the label content corresponding to the plurality of label modules to generate a target word report file corresponding to the report data. The invention has the beneficial effects that: the word report with complex structure can be flexibly processed.

Description

word report generation method and system
Technical Field
The embodiment of the invention relates to the field of report generation, in particular to a word report generation method and system.
Technical Field
Aiming at the existing word report generation, if a multi-project and multi-team public use report service is provided, in the existing word report generation scheme, a plurality of word report styles cannot be realized uniformly, and only single types of tables, lists and characters can be circularly output, so that reports of different styles and self-defined report structure templates cannot be supported; word reports are generated aiming at complex structuring, so that the method is not flexible and low in efficiency.
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a method and a system for generating a word report, which can flexibly process a word report with a complex structure.
In order to achieve the above object, an embodiment of the present invention provides a method for generating a word report, including:
obtaining a target word template file, wherein the target word template file comprises a plurality of sub-modules, and the sub-modules are configured with corresponding document tags;
acquiring report data, wherein the report data is configured with corresponding document tags;
analyzing the target word template file to obtain a target xml file corresponding to the target word template file;
circularly analyzing the report data according to the document tags to obtain the number of sub-modules corresponding to each document tag;
circularly copying the sub-modules corresponding to the document labels to obtain a plurality of label modules;
and replacing the report data into the label content corresponding to the plurality of label modules to generate a target word report file corresponding to the report data.
Further, the obtaining report data, where the report data is configured with a corresponding document tag includes:
acquiring report data and a document tag corresponding to the report data;
and packaging the report data in json data format, and associating the document tag with the report data for data transmission.
Further, the analyzing the report data according to the document tags to obtain the number of sub-modules corresponding to each document tag includes:
configuring corresponding circulation labels for the document labels of each sub-module;
and analyzing the document labels of the report data according to the cyclic labels to obtain the number of sub-modules corresponding to the document labels.
Further, the circularly copying the sub-modules corresponding to the document labels to obtain a plurality of label modules includes:
and circularly copying the sub-modules corresponding to the document labels according to the circulation labels corresponding to the document labels to obtain a plurality of label modules.
Further, the circularly copying the sub-modules corresponding to the document labels to obtain a plurality of label modules further includes:
when the target word template file comprises a plurality of sub-modules with circulation levels, circulating and copying the sub-modules with the quantity corresponding to the document labels according to the circulation levels to obtain a plurality of label modules.
Further, the replacing the report data to the tag contents corresponding to the plurality of tag modules to generate the target word report file corresponding to the target word template file includes:
acquiring a tag name of the tag content;
acquiring a label value corresponding to the label name in the report data according to the label name;
and replacing the tag value into the tag module according to the tag name to generate a target word report file corresponding to the target word template file.
Further, the method further comprises:
acquiring a first document format corresponding to the sub-module and a second document format corresponding to the tag module;
when the first document format is modified, the second document format is modified accordingly.
In order to achieve the above object, an embodiment of the present invention provides a word report generating system, including:
the first acquisition module is used for acquiring a target word template file, wherein the target word template file comprises a plurality of sub-modules, and the sub-modules are configured with corresponding document tags;
the second acquisition module is used for acquiring report data, and the report data is configured with corresponding document tags;
the first analysis module is used for analyzing the target word template file to obtain a target xml file corresponding to the target word template file;
the second analysis module is used for circularly analyzing the report data according to the document labels so as to obtain the number of sub-modules corresponding to each document label;
the copying module is used for circularly copying the sub-modules of the document labels corresponding to the document labels to obtain a plurality of label modules;
and the generating module is used for replacing the report data into the label contents corresponding to the label modules so as to generate a target word report file corresponding to the report data.
To achieve the above object, an embodiment of the present invention provides a computer device, where the computer device includes a memory and a processor, and the memory stores a computer program that can be executed on the processor, and the computer program is executed by the processor to implement the steps of the word report generating method as described above.
To achieve the above object, embodiments of the present invention provide a computer-readable storage medium having stored therein a computer program executable by at least one processor to cause the at least one processor to perform the steps of the word report generation method as described above.
According to the word report generating method and system provided by the embodiment of the invention, the number of sub-modules corresponding to the document tags in each report data is obtained by circularly analyzing the report data according to the document tags of the target word template file, and then each sub-module is circularly copied according to the number to obtain a tag module, and the report data is replaced into tag contents corresponding to the tag module to obtain the target word report file; the method can carry out cyclic analysis on the cyclic structure in the target report data, and copy the sub-modules according to the analysis result, so that the word report can be flexibly generated.
Drawings
Fig. 1 is an environmental schematic diagram of a first embodiment of the present invention.
FIG. 2 is a flowchart of a word report generation method according to a second embodiment of the present invention.
Fig. 3 is a flowchart of step S110 of a word report generation method according to a second embodiment of the present invention.
Fig. 4 is a flowchart of step S120 of the word report generation method according to the second embodiment of the present invention.
FIG. 5 is a flowchart of step S140 of a word report generation method according to a second embodiment of the present invention.
Fig. 6 is a flowchart of step S160 of the word report generation method according to the second embodiment of the present invention.
FIG. 7 is a schematic diagram of a program module of a word report generating system according to a third embodiment of the present invention.
Fig. 8 is a schematic diagram of a hardware structure of a fourth embodiment of the computer device of the present invention.
FIG. 9 is a flowchart of a second embodiment of a word report generation method according to the present invention.
FIG. 10 is a flowchart of a third embodiment of a word report generation method according to the present invention.
FIG. 11 is a flowchart of a fourth embodiment of a word report generation method according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1, an environmental schematic of an embodiment of the present invention is shown. The environment diagram includes a computing or device 2, an application 10, a first interface 11, a second interface 12, a word template file store 13, a report data store 14, a user 15, and a network 16. The user 15 uploads the template identifier of the word template file to the application program 10, the application program 10 starts the first interface 11 to find the corresponding target word template file from the word template file storage area 13 through the network 17, the target word template file is transmitted to the application program 10, and the application program 10 analyzes the target word template file to obtain the target xml file; the user 15 uploads the report data to the application program 10 through the second interface 12, the report data can be obtained through a network, and then the report data is uploaded to the application program 10 through the second interface 12, so that the application program 10 analyzes the target xml file through the report data to obtain the number of sub-modules corresponding to the file tag in the report data, and finally the generation of the target word report file is realized.
It should be noted that the word template file storage area 13 and the report data storage area 14 may be disposed in the computing device 2, so as to increase the query speed.
Example two
Referring to fig. 2, a flowchart illustrating steps of a word report generation method according to a second embodiment of the present invention is shown. It will be appreciated that the flow charts in the method embodiments are not intended to limit the order in which the steps are performed. An exemplary description will be made below with the computer device 2 as an execution subject. Specifically, the following is described.
Step S100, a target word template file is obtained, wherein the target word template file comprises a plurality of sub-modules, and the sub-modules are configured with corresponding document tags.
Specifically, a plurality of word template files are pre-configured, the format of the word template files is docx format, and corresponding template identifiers are configured for the word template files according to the calling interfaces of the word template files. In the word template file, a plurality of sub-modules of different types are pre-configured, and the sub-modules can be of the types of tables, lists, characters and the like. The sub-module sets the format of the picture to be PNG format, and pre-stores default pictures so as to output the default pictures in the word report when no picture exists in the xml file.
Step S110, report data is acquired, wherein the report data is configured with corresponding document labels.
Specifically, the report data comprises text, pictures, numbers and other types of data, the report data is written according to a json language format to obtain json data, and corresponding document tags are configured for the report data according to the document tags in the word template document, so that the report data can be circularly analyzed.
Illustratively, referring to fig. 3, the step S110 further includes:
step S111, obtaining report data and a document tag corresponding to the report data.
Specifically, when the user performs word report design, required report data is acquired, and the transmission format of the report data can be json data format. As shown in fig. 9, the report data is first combined and subjected to planning processing, so that a corresponding word report file can be obtained through the embodiment of the invention according to the report data and the template identifier.
And step S112, packaging the report data in json data format, and associating the document tag with the report data for data transmission.
Specifically, according to report data and a document label thereof in advance, writing according to json language, packaging the report data in json language in a key-value key format, and transmitting the report data by using the json data when the report data is acquired.
Step S120, analyzing the target word template file to obtain a target xml file corresponding to the target word template file.
Specifically, decompressing the target word template file to obtain a target xml file corresponding to the target word template file, rendering the target word template file in a docx format through the xml file, modifying the xml file, and running the xml file to regenerate the word template file. The target word template file can be decompressed by using a general decompression application, the target xml file corresponding to the target word template file is obtained after decompression, and language formats in the target xml file can be arranged so as to be convenient for executing the operation of circularly analyzing report data on the running target xml file.
Further, as shown in fig. 10, by decompressing the target word template file, a template representation is obtained, and the target xml file is obtained according to the template identifier, so that when the user needs the target xml file, the template identifier is directly called to obtain.
And step S130, circularly analyzing the report data according to the circular labels to obtain the number of sub-modules corresponding to each document label.
Specifically, each sub-module is configured with a corresponding loop tag and document tag that corresponds to a document tag in the target xml file. For example: the word template file comprises grammar [ item; repeat=data.arr; repeat type=loop ], where item represents a template identifier, repeat represents a loop tag, data.arr represents loop content corresponding to the loop tag, that is, a document tag, loop represents a type of the loop tag, and when writing, the term is ended in [/loop ]. And when the report data is analyzed, circulating with the circulating content of the data. Arr to find the number of the sub-modules corresponding to the document tag.
Illustratively, referring to fig. 4, the step S130 further includes:
step S131, configuring corresponding circulating labels for the document labels of the sub-modules.
Specifically, configuring a corresponding circulation label for each document label so as to search circulation content in a circulation mode according to the circulation type of the circulation label; for example, it can be defined as: when the circulation content is data.arr, loop circulation is carried out; the circulation content is record. List, and list circulation is carried out; the circulation content is record.
And step S132, analyzing the document labels of the report data according to the cyclic labels to obtain the number of sub-modules corresponding to the document labels.
Specifically, when fields corresponding to the circulating content of the circulating label are queried in the report data, the number of the fields is calculated, the space is occupied in the word report, the space is occupied according to the number of the sub-modules, and after the report data are circulated, a word report frame is formed.
And step S140, circularly copying the sub-modules corresponding to the document labels to obtain a plurality of label modules.
Specifically, according to the number of sub-modules corresponding to the obtained document labels, the sub-modules are repeated circularly to obtain label modules corresponding to the plurality of circulation sub-modules, namely after each sub-module circulates, a corresponding label module is obtained, so that content replacement is facilitated.
Illustratively, the step S140 further includes:
and circularly copying the sub-modules with the quantity corresponding to the document labels according to the circulation labels corresponding to the document labels of the sub-modules to obtain a plurality of label modules.
Specifically, according to the circulation content of the document tag, the sub-module corresponding to the document tag is duplicated according to the circulation type of the circulation tag, so as to obtain a plurality of tag modules. For example: writing grammar [ item.name ] in the word template file; repeat = record. repeat type=text ], which indicates that in the current location item.
Illustratively, the step S140 further includes:
when the target word template file comprises a plurality of sub-modules with circulation levels, circulating and copying the sub-modules with the quantity corresponding to the document labels according to the circulation levels to obtain a plurality of label modules.
Specifically, if the sub-module is a multi-layer cycle, the cycle label with the lowest cycle grade is analyzed first, the cycle grade in the cycle content of the upper layer of the cycle label of the layer is added with a key to replace the cycle grade in the cycle content of the layer. For example: if the first layer of circulating label is data, the circulating grade is assigned as first; the second layer circulation label is first. Arr, the circulation grade is assigned as second, and the value output by the second layer is assigned as second. Value; when the second layer document label is replaced, the output circulation level second value is replaced by fisrt.arr.second_key.value, and when the first layer is recycled, the circulation level first of the first layer document label is replaced by data.first_key, so that the corresponding value can be directly obtained through an array level, and multi-level circulation nesting is realized.
And step S150, replacing the report data into the label content corresponding to the label modules to generate a target word report file corresponding to the report data.
Specifically, according to the label grade, report data which needs to be replaced by each label module is obtained, the label content comprises label names, and according to the label names, the report data and the label modules are filled in one-to-one correspondence to obtain a target word report file.
Illustratively, referring to fig. 5, the step S150 further includes:
step S151, obtaining the tag name of the tag content.
Specifically, a desired tag name is filled in the tag content in advance, for example: the label content is a table, and report data needs to be replaced according to names and scores, and the names and the scores are label names.
Step S152, obtaining a label value corresponding to the label name in the report data according to the label name.
Specifically, the report data is packaged into the target xml file in a key-value form, the key represents the tag name, the value represents the tag value, the field content of the tag name in the report data and the tag content is compared, and if the field content is consistent, the field content (namely the tag value) of the value is obtained.
And step 153, replacing the tag value into the tag module according to the tag name to generate a target word report file corresponding to the target word template file.
Specifically, field contents corresponding to the tag values are replaced into the tag module, the tag values correspond to the tag names one by one, and after filling is completed, the target word report file is obtained.
Illustratively, as shown in fig. 11, a user writes a word template file through xml data language, analyzes, i.e. compresses, the word template file, and obtains an xml file corresponding to the word template file; analyzing report data according to the document labels, and recycling the structure of the report data to obtain the corresponding quantity of the document labels; when the template is preprocessed, copying the dom number of the xml file (namely, the content of the sub-module corresponding to each document label in the xml file) according to the data content corresponding to the document label in the report data, and then assigning and replacing the report data to the sub-module to obtain the word report file.
Illustratively, referring to fig. 6, the method further includes step S160:
step S161, acquiring a first document format corresponding to the sub-module and a second document format corresponding to the tag module.
Specifically, the first document format of the sub-module may be a document format corresponding to a table, a list, a text, etc.; the second document format corresponding to the label module is a word report document format and a docx format.
Step S162, when the first document format is modified, the second document format is modified accordingly.
Specifically, if in the first document format, the sub-modules in the form of a table, a list, a text, etc. are changed, for example, operations such as enlarging a picture area and thickening a text font are performed, and when a word report is generated, the tag module corresponding to the sub-module is changed accordingly.
Example III
With continued reference to fig. 7, a schematic program module diagram of a word report generating system according to a third embodiment of the present invention is shown. In this embodiment, the word report generating system 20 may include or be divided into one or more program modules, where the one or more program modules are stored in a storage medium and executed by one or more processors to complete the present invention, and may implement the word report generating method described above. Program modules in accordance with the embodiments of the present invention are directed to a series of computer program instruction segments capable of performing particular functions, and are more suited to describing the execution of the word report generating system 20 on a storage medium than the program itself. The following description will specifically describe functions of each program module of the present embodiment:
the first obtaining module 200 is configured to obtain a target word template file, where the target word template file includes a plurality of sub-modules, and the sub-modules are configured with corresponding document tags.
Specifically, a plurality of word template files are pre-configured, the formats of the word template files are docx formats, corresponding template identifiers are configured for the word template files according to calling interfaces of the word template files, and the template identifiers of users are received to obtain corresponding target word template files. In the word template file, a plurality of sub-modules of different types are pre-configured, and the sub-modules can be of the types of tables, lists, characters and the like. The sub-module sets the format of the picture to be PNG format, and pre-stores default pictures so as to output the default pictures in the word report when no picture exists in the xml file.
The second obtaining module 202 is configured to obtain report data, where the report data is configured with a corresponding document tag.
Specifically, the report data comprises text, pictures, numbers and other types of data, the report data is written according to a json language format to obtain json data, and corresponding document tags are configured for the report data according to the document tags in the word template document, so that the report data can be circularly analyzed.
Illustratively, the second acquisition module 202 is further configured to:
and acquiring report data and a document tag corresponding to the report data.
Specifically, when the user performs word report design, required report data is acquired, and the transmission format of the report data can be json data format. As shown in fig. 9, the report data is first combined and subjected to planning processing, so that a corresponding word report file can be obtained through the embodiment of the invention according to the report data and the template identifier.
And packaging the report data in json data format, and associating the document tag with the report data for data transmission.
Specifically, according to report data and a document label thereof in advance, writing according to json language, packaging the report data in json language in a key-value key format, and transmitting the report data by using the json data when the report data is acquired.
The first parsing module 204 is configured to parse the target word template file to obtain a target xml file corresponding to the target word template file.
Specifically, decompressing the target word template file to obtain a target xml file corresponding to the target word template file, rendering the target word template file in a docx format through the xml file, modifying the xml file, and running the xml file to regenerate the word template file. The target word template file can be decompressed by using a general decompression application, the target xml file corresponding to the target word template file is obtained after decompression, and language formats in the target xml file can be arranged so as to be convenient for executing the operation of circularly analyzing report data on the running target xml file.
Illustratively, as shown in fig. 10, the template representation is obtained by decompressing the target word template file, and the target xml file is obtained according to the template identifier, so that when the user needs the target xml file, the template identifier is directly called for obtaining.
And a second parsing module 206, configured to parse the report data according to the cyclic tag in a cyclic manner, so as to obtain the number of sub-modules corresponding to each document tag.
Specifically, each sub-module is configured with a corresponding loop tag and document tag that corresponds to a document tag in the target xml file. For example: the word template file comprises grammar [ item; repeat=data.arr; repeat type=loop ], where item represents a template identifier, repeat represents a loop tag, data.arr represents loop content corresponding to the loop tag, that is, a document tag, loop represents a type of the loop tag, and when writing, the term is ended in [/loop ]. And when the report data is analyzed, circulating with the circulating content of the data. Arr to find the number of the sub-modules corresponding to the document tag.
Illustratively, the second parsing module 206 is further configured to:
and configuring corresponding circulating labels for the document labels of each sub-module.
Specifically, configuring a corresponding circulation label for each document label so as to search circulation content in a circulation mode according to the circulation type of the circulation label; for example, it can be defined as: when the circulation content is data.arr, loop circulation is carried out; the circulation content is record. List, and list circulation is carried out; the circulation content is record.
And analyzing the document labels of the report data according to the cyclic labels to obtain the number of sub-modules corresponding to the document labels.
Specifically, when fields corresponding to the circulating content of the circulating label are queried in the report data, the number of the fields is calculated, the space is occupied in the word report, the space is occupied according to the number of the sub-modules, and after the report data are circulated, a word report frame is formed.
And the replication module 208 is configured to circularly replicate the sub-modules corresponding to the document labels, to obtain a plurality of label modules.
Specifically, according to the number of sub-modules corresponding to the obtained document labels, the sub-modules are repeated circularly to obtain label modules corresponding to the plurality of circulation sub-modules, namely after each sub-module circulates, a corresponding label module is obtained, so that content replacement is facilitated.
Illustratively, the replication module 208 is further configured to:
and circularly copying the sub-modules corresponding to the document labels according to the circulation labels corresponding to the document labels to obtain a plurality of label modules.
Specifically, according to the circulation content of the document tag, the sub-module corresponding to the document tag is duplicated according to the circulation type of the circulation tag, so as to obtain a plurality of tag modules. For example: writing grammar [ item.name ] in the word template file; repeat = record. repeat type=text ], which indicates that in the current location item.
Illustratively, the replication module 208 is further configured to:
when the target word template file comprises a plurality of sub-modules with circulation levels, circulating and copying the sub-modules with the quantity corresponding to the document labels according to the circulation levels to obtain a plurality of label modules.
Specifically, if the sub-module is a multi-layer cycle, the cycle label with the lowest cycle grade is analyzed first, the cycle grade in the cycle content of the upper layer of the cycle label of the layer is added with a key to replace the cycle grade in the cycle content of the layer. For example: if the first layer of circulating label is data, the circulating grade is assigned as first; the second layer circulation label is first. Arr, the circulation grade is assigned as second, and the value output by the second layer is assigned as second. Value; when the second layer document label is replaced, the output circulation level second value is replaced by fisrt.arr.second_key.value, and when the first layer is recycled, the circulation level first of the first layer document label is replaced by data.first_key, so that the corresponding value can be directly obtained through an array level, and multi-level circulation nesting is realized.
And the generating module 210 is configured to replace the report data in tag contents corresponding to the plurality of tag modules, so as to generate a target word report file corresponding to the report data.
Specifically, according to the label grade, report data which needs to be replaced by each label module is obtained, the label content comprises label names, and according to the label names, the report data and the label modules are filled in one-to-one correspondence to obtain a target word report file.
Illustratively, the generating module 210 is further configured to:
and acquiring the tag name of the tag content.
Specifically, a desired tag name is filled in the tag content in advance, for example: the label content is a table, and report data needs to be replaced according to names and scores, and the names and the scores are label names.
And acquiring a label value corresponding to the label name in the report data according to the label name.
Specifically, the report data is packaged into the target xml file in a key-value form, the key represents the tag name, the value represents the tag value, the field content of the tag name in the report data and the tag content is compared, and if the field content is consistent, the field content (namely the tag value) of the value is obtained.
And replacing the tag value into the tag module according to the tag name to generate a target word report file corresponding to the target word template file.
Specifically, field contents corresponding to the tag values are replaced into the tag module, the tag values correspond to the tag names one by one, and after filling is completed, the target word report file is obtained.
Example IV
Referring to fig. 8, a hardware architecture diagram of a computer device according to a fourth embodiment of the invention is shown. In this embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction. The computer device 2 may be a rack server, a blade server, a tower server, or a rack server (including a stand-alone server, or a server cluster made up of multiple servers), or the like. As shown in fig. 7, the computer device 2 includes, but is not limited to, at least a memory 21, a processor 22, a network interface 23, and a word report generating system 20, which are communicatively connected to each other via a system bus. Wherein:
in this embodiment, the memory 21 includes at least one type of computer-readable storage medium including flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the computer device 2. Of course, the memory 21 may also include both internal storage units of the computer device 2 and external storage devices. In this embodiment, the memory 21 is generally used to store an operating system and various application software installed on the computer device 2, such as program codes of the word report generating system 20 of the third embodiment. Further, the memory 21 may be used to temporarily store various types of data that have been output or are to be output.
The processor 22 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 22 is typically used to control the overall operation of the computer device 2. In this embodiment, the processor 22 is configured to run the program code stored in the memory 21 or process data, for example, run the word report generating system 20, so as to implement the word report generating method of the second embodiment.
The network interface 23 may comprise a wireless network interface or a wired network interface, which network interface 23 is typically used for establishing a communication connection between the server 2 and other electronic devices. For example, the network interface 23 is used to connect the server 2 to an external terminal through a network, establish a data transmission channel and a communication connection between the server 2 and the external terminal, and the like. The network may be an Intranet (Intranet), the Internet (Internet), a global system for mobile communications (Global System of Mobile communication, GSM), wideband code division multiple access (Wideband Code Division Multiple Access, WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), wi-Fi, or other wireless or wired network. It is noted that fig. 8 only shows a computer device 2 having components 20-23, but it is understood that not all of the illustrated components are required to be implemented, and that more or fewer components may alternatively be implemented.
In this embodiment, the word report generating system 20 stored in the memory 21 may be further divided into one or more program modules, which are stored in the memory 21 and executed by one or more processors (the processor 22 in this embodiment) to complete the present invention.
For example, fig. 7 shows a schematic program module diagram of a third embodiment of the word report generating system 20, where the word report generating system 20 may be divided into a first obtaining module 200, a second obtaining module 202, a first parsing module 204, a second parsing module 206, a copying module 208, and a generating module 210. Program modules depicted herein, being indicative of a sequence of computer program instruction segments capable of performing particular functions, are preferred over programs in describing the execution of the word report generating system 20 by the computer device 2. The specific functions of the program modules 200-210 are described in detail in the third embodiment, and are not described herein.
Example five
The present embodiment also provides a computer-readable storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, which when executed by a processor, performs the corresponding functions. The computer readable storage medium of the present embodiment is configured to store the word report generating system 20, and implement the word report generating method of the second embodiment when executed by the processor.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (9)

1. The word report generation method is characterized by comprising the following steps of:
obtaining a target word template file, wherein the target word template file comprises a plurality of sub-modules, and the sub-modules are configured with corresponding document tags;
acquiring report data, wherein the report data is configured with corresponding document tags;
analyzing the target word template file to obtain a target xml file corresponding to the target word template file;
circularly analyzing the report data according to the document tags to obtain the number of sub-modules corresponding to each document tag;
circularly copying the sub-modules corresponding to the document labels to obtain a plurality of label modules;
replacing the report data into label contents corresponding to the plurality of label modules to generate a target word report file corresponding to the report data;
analyzing the report data according to the document tags to obtain the number of sub-modules corresponding to each document tag comprises:
configuring corresponding circulation labels for the document labels of each sub-module;
and analyzing the document labels of the report data according to the cyclic labels to obtain the number of sub-modules corresponding to the document labels.
2. The word report generating method according to claim 1, wherein the obtaining report data, the report data being configured with corresponding document tags, includes:
acquiring report data and a document tag corresponding to the report data;
and packaging the report data in json data format, and associating the document tag with the report data for data transmission.
3. The word report generating method according to claim 1, wherein circularly copying the sub-modules corresponding to the document tags to obtain a plurality of tag modules includes:
and circularly copying the sub-modules with the quantity corresponding to the document labels according to the circulation labels corresponding to the document labels of the sub-modules to obtain a plurality of label modules.
4. The word report generating method according to claim 3, wherein the circularly copying the sub-modules corresponding to the document tags to obtain a plurality of tag modules further comprises:
when the target word template file comprises a plurality of sub-modules with circulation levels, circulating and copying the sub-modules with the quantity corresponding to the document labels according to the circulation levels to obtain a plurality of label modules.
5. The method of generating a word report according to claim 1, wherein the replacing the report data into tag contents corresponding to the plurality of tag modules to generate a target word report file corresponding to the target word template file includes:
acquiring a tag name of the tag content;
acquiring a label value corresponding to the label name in the report data according to the label name;
and replacing the tag value into the tag module according to the tag name to generate a target word report file corresponding to the target word template file.
6. The word report generation method of claim 1, further comprising:
acquiring a first document format corresponding to the sub-module and a second document format corresponding to the tag module;
when the first document format is modified, the second document format is modified accordingly.
7. A word report generation system, comprising:
the first acquisition module is used for acquiring a target word template file, wherein the target word template file comprises a plurality of sub-modules, and the sub-modules are configured with corresponding document tags;
the second acquisition module is used for acquiring report data, and the report data is configured with corresponding document tags;
the first analysis module is used for analyzing the target word template file to obtain a target xml file corresponding to the target word template file;
the second analysis module is used for circularly analyzing the report data according to the document labels so as to obtain the number of sub-modules corresponding to each document label;
the copying module is used for circularly copying the sub-modules of the document labels corresponding to the document labels to obtain a plurality of label modules;
the generating module is used for replacing the report data into the label content corresponding to the plurality of label modules so as to generate a target word report file corresponding to the report;
the second analysis module is also used for configuring corresponding circulation labels for the document labels of each sub-module; and analyzing the document labels of the report data according to the cyclic labels to obtain the number of sub-modules corresponding to the document labels.
8. A computer device, characterized in that it comprises a memory, a processor, on which a computer program is stored which can be run on the processor, which computer program, when being executed by the processor, implements the steps of the word report generation method according to any of claims 1-6.
9. A computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, the computer program being executable by at least one processor to cause the at least one processor to perform the steps of the word report generation method of any one of claims 1-6.
CN202010074875.1A 2020-01-22 2020-01-22 word report generation method and system Active CN111325012B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010074875.1A CN111325012B (en) 2020-01-22 2020-01-22 word report generation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010074875.1A CN111325012B (en) 2020-01-22 2020-01-22 word report generation method and system

Publications (2)

Publication Number Publication Date
CN111325012A CN111325012A (en) 2020-06-23
CN111325012B true CN111325012B (en) 2024-02-06

Family

ID=71172836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010074875.1A Active CN111325012B (en) 2020-01-22 2020-01-22 word report generation method and system

Country Status (1)

Country Link
CN (1) CN111325012B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114626352B (en) * 2022-03-11 2024-02-06 平安科技(深圳)有限公司 Report automatic generation method, device, computer equipment and storage medium
CN114372445B (en) * 2022-03-21 2022-08-12 奇安信科技集团股份有限公司 Document generation method and device, electronic equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8156018B1 (en) * 2006-12-18 2012-04-10 Intuit Inc. Transformation of standard document format electronic documents for electronic filing
CN108153721A (en) * 2017-12-06 2018-06-12 中南林业科技大学 A kind of automatic generation method in Word file embedded chart
CN109933752A (en) * 2017-12-15 2019-06-25 北京京东尚科信息技术有限公司 A kind of method and apparatus exporting electronic document

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8156018B1 (en) * 2006-12-18 2012-04-10 Intuit Inc. Transformation of standard document format electronic documents for electronic filing
CN108153721A (en) * 2017-12-06 2018-06-12 中南林业科技大学 A kind of automatic generation method in Word file embedded chart
CN109933752A (en) * 2017-12-15 2019-06-25 北京京东尚科信息技术有限公司 A kind of method and apparatus exporting electronic document

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张立忠 ; 赵家宇 ; .DWT网页模板在Web报表生成中的应用.计算机应用与软件.2013,(08),全文. *

Also Published As

Publication number Publication date
CN111325012A (en) 2020-06-23

Similar Documents

Publication Publication Date Title
CN107844634B (en) Modeling method of multivariate general model platform, electronic equipment and computer readable storage medium
CN106055337B (en) Interface generation method and device
CN112765023B (en) Test case generation method and device
CN109062925B (en) Method, device, computer equipment and storage medium for automatically generating insert sentences
CN109614101B (en) Page generation method, system, device, computer equipment and storage medium
CN104133772A (en) Automatic test data generation method
CN107656729B (en) List view updating apparatus, method and computer-readable storage medium
CN110705237B (en) Automatic document generation method, data processing device and storage medium
CN111325012B (en) word report generation method and system
CN110647471B (en) Interface test case generation method, electronic device and storage medium
CN110928802A (en) Test method, device, equipment and storage medium based on automatic generation of case
CN112149390A (en) Report generation method, system, computer device and computer-readable storage medium
CN106557307B (en) Service data processing method and system
CN108255735B (en) Associated environment testing method, electronic device and computer readable storage medium
CN111831920A (en) User demand analysis method and device, computer equipment and storage medium
CN113158101A (en) Visual page rendering method, device, equipment and storage medium
CN116954450A (en) Screenshot method and device for front-end webpage, storage medium and terminal
CN102063416B (en) Method and system for embedding double-byte fonts into PDF file
CN112632425A (en) Method, device, equipment and storage medium for generating offline resource file
CN109240660B (en) Access method of advertisement data, storage medium, electronic device and system
CN115712422A (en) Form page generation method and device, computer equipment and storage medium
CN110109698B (en) Keypad configuration method, device, computer equipment and readable storage medium
CN113296785A (en) Document generation method, system, device and readable storage medium
CN112817953A (en) Data verification method and device, computer equipment and computer-readable storage medium
CN109840080B (en) Character attribute comparison method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Room 332, 3 / F, Building 102, 28 xinjiekouwei street, Xicheng District, Beijing 100088

Applicant after: Qianxin Technology Group Co.,Ltd.

Applicant after: Qianxin Wangshen information technology (Beijing) Co.,Ltd.

Address before: Room 332, 3 / F, Building 102, 28 xinjiekouwei street, Xicheng District, Beijing 100088

Applicant before: Qianxin Technology Group Co.,Ltd.

Applicant before: LEGENDSEC INFORMATION TECHNOLOGY (BEIJING) Inc.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant