Document generation method, device, electronic device and computer-readable storage medium
By moving loop expressions and ending characters in Word documents and automatically filling data with template engine, the problem of high efficiency and low cost of manual input information is solved, and efficient table document generation and labor cost are achieved.
Patent Information
- Application Number
- CN202111495750.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-12-09
AI Technical Summary
In the prior art, manually inputting the attribute information of a table object requires a large labor cost, resulting in low efficiency in generating Word documents.
By obtaining XML-formatted documents, moving loop expressions and ending characters to the specified character area, using the preset template engine to automatically fill blank lines to generate a table document containing data.
Improves the efficiency of table generation in Word documents, reduces labor costs, avoids manual input errors, and improves the maintainability of template documents.
Smart Images

Figure CN114372448B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a document generation method, device, electronic equipment and computer-readable storage medium. Background Art
[0002] With the rapid development of computer technology, users can record information based on electronic documents. For example, a hospital can use Word documents to count patient information, and a teacher can use Word documents to count student grades. In one implementation, a table can be added to Word, where each row represents an object and contains multiple attribute information of the object.
[0003] In the related art, manually inputting the attribute information of each object into a table requires a large labor cost and leads to low efficiency in generating Word documents. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a document generation method, device, electronic device and computer-readable storage medium to improve the generation efficiency of Word documents containing tables and reduce labor costs.
[0005] The specific technical solutions are as follows:
[0006] In a first aspect of the present invention, a document generation method is provided, the method comprising:
[0007] Acquire a first document in XML (Extensible Markup Language) format; wherein the first document is obtained by format conversion of a second document in Word format containing a preset table template; and the second document records a loop expression and a terminator;
[0008] The loop expression in the first document is moved to the upper side of the designated character area, and the terminator in the first document is moved to the lower side of the designated character area, to obtain a third document; wherein the designated character area represents a blank row to be filled in the preset table template;
[0009] Based on a preset template engine, the third document and the first data to be filled into the blank row are combined to obtain a final fourth document; wherein the table included in the fourth document is filled with the first data.
[0010] Optionally, the template engine is a Velocity template engine or a Freemarker template engine.
[0011] Optionally, the combining of the third document and the first data to be filled into the blank row based on a preset template engine to obtain a final fourth document includes:
[0012] Based on a preset template engine, the third document and the first data to be filled into the blank row are combined to obtain a fifth document in XML format; the table included in the fifth document is filled with the first data;
[0013] The document format of the fifth document is modified into Word format to obtain a fourth document in Word format.
[0014] Optionally, the third document and the first data to be filled into the blank row are combined based on a preset template engine to obtain a fifth document in XML format, including:
[0015] Encoding the picture in the first data to be filled into the blank row according to the Base64 format to obtain second data;
[0016] Based on a preset template engine, the third document and the second data are combined to obtain a fifth document in XML format.
[0017] Optionally, the third document and the second data are combined based on a preset template engine to obtain a fifth document in XML format, including:
[0018] Based on a preset template engine, for each attribute information belonging to the same row in the second data, values are sequentially assigned to corresponding variables in a specified character area in the third document to obtain a fifth document in XML format.
[0019] Optionally, obtaining the first document in XML format includes:
[0020] Acquire a sixth document in XML format obtained by format conversion of the second document;
[0021] The sixth document is formatted to obtain a first document.
[0022] In a second aspect of the present invention, a document generation device is provided, the device comprising:
[0023] A first document acquisition module is used to acquire a first document in an extensible markup language XML format; wherein the first document is obtained by format conversion of a second document in a Word format containing a preset table template; and the second document records a loop expression and a terminator;
[0024] A third document acquisition module, used for moving the loop expression in the first document to the upper side of a designated character area, and moving the terminator in the first document to the lower side of the designated character area, to obtain a third document; wherein the designated character area represents a blank row to be filled in the preset table template;
[0025] The fourth document acquisition module is used to combine the third document and the first data to be filled into the blank row based on a preset template engine to obtain a final fourth document; wherein the table contained in the fourth document is filled with the first data.
[0026] Optionally, the template engine is a Velocity template engine or a Freemarker template engine.
[0027] Optionally, the fourth document acquisition module includes:
[0028] A fifth document acquisition submodule, configured to combine the third document and the first data to be filled into the blank row based on a preset template engine to obtain a fifth document in XML format; the table included in the fifth document is filled with the first data;
[0029] The fourth document acquisition submodule is used to modify the document format of the fifth document into the Word format to obtain a fourth document in the Word format.
[0030] Optionally, the fifth document acquisition submodule includes:
[0031] an encoding unit, configured to encode the picture in the first data to be filled into the blank line according to a Base64 format to obtain second data;
[0032] The fifth document acquisition unit is used to combine the third document and the second data based on a preset template engine to obtain a fifth document in XML format.
[0033] Optionally, the fifth document acquisition unit is specifically used to assign values of each attribute information belonging to the same row in the second data to corresponding variables in a specified character area in the third document based on a preset template engine, so as to obtain a fifth document in XML format.
[0034] Optionally, the first document acquisition module is specifically used to acquire a sixth document in XML format obtained by format conversion of the second document;
[0035] The sixth document is formatted to obtain a first document.
[0036] An embodiment of the present invention further provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0037] Memory, used to store computer programs;
[0038] The processor is used to implement any of the above-mentioned document generation methods when executing the program stored in the memory.
[0039] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned document generation methods is implemented.
[0040] An embodiment of the present invention further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the document generation methods described above.
[0041] Beneficial effects of the embodiments of the present invention:
[0042] The document generation method provided by an embodiment of the present invention can obtain a first document in XML format; wherein the first document is obtained based on format conversion of a second document in Word format containing a preset table template; a loop expression and a terminator are recorded in the second document; the loop expression in the first document is moved to the upper side of a specified character area, and the terminator in the first document is moved to the lower side of the specified character area to obtain a third document; wherein the specified character area represents a blank row to be filled in the preset table template; based on a preset template engine, the third document and the first data to be filled in the blank row are combined to obtain a final fourth document; wherein the table contained in the fourth document is filled with the first data.
[0043] Based on the above processing, the loop expression is moved to the upper side of the designated character area, and the terminator is moved to the lower side of the designated character area, so that the first data can be looped and filled into each blank row based on the loop expression, and then, a fourth document containing the first data in the table can be obtained. Compared with the prior art in which information is input manually, the method of the embodiment of the present invention uses an electronic device to automatically loop and assign values to blank rows, which can improve the efficiency of generating Word documents containing tables and reduce labor costs.
[0044] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0046] Figure 1 A flowchart of a document generation method provided by an embodiment of the present invention;
[0047] Figure 2 A flowchart of another document generation method provided by an embodiment of the present invention;
[0048] Figure 3 A flowchart of another document generation method provided by an embodiment of the present invention;
[0049] Figure 4 A flowchart of another document generation method provided by an embodiment of the present invention;
[0050] Figure 5 A structural diagram of a document generation device provided by an embodiment of the present invention;
[0051] Figure 6 A structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on the present invention belong to the scope of protection of the present invention.
[0053] In the related art, manually inputting the attribute information of each object into a table requires a large labor cost and leads to low efficiency in generating Word documents.
[0054] In order to solve the above problems, an embodiment of the present invention provides a document generation method, which can be applied to an electronic device. The electronic device fills a table in a Word format document based on data provided by a user (the first data in the embodiment of the present invention, i.e., data that needs to be filled in the table) to obtain the final document.
[0055] See also Figure 1 , Figure 1 A flowchart of a document generation method provided by an embodiment of the present invention, the method may include the following steps:
[0056] S101: Acquire a first document in XML format.
[0057] The first document is obtained by converting the format of a second document in Word format containing a preset table template. The second document records a loop expression and a terminator.
[0058] S102: Move the loop expression in the first document to the upper side of the designated character area, and move the terminator in the first document to the lower side of the designated character area, to obtain a third document.
[0059] The designated character area represents the blank rows to be filled in the preset table template.
[0060] S103: Based on a preset template engine, the third document and the first data to be filled into the blank line are combined to obtain a final fourth document.
[0061] The table included in the fourth document is filled with the first data.
[0062] Based on the document generation method provided by the embodiment of the present invention, the loop expression is moved to the upper side of the designated character area, and the terminator is moved to the lower side of the designated character area, so that the first data can be looped and filled into each blank row based on the loop expression, and then, a fourth document containing the first data in the table can be obtained. Compared with the prior art in which information is input manually, the method of the embodiment of the present invention uses an electronic device to automatically loop and assign values to blank rows, which can improve the generation efficiency of Word documents containing tables and reduce labor costs.
[0063] In addition, electronic devices can automatically cycle through blank rows to assign values, thereby avoiding manual input errors.
[0064] Secondly, based on the method provided in the embodiment of the present invention, the user only needs to adjust the preset table template in the second document (which can be called a template document) to generate a document containing different tables without editing the corresponding XML format document, thereby improving the maintainability of the template document.
[0065] For step S101, the preset table template can be set by the user based on the needs. For example, see Table (1).
[0066] Table (1)
[0067] Name age gender Position photo $!emp.name $!emp.age $!emp.sex $!emp.position $!emp.pic
[0068] When the user needs to collect information about company employees, the user can set a table template as shown in Table (1). That is, for each employee, the name, age, gender, position and photo of the employee need to be collected.
[0069] The preset table template may also record the attribute identifier of each column attribute. In Table (1), $!emp.name indicates the attribute identifier of the name column, $!emp.age indicates the attribute identifier of the age column, $!emp.sex indicates the attribute identifier of the gender column, $!emp.position indicates the attribute identifier of the position column, and $!emp.pic indicates the attribute identifier of the photo column.
[0070] For example, a user can create a Word document on a computer, insert the table shown in Table (1) into the document, input the statement "$table_start[#foreach($emp in$emps)]" above Table (1), and input the statement "$table_end[#end]" below Table (1), and thus obtain a second document. Among them, #foreach($emp in$emps) represents a loop expression, and #end represents an end symbol.
[0071] Then, the user can save the second document in XML format, and the electronic device can obtain the first document based on the document in XML format. In one embodiment, the electronic device can directly determine the document in XML format as the first document.
[0072] In another embodiment, the above step S101 may include the following steps:
[0073] A sixth document in XML format is obtained by formatting the second document; and the sixth document is formatted to obtain the first document.
[0074] In an embodiment of the present invention, after the user saves the second document in XML format and obtains a document in XML format (i.e., the sixth document), the electronic device can obtain the sixth document and format the sixth document to obtain the first document. Formatting the sixth document includes: adding line breaks to the sixth document and adjusting the indentation of lines in the sixth document to improve the readability of the first document.
[0075] With respect to step S102 , after obtaining the first document, the electronic device may parse the first document to determine a designated character region in the first document.
[0076] In one implementation, the designated character region may be determined based on the designated character corresponding to the variable in the first document. For example, if the variable in the first document begins with the designated character "$", the first line containing the character "$" and the last line containing the character "$" in the first document may be determined, and the first line and the last line, as well as the lines therebetween, may be determined as the designated character region.
[0077] The loop expression represents an expression for loop processing. By moving the loop expression to the upper side of the specified character area and moving the end symbol to the lower side of the specified character area, loop processing can be performed on the content represented by the specified character area.
[0078] For example, the first document contains the statement "$table_start[#foreach($emp in$emps)]" and the statement "$table_end[#end]". Accordingly, the electronic device can obtain the loop expression "#foreach($emp in$emps)" and the end symbol "#end" from the first document.
[0079] With respect to step S103, the template engine in the embodiment of the present invention may be a Velocity template engine, or may also be a Freemarker template engine, but is not limited thereto.
[0080] The first data that the user needs to fill in can be recorded in a specified database, or can also be recorded in a specified document. The first data can be marked with a corresponding attribute identifier, that is, the electronic device can determine the attribute of each data in the first data.
[0081] In one embodiment, see Figure 2 ,exist Figure 1 On the basis of, the above step S103 may include the following steps:
[0082] S1031: Based on a preset template engine, the third document and the first data to be filled into the blank row are combined to obtain a fifth document in XML format.
[0083] S1032: Modify the document format of the fifth document into the Word format to obtain a fourth document in the Word format.
[0084] The table included in the fifth document is filled with the first data.
[0085] The first data may include multiple rows of data, each row of data including multiple different attribute information. For example, if the preset table template is as shown in Table (1), each row of data in the first data represents the information of an employee, including the name, age, gender, position and photo of the employee, that is, the first data may include the information of multiple employees.
[0086] In the embodiment of the present invention, the electronic device can combine the third document and the first data based on the template engine, that is, fill the first data into the blank row of the preset table template to obtain the fifth document in XML format. Although the fifth document is in XML format, it can still be directly opened based on the Office application and displayed in the form of a Word document. For example, based on Office 2007 and higher versions, a document in XML format can be directly opened in the form of a Word document.
[0087] In addition, to facilitate user management of documents, the electronic device may also modify the suffix of the fifth document to the suffix of a Word format document (eg, .doc) to obtain a Word format document (ie, the fourth document in the embodiment of the present invention).
[0088] In one embodiment, see Figure 3 ,exist Figure 2 On the basis of, the above step S1031 may include the following steps:
[0089] S10311: Encode the image in the first data to be filled into the blank row according to the Base64 format to obtain the second data.
[0090] S10312: Based on a preset template engine, the third document and the second data are combined to obtain a fifth document in XML format.
[0091] In an embodiment of the present invention, if the first data includes a picture, the electronic device may encode the picture, that is, convert the picture into a string so that the Word document can recognize the picture, and the second data may be obtained. That is, in the second data, the picture exists in a format that can be recognized by the Word document. For example, each picture may be encoded in Base64 format.
[0092] Furthermore, the electronic device can combine the third document and the second data based on the template engine to obtain a fifth document including a table filled with the first data.
[0093] In one embodiment, see Figure 4 ,exist Figure 3 On the basis of, the above step S10312 may include the following steps:
[0094] S103121: Based on a preset template engine, for each attribute information belonging to the same row in the second data, assign values to corresponding variables in a specified character area in the third document in sequence to obtain a fifth document in XML format.
[0095] In the embodiment of the present invention, based on the template engine, for each attribute information belonging to the same row in the second data, that is, for multiple attribute information of the same object to be filled, values can be assigned to corresponding variables in the designated character area in sequence. In other words, the electronic device can assign values to the variables in the designated character area according to the second data, and thus fill the corresponding second data in the blank row.
[0096] After completing the assignment of each variable in the specified character area, you can get a table filled with the attribute information of a corresponding object. Furthermore, after completing multiple loop assignments based on the loop expression, you can fill the preset table template with the attribute information of multiple objects (i.e., the second data).
[0097] See Table (2), which is a table displayed in a Word document (i.e., the fourth document) obtained by processing the second document containing Table (1) based on the method of an embodiment of the present invention.
[0098] Table (2)
[0099]
[0100]
[0101] Based on the same inventive concept, the embodiment of the present invention further provides a document generation device, see Figure 5 , Figure 5 A structural diagram of a document generation device provided in an embodiment of the present invention, the device comprising:
[0102] The first document acquisition module 501 is used to acquire a first document in an extensible markup language XML format; wherein the first document is obtained by format conversion of a second document in a Word format including a preset table template; and the second document records a loop expression and a terminator;
[0103] The third document acquisition module 502 is used to move the loop expression in the first document to the upper side of the designated character area, and move the terminator in the first document to the lower side of the designated character area, so as to obtain a third document; wherein the designated character area represents a blank row to be filled in the preset table template;
[0104] The fourth document acquisition module 503 is used to combine the third document and the first data to be filled into the blank row based on a preset template engine to obtain a final fourth document; wherein the table contained in the fourth document is filled with the first data.
[0105] Optionally, the template engine is a Velocity template engine or a Freemarker template engine.
[0106] Optionally, the fourth document acquisition module 503 includes:
[0107] A fifth document acquisition submodule, configured to combine the third document and the first data to be filled into the blank row based on a preset template engine to obtain a fifth document in XML format; the table included in the fifth document is filled with the first data;
[0108] The fourth document acquisition submodule is used to modify the document format of the fifth document into the Word format to obtain a fourth document in the Word format.
[0109] Optionally, the fifth document acquisition submodule includes:
[0110] an encoding unit, configured to encode the picture in the first data to be filled into the blank line according to a Base64 format to obtain second data;
[0111] The fifth document acquisition unit is used to combine the third document and the second data based on a preset template engine to obtain a fifth document in XML format.
[0112] Optionally, the fifth document acquisition unit is specifically used to assign values of each attribute information belonging to the same row in the second data to corresponding variables in a specified character area in the third document based on a preset template engine, so as to obtain a fifth document in XML format.
[0113] Optionally, the first document acquisition module 501 is specifically configured to acquire a sixth document in XML format obtained by format conversion of the second document;
[0114] The sixth document is formatted to obtain a first document.
[0115] Based on the document generation device provided by the embodiment of the present invention, the loop expression is moved to the upper side of the designated character area, and the terminator is moved to the lower side of the designated character area, so that the first data can be looped and filled into each blank row based on the loop expression, and then, a fourth document containing the first data filled in the table can be obtained. Compared with the prior art in which information is input manually, the method of the embodiment of the present invention automatically loops and assigns values to blank rows by the electronic device, which can improve the generation efficiency of Word documents containing tables and reduce labor costs.
[0116] The embodiment of the present invention further provides an electronic device, such as Figure 6As shown, it includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0117] Memory 603, used for storing computer programs;
[0118] The processor 601 is used to execute the program stored in the memory 603 to implement the following steps:
[0119] Acquire a first document in an extensible markup language XML format; wherein the first document is obtained by format conversion of a second document in a Word format containing a preset table template; and a loop expression and a terminator are recorded in the second document;
[0120] The loop expression in the first document is moved to the upper side of the designated character area, and the terminator in the first document is moved to the lower side of the designated character area, to obtain a third document; wherein the designated character area represents a blank row to be filled in the preset table template;
[0121] Based on a preset template engine, the third document and the first data to be filled into the blank row are combined to obtain a final fourth document; wherein the table included in the fourth document is filled with the first data.
[0122] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0123] The communication interface is used for communication between the above electronic device and other devices.
[0124] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0125] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0126] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above document generation methods are implemented.
[0127] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute any document generation method in the above embodiments.
[0128] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0129] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0130] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0131] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A document generation method, characterized in that: The method comprises: Acquire a first document in an extensible markup language XML format; wherein the first document is obtained by format conversion of a second document in a Word format containing a preset table template; and a loop expression and a terminator are recorded in the second document; The loop expression in the first document is moved to the upper side of the designated character area, and the terminator in the first document is moved to the lower side of the designated character area, to obtain a third document; wherein the designated character area represents a blank row to be filled in the preset table template; the blank row to be filled in the preset table template records the attribute identifier of each column attribute; Based on a preset template engine, the third document and the first data to be filled into the blank row are combined to obtain a final fourth document; wherein the table included in the fourth document is filled with the first data.
2. The method according to claim 1, characterized in that The template engine is a Velocity template engine or a Freemarker template engine.
3. The method according to claim 1, characterized in that The preset template engine combines the third document and the first data to be filled into the blank line to obtain a final fourth document, including: Based on a preset template engine, the third document and the first data to be filled into the blank row are combined to obtain a fifth document in XML format; the table included in the fifth document is filled with the first data; The document format of the fifth document is modified into Word format to obtain a fourth document in Word format.
4. The method according to claim 3, characterized in that: The preset template engine combines the third document and the first data to be filled into the blank line to obtain a fifth document in XML format, including: Encoding the picture in the first data to be filled into the blank row according to the Base64 format to obtain second data; Based on a preset template engine, the third document and the second data are combined to obtain a fifth document in XML format.
5. The method according to claim 4, characterized in that The preset template engine combines the third document and the second data to obtain a fifth document in XML format, including: Based on a preset template engine, for each attribute information belonging to the same row in the second data, values are sequentially assigned to corresponding variables in a specified character area in the third document to obtain a fifth document in XML format.
6. The method according to claim 1, characterized in that The step of obtaining the first document in XML format includes: Acquire a sixth document in XML format obtained by format conversion of the second document; The sixth document is formatted to obtain a first document.
7. A document generation device, characterized in that: The device comprises: A first document acquisition module is used to acquire a first document in an extensible markup language XML format; wherein the first document is obtained by format conversion of a second document in a Word format containing a preset table template; and the second document records a loop expression and a terminator; A third document acquisition module is used to move the loop expression in the first document to the upper side of the designated character area, and move the terminator in the first document to the lower side of the designated character area, to obtain a third document; wherein the designated character area represents a blank row to be filled in the preset table template; the blank row to be filled in the preset table template records the attribute identifier of each column attribute; The fourth document acquisition module is used to combine the third document and the first data to be filled into the blank row based on a preset template engine to obtain a final fourth document; wherein the table contained in the fourth document is filled with the first data.
8. The device according to claim 7, characterized in that The template engine is a Velocity template engine or a Freemarker template engine.
9. The device according to claim 7, characterized in that The fourth document acquisition module includes: A fifth document acquisition submodule, configured to combine the third document and the first data to be filled into the blank row based on a preset template engine to obtain a fifth document in XML format; the table included in the fifth document is filled with the first data; The fourth document acquisition submodule is used to modify the document format of the fifth document into the Word format to obtain a fourth document in the Word format.
10. The device according to claim 9, characterized in that The fifth document acquisition submodule includes: an encoding unit, configured to encode the picture in the first data to be filled into the blank line according to a Base64 format to obtain second data; The fifth document acquisition unit is used to combine the third document and the second data based on a preset template engine to obtain a fifth document in XML format.
11. The device according to claim 10, characterized in that The fifth document acquisition unit is specifically used to assign values of each attribute information belonging to the same row in the second data to corresponding variables in the specified character area in the third document based on a preset template engine to obtain a fifth document in XML format.
12. The device according to claim 7, characterized in that The first document acquisition module is specifically used to acquire a sixth document in XML format obtained by format conversion of the second document; The sixth document is formatted to obtain a first document.
13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.
