Document generation method, device, computer equipment and storage medium

By obtaining matching target document templates and content from the document template library and generating settlement documents that meet user needs, the problem of inability to match document formats in the prior art is solved, and document generation efficiency and user satisfaction are improved.

CN117709320BActive Publication Date: 2024-12-31SHENZHEN KEMAI TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311611890.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2024-12-31
Estimated Expiration
2043-11-28

AI Technical Summary

Technical Problem

The common format of the existing settlement document printing template cannot meet the different format requirements of each customer, resulting in the inability to generate settlement documents that match the user's needs.

Method used

Get the target document template that matches the original document type and user permissions from the document template library, generate target documents based on the document field content and template, supports tiled display of collapsed fields, and realizes customization of document format.

Benefits of technology

It improves the efficiency of document generation, meets the requirements of different users for document formats, and realizes the generation of user-defined document templates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117709320B_ABST
    Figure CN117709320B_ABST
Patent Text Reader

Abstract

The present application relates to a document generation method, apparatus, computer equipment, storage medium and computer program product. By acquiring a target document template that matches the document type of an original document and the current user authority information from a document template library, the document template library is generated according to user configuration rules, and then a target document is generated according to the field content of each field in the original document and the target document template. This realizes different requirements for document formats based on different users, can provide a document template that matches the user requirements, and generates a corresponding target document according to the document template, thereby improving the efficiency of document generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a document generation method, apparatus, computer equipment and storage medium. Background Art

[0002] When a project is in the settlement stage, users usually print out settlement documents from the system. Existing settlement document printing templates are basically a set of universal formats. However, in the actual settlement document printing process, since each customer has different requirements for the format of the settlement document, the settlement document obtained using a universal format cannot meet the different format requirements of all customers for the settlement document. Summary of the invention

[0003] Based on this, it is necessary to provide a document generation method, apparatus, computer device, computer-readable storage medium and computer program product to address the technical problem that the current settlement document printing template cannot generate settlement documents that match user needs.

[0004] In a first aspect, the present application provides a method for generating a document. The method comprises:

[0005] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0006] Generate a target document based on the field contents of each field in the original document and the target document template.

[0007] In one embodiment, obtaining a target document template that matches the document type of the original document and the current user authority information from a document template library includes:

[0008] Obtain an initial document template that matches the document type of the original document and the current user's permission information from the document template library;

[0009] Get the calling functions corresponding to each field in the initial document template;

[0010] Fill each calling function into the corresponding field in the initial document template to obtain the target document template.

[0011] In one embodiment, each calling function is filled into the corresponding field in the initial document template, and the target document template is obtained including:

[0012] Get the field format parameters corresponding to each field in the initial document template;

[0013] Fill each calling function and each field format parameter into the corresponding field in the initial document template to obtain the target document template;

[0014] Generate a target document based on the field contents of each field in the original document and the target document template, including:

[0015] Obtain the field format corresponding to each field in the target document template according to the field format parameters corresponding to each field in the target document template;

[0016] Fill the field contents of each field in the original document into the target document template according to the corresponding field format to generate the target document.

[0017] In one embodiment, before obtaining a target document template that matches the document type of the original document and the current user authority information from the document template library, the method further includes:

[0018] Receive printing requests for original documents;

[0019] After the target document is generated based on the field contents of each field in the original document and the target document template, it also includes:

[0020] Print the target document.

[0021] In one embodiment, the original document includes at least one foldable field; obtaining a target document template matching the document type of the original document and the current user authority information from a document template library includes:

[0022] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0023] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0024] The candidate document template that displays the target fields in a flat format is determined as the target document template.

[0025] In one embodiment, the original document includes at least one foldable field; obtaining an initial document template matching the document type of the original document and the current user authority information from a document template library includes:

[0026] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0027] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0028] The candidate document template that displays the target fields in a flat format is determined as the initial document template.

[0029] In one embodiment, the original document includes at least one folding field; each folding field includes at least one folding subfield; each calling function is filled into the corresponding field in the initial document template to obtain a target document template, including:

[0030] Traverse each folding field;

[0031] For each folding field, fill the calling functions corresponding to each folding subfield in the folding field into the corresponding folding subfield in the initial document template;

[0032] At the end of the traversal, the currently obtained initial document template is used as the target document template.

[0033] In a second aspect, the present application also provides a document generation device. The device includes:

[0034] The document template acquisition module is used to obtain the target document template that matches the document type of the original document and the current user authority information from the document template library; the document template library is generated according to the configuration rules;

[0035] The target document generation module is used to generate a target document based on the field content of each field in the original document and the target document template.

[0036] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0037] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0038] Generate a target document based on the field contents of each field in the original document and the target document template.

[0039] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0040] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0041] Generate a target document based on the field contents of each field in the original document and the target document template.

[0042] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0043] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0044] Generate a target document based on the field contents of each field in the original document and the target document template.

[0045] In the above-mentioned document generation method, apparatus, computer equipment, storage medium and computer program product, a document template library is generated according to user configuration rules, and the document template library provides document templates customized by users according to their own format requirements for document types, and then by obtaining a target document template that matches the document type of the original document and the current user authority information from the document template library, a target document template corresponding to the user's format requirements for the document type in the document template library is obtained, and then a target document is generated according to the field content of each field in the original document and the target document template, so as to obtain a target document in accordance with the user's format requirements for the document type, thereby realizing different requirements of different users for document formats and improving the efficiency of document generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of a process of generating a document in one embodiment;

[0047] Figure 2 A schematic diagram of a process of generating a document in one embodiment;

[0048] Figure 3 A schematic diagram of a process of generating a document in one embodiment;

[0049] Figure 4 A schematic diagram of a process of generating a document in one embodiment;

[0050] Figure 5 A schematic diagram of a process of generating a document in one embodiment;

[0051] Figure 6 A schematic diagram of a process of generating a document in one embodiment;

[0052] Figure 7 A schematic diagram of a process for generating a target document template in one embodiment;

[0053] Figure 8 A schematic diagram of the structure of an original document in an embodiment;

[0054] Fig. 9 A schematic diagram of the structure of a target document in an embodiment;

[0055] Fig.10A schematic diagram of a process of generating a document in one embodiment;

[0056] Fig.11 A schematic diagram of the structure of a target document template in an embodiment;

[0057] Fig.12 It is a structural block diagram of a document generating device in one embodiment;

[0058] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0060] In one embodiment, Figure 1 As shown, a document generation method is provided. This embodiment takes the method applied to a server as an example. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0061] Step 102: Acquire a target document template that matches the document type of the original document and the current user authority information from the document template library.

[0062] Among them, the document template library includes document templates of different types, and there may be multiple document templates corresponding to the same document type, and the fields contained in each document template are not exactly the same. For example, when the original document is a financial settlement document, the document type of the original document includes but is not limited to a purchase and sales settlement document, a deduction rate agency sales settlement document, a cost agency sales settlement document, and a joint venture settlement document. Correspondingly, the document template corresponding to the original document may include at least one of a purchase and sales settlement document template, a deduction rate agency sales settlement document template, a cost agency sales settlement document template, and a joint venture settlement document template. For another example, when the document type of the original document is a purchase and sales settlement document, there are multiple document templates corresponding to the purchase and sales settlement document because different customers have different requirements for the document format of the purchase and sales settlement document. Furthermore, for different users, a target document template that matches the document type of the original document and the current user authority information can be obtained from the document template library.

[0063] User authority information refers to the user's authority to use the document templates configured in the document template library. Optionally, the user authority information also includes a user identifier, which is used to uniquely identify the user's identity. The user identifier is such as a user ID and a user name. In the server, user authority information is configured for each user to match the corresponding document template in the document template library so that the document template meets the user's document format requirements. User authority information can be stored in the server in advance, and the user authority information can be added, deleted or modified by the backend operation and maintenance personnel.

[0064] The document template library can be generated according to the configuration rules. Specifically, the backend operation and maintenance personnel can configure custom fields and use HTML tags to represent custom fields to form a configuration file. Each configuration file can correspond to one or more document templates. Each configuration file constitutes the above-mentioned document template library. Among them, the role of HTML tags is to display text information on the page. HTML tags can include common HTML tags and custom HTML tags. Common HTML tags include tags used to represent information through two-dimensional data tables: , used to define row labels in a table: , used to define a table cell tag that contains data: Etc. A custom tag is an HTML tag that is customized by a user based on a data entity object. The data entity object in this embodiment is a document. Backstage operation and maintenance personnel can set the fields included in the document by customizing different types of HTML tags. For example, when a document includes an order document detail field, the backstage operation and maintenance personnel can achieve the effect of adding an order document detail field to the document by customizing an HTML tag used to represent the order document detail.

[0065] The original document may be the document displayed on the current page, and the fields included in the document correspond to the document type of the original document. For example, when the original document is a purchase and sales settlement document, the fields displayed on the current page are fields related to purchase and sales settlement, such as accounting subject, supplier, contract number, cost details, settlement details, etc. At least one of the fields.

[0066] Specifically, the original document usually includes a document type field. By obtaining the field content in the document type field, the document type of the original document can be obtained. Then, a target document template matching the document type of the original document is obtained from the document template library. The number of target document templates matching the document type can be one or more. When the number of target document templates matching the document type is multiple, a unique target document template matching the current user authority information is obtained from the multiple target document templates.

[0067] Step 104: Generate a target document according to the field content of each field in the original document and the target document template.

[0068] Specifically, after obtaining the target document template, the field contents of each field in the original document are filled into the corresponding fields in the target document template. When all fields in the target document template are filled with data, the filling is completed and the target document is obtained. Optionally, the data in the original document can be uniformly imported from a database or manually input.

[0069] The above-mentioned document generation method obtains the target document template that matches the document type of the original document and the current user authority information from the document template library. The document template library is generated according to the user configuration rules. The document template library provides document templates that users can customize according to their own format requirements for the document type. Then, by obtaining the target document template that matches the document type of the original document and the current user authority information from the document template library, the target document template corresponding to the user's format requirements for the document type in the document template library is obtained. Then, the target document is generated according to the field content of each field in the original document and the target document template, and the target document according to the user's format requirements for the document type is obtained, which realizes the different requirements of different users for the document format and improves the document generation efficiency.

[0070] Optionally, in one embodiment, the original document includes at least one folding field, and the target document template includes a template field and a call function corresponding to the template field. Fig.11 As shown, Figure 2 As shown, step 104 includes steps 202 to 206 .

[0071] Step 202, traverse each folding field.

[0072] Step 204: for each template field, based on the calling function corresponding to the template field, obtain the field content corresponding to the folded field matching the template field, and fill the field content into the corresponding template field.

[0073] The original document includes multiple fields. A collapsed field refers to a field whose specific content is hidden by being collapsed. Each field in the original document can be hidden by being collapsed, so that the display state of the field is switched from the displayed state to the hidden state, that is, from the displayed field to the collapsed field. The displayed field refers to the field in the original document that is displayed on the current page. The collapsed field refers to the field in the original document that is not displayed on the current page.

[0074] For example, please refer to Figure 8 As shown, when the settlement details are displayed as fields, the folded fields include the expense details and the order prepayment details. Similarly, when the expense details are displayed as fields, the folded fields include the settlement details and the order prepayment details. It is not limited to this. It can be understood that the folded field can be at least one of the settlement details, the expense details and the order prepayment details.

[0075] The template field is a field included in the target document template. The calling function corresponding to the template field is used to obtain the specific field content and fill the content of the template field. For example, if the original document includes folding field 1 and folding field 2, and the template field is template field 2 that matches folding field 2, the field content corresponding to folding field 2 can be obtained through the calling function corresponding to the template field 2, and the field content corresponding to folding field 2 can be filled into the content of template field 2.

[0076] Step 206, at the end of the traversal, the target document is determined according to the target document template after the field content is filled. In the process of traversing each folded field, for the folded field that matches the template field, the field content of the folded field will be directly filled into the corresponding template field. The end of the traversal indicates that the field content corresponding to the folded field that needs to be filled has been filled. At the end of the traversal, if the template fields in the target document template all match the folded fields, the target document template after the field content is filled can be directly determined as the target document.

[0077] Optionally, in one embodiment, if part of the template field in the target document template matches the folded field and the other part matches the displayed field, the target document can be determined based on the field content filled in by the matching displayed field and the field content filled in by the matching folded field.

[0078] The document generation method in this embodiment traverses the folded fields, uses the calling function corresponding to the template field to obtain the field content corresponding to the folded field that matches the template field, and fills the field content. It can quickly fill the data in the folded field into the corresponding template field in the target document template, thereby further improving the document generation efficiency.

[0079] Furthermore, each folding field in the initial document template includes at least one folding subfield. The folding field can be understood as a set, and the folding subfield can be understood as an element in the set. For example, reference can be made to Figure 8 As shown, when the collapsed field is settlement details, the collapsed subfields include serial number, document number, organization, document type, document review time, purchase price, untaxed purchase price, adjustment amount, and untaxed adjustment amount.

[0080] Traversing each folding field may be to obtain each folding field in turn, and traverse the folding subfields included in the corresponding folding field. For example, reference may be made to Figure 8 As shown, to traverse each folded field, you can first determine the "Settlement Details" field, and traverse each folded subfield included in the "Settlement Details" in sequence to obtain the field content corresponding to each folded subfield, then determine the "Expense Details" field, and traverse each folded subfield included in the "Expense Details" in sequence to obtain the field content corresponding to each folded subfield, and finally determine the "Order Advance Payment Details" field, and traverse each folded subfield included in the "Order Advance Payment Details" in sequence to obtain the field content corresponding to each folded subfield.

[0081] Traversing each folded field may also be to sequentially obtain each folded field that matches the original document and the target document template, and traverse the folded sub-fields contained in the corresponding folded field. For example, the folded fields that match the original document and the target document template include the "settlement details" field and the "order advance payment details" field. The "settlement details" field may be determined first, and the folded sub-fields contained in the "settlement details" may be sequentially traversed in sequence according to the sequence number to obtain the field content corresponding to each folded sub-field. Then, the "order advance payment details" field may be determined, and the folded sub-fields contained in the "order advance payment details" may be sequentially traversed in sequence according to the sequence number to obtain the field content corresponding to each folded sub-field.

[0082] For each template field, the field content of the field of the original document that matches the template field is obtained based on the calling function corresponding to the template field, and filled into the corresponding template field, wherein the field of the original document includes the collapsed field.

[0083] For example, reference may be made to Figure 8 , Fig. 9 as well as Fig.11 ,in, Figure 8 Can be regarded as original documents, Fig. 9 Can be regarded as a target document, Fig.11 It can be regarded as a target document template. For each template field of the target document template, the field content of the field of the original document that matches the template field can be obtained according to the calling function corresponding to the template field, and filled into the corresponding template field to obtain the target document. Among them, when the template field matches the display field of the original document, the calling function corresponding to the template field obtains the field content of the display field and fills it into the corresponding template field. When the template field matches the folding field or folding subfield of the original document, the calling function corresponding to the template field obtains the field content of the folding field or folding subfield and fills it into the corresponding template field. It can be understood that the fields of the original document include display fields and / or folding fields.

[0084] Optionally, please continue to refer to Figure 8 , Fig. 9 as well as Fig.11 When the template field matches the folding field or folding subfield of the original document, the calling function corresponding to the template field obtains the field content of the folding field or folding subfield and fills it into the corresponding template field. In the original document, the field content of the folding subfield can be known by the sequence number to know the number of field content components of the folding subfield. The calling function corresponding to the template field traverses each folding subfield in sequence according to the sequence number to obtain all the field contents corresponding to each folding subfield, and finally obtains Fig. 9 In the target document shown, the folded subfields contained in the folded field of the original document and all field contents corresponding to the folded subfields can be displayed.

[0085] Optionally, the template field of the target document template may include all folding subfields corresponding to the folding field, or may include some folding subfields corresponding to the folding field. The setting requirements of the template field of the target document template may be set according to user requirements, and there is no limitation on this.

[0086] The document generation method in this embodiment is based on the folding sub-field of the folding field, and directly uses the calling function of the template field in the target document template to obtain the field content corresponding to the folding sub-field to fill the field content, thereby improving the generation efficiency of the target document. In addition, through the calling function of the template field, the folding field of the original document is displayed in whole or in part according to the target document template required by the user, and the target document in a format that meets the user's requirements is obtained, which facilitates the user to quickly know the field content contained in the folding field contained in the original document, thereby improving the efficiency of obtaining document information.

[0087] In one embodiment, Figure 3 As shown, step 102 includes steps 302 to 306 .

[0088] Step 302: Acquire an initial document template from the document template library that matches the document type of the original document and the current user authority information.

[0089] Step 304, obtaining the calling functions corresponding to the fields in the initial document template.

[0090] When configuring custom fields, the backend operation and maintenance personnel also define the call functions corresponding to each custom field and store them in the configuration file. The call function is used to extract data corresponding to the template field in the target document template from the original document, and is also used to locate the display position of the field content of the template field. Exemplarily, the call function may include but is not limited to regular expressions, XML parsing rules, and Json parsing rules.

[0091] Specifically, the calling functions corresponding to the fields in the initial document template are obtained from the configuration file. For example, when the initial document template includes an accounting subject field, the calling functions corresponding to the accounting subject field can be obtained from the configuration file.

[0092] Step 306, fill each calling function into the corresponding field in the initial document template to obtain the target document template.

[0093] Specifically, after obtaining the call functions corresponding to the fields in the initial document template, the call functions can be filled into the corresponding fields in the initial document template in rows or columns to obtain the target document template. The field content of each field in the target document template is the call function corresponding to each field. Exemplarily, the initial document template can be a table or a document.

[0094] In addition, after obtaining the target document template in this embodiment, the calling functions filled in each field in the target document template are read, and data matching each calling function is obtained from the original document according to the calling functions filled in each field, and then filled into the corresponding field in the target document template. When all fields in the target document template are filled with data, the filling is completed and the target document is obtained.

[0095] The document generation method in this embodiment can quickly fill the data in the original document into the corresponding fields in the target document template by obtaining the calling functions corresponding to each field in the initial document template, thereby further improving the document generation efficiency.

[0096] In one embodiment, Figure 4 As shown, step 306 includes step 402 and step 404 , and step 104 includes step 406 and step 408 .

[0097] Step 402, obtaining the field format parameters corresponding to each field in the initial document template.

[0098] The field format parameter is used to convert the data extracted from the original document into the target field format. For example, when the initial document template includes a purchase price amount field, the field format parameter corresponding to the purchase price amount field can be used to convert the purchase price amount into uppercase. Furthermore, the field format parameter can be empty, which means that there is no corresponding field format requirement for the field.

[0099] Step 404, fill each calling function and each field format parameter into the corresponding field in the initial document template to obtain the target document template.

[0100] Step 406, obtaining the field format corresponding to each field in the target document template according to the field format parameters corresponding to each field in the target document template.

[0101] The field format parameter corresponds to the field format. The field format parameter may be a function. For example, the field format parameter may include a toupper(string) function for converting data into uppercase, a tolower(string) function for converting data into lowercase, and the like.

[0102] Step 408, fill the field content of each field in the original document into the target document template according to the corresponding field format to generate the target document.

[0103] Specifically, for each field in the target document template, data corresponding to the field is extracted from the original document, and the data is converted into a field format corresponding to the field, and then the converted data is filled into the corresponding field of the target document template.

[0104] In this embodiment, by obtaining the field format parameters corresponding to each field in the initial document template, each calling function and each field format parameter are filled into the corresponding field in the initial document template to obtain a target document template, and the field format corresponding to each field in the target document template is obtained according to the field format parameters corresponding to each field in the target document template. The field content of each field in the original document is filled into the target document template according to the corresponding field format to generate the target document. The data in the target document can be displayed in a certain format, thereby further meeting the user's format requirements for the generated document.

[0105] It should be noted that, compared with the direct storage of the target document template according to the template fields and the calling functions corresponding to the template fields, in this embodiment, the initial document template of the template fields that meet the documents required by the user is pre-stored to save storage space, and then the field format parameters corresponding to the fields in the initial document template are obtained, and each calling function and each field format parameter are filled into the corresponding fields in the initial document template to obtain the target document template, so that the document format and document data meet the user's requirements, without the need to manually set the calling functions and / or format parameters corresponding to the template fields, the flexibility and selectivity are stronger, and the efficiency of generating the target document model required by the user is higher.

[0106] In one embodiment, the user can send a print request of the original document to the server to request printing of the original document. After the server receives the print request of the original document sent by the user, Figure 5 As shown, the specific steps are as follows:

[0107] Step 502, receiving a print request for an original document, and acquiring a target document template that matches the document type of the original document and the current user authority information from a document template library; the document template library is generated according to a configuration rule;

[0108] Step 504: Generate a target document according to the field content of each field in the original document and the target document template.

[0109] Step 506: Print the target document.

[0110] The print request refers to a data processing request for printing a specific document. The current user triggers a print request for the document through the terminal, and the server determines the user authority information of the current user by responding to the print request.

[0111] Optionally, the server may configure different user permissions for different user accounts, and the server may determine the current user logged in by the terminal by identifying the account logged in by the terminal, and then determine the user permission information. For example, user permission 1 is configured for user account 1, and user permission 2 is configured for user account 2. When user account 1 is used to log in to the terminal and a print request is triggered through the terminal, the user permission information of the current user is user permission 1, and when user account 2 is used to log in to the terminal and a print request is triggered through the terminal, the user permission information of the current user is user permission 2.

[0112] Optionally, the server may also configure different user permissions for different terminals, where only specific people can trigger a print request for a specific terminal, and the server may determine the user permission information of the current user by identifying the terminal that sends the print request. For example, terminal A has a specific power-on password or print function password. After user permission 1 is configured for terminal A, user M can trigger a print request by using the power-on password of terminal A, and user M has user permission 1. User N can trigger a print request by using the power-on password of terminal A, and the user permission information of user N is also user permission 1.

[0113] Furthermore, the server takes the document indicated by the print request as the original document, and acquires the target document template and fills in the field content based on the original document and the current user authority information, thereby obtaining a target document that matches the original document, and prints the target document so that the printed document meets the user's actual needs.

[0114] In this embodiment, by receiving a printing request for an original document and generating a target document that matches the user's document printing requirements for printing, it is possible to print the data required by the user through convenient operations in the printing scenario, thereby effectively reducing the complexity of the printing operation process and reducing the data processing resources required for the computer device to respond to user operations. This improves printing efficiency while also improving resource utilization of the computer device.

[0115] The specific process of the above steps 502 to 504 can refer to the description of the above method embodiment. The implementation principle and technical effect are similar and will not be repeated here.

[0116] In one embodiment, the original document includes at least one foldable field. Figure 6 As shown, step 102 includes step 602 , step 604 and step 606 .

[0117] Step 602: In response to a selection operation on at least one folding field in the original document, the selected folding field is determined as a target field to be displayed in a tiled manner.

[0118] The original document may include display fields and folded fields. Display fields refer to fields in the original document that have been displayed on the current page. Folded fields refer to fields in the original document that are not displayed on the current page. Specifically, the user can select folded fields that he wants to display in a tiled manner from the original document. In response to the user's selection operation on at least one folded field in the original document, the selected folded field is determined as a target field to be displayed in a tiled manner. When the folded field is determined as a target field to be displayed in a tiled manner, the target document finally generated includes the target field that has been displayed in a tiled manner.

[0119] Step 604: Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library. In this embodiment, the number of candidate document templates is at least two. Each candidate document template includes at least one foldable field, and each foldable field is displayed flatly.

[0120] Step 606: determine the candidate document template of the flat display target field as the initial document template.

[0121] Specifically, a document template including the target field to be displayed in a tiled manner is obtained from the candidate document templates, and the document template including the target field to be displayed in a tiled manner is used as the initial document template.

[0122] In this embodiment, by responding to a selection operation on at least one folded field in the original document, the selected folded field is determined as the target field to be flatly displayed, a candidate document template that matches the document type of the original document and the current user authority information is determined from the document template library, and the candidate document template of the flatly displayed target field is determined as the initial document template. The flatly displayed folded fields can be achieved, so that the finally generated document can display more information.

[0123] It should be noted that this embodiment can be applied in combination with printing scenarios, and the folded fields and / or folded sub-fields to be displayed flat can be selected, and the selected folded fields can be determined as target fields, and then the initial document template that meets the document type, matches the current user's authority information and contains the target fields can be screened out from the document template library, thereby realizing the user's selectivity for the fields displayed in the required document template, and in different printing scenarios, the document template required to be printed for the corresponding scenario can be flexibly selected according to the user's selection requirements, and finally the target document is obtained based on the document template.

[0124] Based on the initial document template obtained in the above embodiment, this embodiment provides a processing process for filling each calling function into the corresponding folded field in the initial document template. Figure 7 As shown, the processing specifically includes step 702, step 704 and step 706. Wherein, each folding field in the initial document template includes at least one folding subfield.

[0125] Step 702, traverse each folding field.

[0126] The folding field can be understood as a set, and the folding subfield can be understood as an element in the set. Traversing each folding field specifically includes obtaining a folding field and traversing the folding subfields included in the folding field. The number of traversals can be equal to the number of folding fields.

[0127] Step 704: for each folding field, fill the calling functions corresponding to each folding sub-field in the folding field into the corresponding folding sub-field in the initial document template.

[0128] Specifically, after a certain folding field is obtained, the folding subfields in the folding field are obtained in sequence, and the calling functions corresponding to each folding subfield are obtained at the same time, and then the calling functions corresponding to each folding subfield are filled into the corresponding folding subfield. When all the folding subfields included in the folding field are filled with the calling functions, the next folding field is obtained, and the calling functions of other folding fields are filled in the same way.

[0129] Step 706: When the traversal is finished, the currently obtained initial document template is used as the target document template.

[0130] The traversal is finished when all folded subfields in all folded fields are filled with the calling function. The target document template obtained after the traversal is finished includes at least one folded field, and each folded subfield in the folded field is filled with the corresponding calling function.

[0131] In this embodiment, by traversing each folding field, for each folding field, the calling functions corresponding to each folding sub-field in the folding field are filled into the corresponding folding sub-field in the initial document template. After the traversal is completed, the current initial document template is used as the target document template, and the folding fields can be displayed in a tiled manner, so that the content included in the final generated document is more intuitive.

[0132] In order to facilitate understanding of the above document generation method, a more detailed embodiment is provided below.

[0133] In one embodiment, a document generation method is provided, the function implemented by the method is to Figure 8 The original document shown generates a target document that matches the user's document printing requirements. The original document includes the display fields displayed on the current page, such as accounting subject, supplier, contract number, department, settlement method, etc., and the folded fields not displayed on the current page, such as expense details and order prepayment details. The generated target document can refer to Fig. 9 , Fig. 9 The target document in the includes flat-displayed expense detail fields and settlement detail fields. Fig.10 , the specific steps are as follows:

[0134] 1. File reading: The file can be understood as the document template library in the above embodiment, and file reading means reading all document templates from the document template library.

[0135] 2. File matching. Specifically, after reading all the document templates from the document template library, a unique document template is matched according to the document type of the original document and the current user authority information. Among them, the print request of the original document sent by the user includes the current user authority information.

[0136] 3. Compile the file content. This step mainly includes obtaining the call functions corresponding to each field in the document template obtained in step 2, and filling each call function into the corresponding field in the document template to obtain the following Fig.11 The compiled document template shown.

[0137] 4. Structural analysis and data filling. Specifically, it includes reading the data filled in each field in the original document, and traversing each field in the compiled document template in turn. For each field, read the calling function filled in the field, obtain the data matching the calling function filled in the field from the original document according to the calling function filled in the field, and fill the data into the corresponding field in the compiled document template.

[0138] 5. File generation, printing and rendering. When all fields in the compiled document template are filled with data, the filling is completed. At this time, the document template filled with data is printed and rendered as a document.

[0139] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0140] Based on the same inventive concept, the embodiment of the present application also provides a document generation device for implementing the document generation method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more document generation device embodiments provided below can refer to the limitations on the document generation method above, and will not be repeated here.

[0141] In one embodiment, Fig.12 As shown, a document generation device 800 is provided, comprising: a document template acquisition module 810 and a target document generation module 820, wherein:

[0142] The document template acquisition module 810 is used to acquire a target document template that matches the document type of the original document and the current user authority information from a document template library; the document template library is generated according to the configuration rules.

[0143] The target document generation module 820 is used to generate a target document according to the field content of each field in the original document and the target document template.

[0144] In one embodiment, the document template acquisition module 810 includes an initial document template acquisition unit and a function calling filling unit, wherein:

[0145] The initial document template acquisition unit is used to acquire an initial document template that matches the document type of the original document and the current user authority information from the document template library.

[0146] The calling function filling unit is used to obtain the calling functions corresponding to each field in the initial document template; fill each calling function into the corresponding field in the initial document template to obtain the target document template.

[0147] In one embodiment, the calling function filling unit is also used to obtain field format parameters corresponding to each field in the initial document template; each calling function and each field format parameter are filled into the corresponding field in the initial document template to obtain the target document template.

[0148] The target document generation module 820 is also used to obtain the field format corresponding to each field in the target document template according to the field format parameters corresponding to each field in the target document template; fill the field content of each field in the original document into the target document template according to the corresponding field format to generate the target document.

[0149] In one embodiment, the document template acquisition module 810 is further used to receive a print request for an original document, and to acquire a target document template that matches the document type of the original document and the current user authority information from the document template library. The target document generation module 820 is further used to print the target document.

[0150] In one embodiment, the original document includes at least one folded field. The document template acquisition module 810 includes a target field determination unit, a candidate document template matching unit and an initial document template generation unit, wherein:

[0151] The target field determination unit is used to determine the selected folding field as a target field to be flattened and displayed in response to a selection operation on at least one folding field in the original document.

[0152] The candidate document template matching unit is used to determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library.

[0153] The initial document template generating unit is used to determine the candidate document template of the flat display target field as the initial document template.

[0154] In one embodiment, each folding field includes at least one folding subfield. The document template acquisition module 810 includes a folding field filling unit and a target document template generation unit, wherein:

[0155] The folding field filling unit is used to traverse each folding field, and for each folding field, fill the calling functions corresponding to each folding sub-field in the folding field into the corresponding folding sub-field in the initial document template.

[0156] The target document template generating unit is used to use the currently obtained initial document template as the target document template at the end of the traversal.

[0157] Each module in the above-mentioned document generation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0158] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store document templates. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a document generation method is implemented.

[0159] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0160] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0161] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0162] Generate a target document based on the field contents of each field in the original document and the target document template.

[0163] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0164] Obtain an initial document template that matches the document type of the original document and the current user's permission information from the document template library;

[0165] Get the calling functions corresponding to each field in the initial document template;

[0166] Fill each calling function into the corresponding field in the initial document template to obtain the target document template.

[0167] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0168] Get the field format parameters corresponding to each field in the initial document template;

[0169] Fill each calling function and each field format parameter into the corresponding field in the initial document template to obtain the target document template;

[0170] Obtain the field format corresponding to each field in the initial document template according to the field format parameters corresponding to each field in the initial document template;

[0171] Fill the field contents of each field in the original document into the target document template according to the corresponding field format to generate the target document.

[0172] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0173] Receive a print request for an original document, and obtain an initial document template matching the document type of the original document from a document template library;

[0174] Print the target document.

[0175] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0176] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0177] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0178] The candidate document template that displays the target fields in a flat format is determined as the target document template.

[0179] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0180] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0181] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0182] The candidate document template that displays the target fields in a flat format is determined as the initial document template.

[0183] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0184] Traverse each folding field;

[0185] For each folding field, fill the calling functions corresponding to each folding subfield in the folding field into the corresponding folding subfield in the initial document template;

[0186] At the end of the traversal, the currently obtained initial document template is used as the target document template.

[0187] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0188] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0189] Generate a target document based on the field contents of each field in the original document and the target document template.

[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0191] Obtain an initial document template that matches the document type of the original document and the current user's permission information from the document template library;

[0192] Get the calling functions corresponding to each field in the initial document template;

[0193] Fill each calling function into the corresponding field in the initial document template to obtain the target document template.

[0194] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0195] Get the field format parameters corresponding to each field in the initial document template;

[0196] Fill each calling function and each field format parameter into the corresponding field in the initial document template to obtain the target document template;

[0197] Obtain the field format corresponding to each field in the initial document template according to the field format parameters corresponding to each field in the initial document template;

[0198] Fill the field contents of each field in the original document into the target document template according to the corresponding field format to generate the target document.

[0199] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0200] Receive a print request for an original document, and obtain an initial document template matching the document type of the original document from a document template library;

[0201] Print the target document.

[0202] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0203] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0204] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0205] The candidate document template that displays the target fields in a flat format is determined as the target document template.

[0206] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0207] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0208] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0209] The candidate document template that displays the target fields in a flat format is determined as the initial document template.

[0210] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0211] Traverse each folding field;

[0212] For each folding field, fill the calling functions corresponding to each folding subfield in the folding field into the corresponding folding subfield in the initial document template;

[0213] At the end of the traversal, the currently obtained initial document template is used as the target document template.

[0214] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0215] Obtain a target document template that matches the document type of the original document and the current user's permission information from the document template library; the document template library is generated according to the configuration rules;

[0216] Generate a target document based on the field contents of each field in the original document and the target document template.

[0217] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0218] Obtain an initial document template that matches the document type of the original document and the current user's permission information from the document template library;

[0219] Get the calling functions corresponding to each field in the initial document template;

[0220] Fill each calling function into the corresponding field in the initial document template to obtain the target document template.

[0221] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0222] Get the field format parameters corresponding to each field in the initial document template;

[0223] Fill each calling function and each field format parameter into the corresponding field in the initial document template to obtain the target document template;

[0224] Obtain the field format corresponding to each field in the initial document template according to the field format parameters corresponding to each field in the initial document template;

[0225] Fill the field contents of each field in the original document into the target document template according to the corresponding field format to generate the target document.

[0226] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0227] Receive a print request for an original document, and obtain an initial document template matching the document type of the original document from a document template library;

[0228] Print the target document.

[0229] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0230] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0231] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0232] The candidate document template that displays the target fields in a flat format is determined as the target document template.

[0233] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0234] In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed;

[0235] Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library;

[0236] The candidate document template that displays the target fields in a flat format is determined as the initial document template.

[0237] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0238] Traverse each folding field;

[0239] For each folding field, fill the calling functions corresponding to each folding subfield in the folding field into the corresponding folding subfield in the initial document template;

[0240] At the end of the traversal, the currently obtained initial document template is used as the target document template.

[0241] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0242] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0243] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A document generation method, characterized in that: The method comprises: Acquire a target document template that matches the document type of the original document and the current user authority information from a document template library; the document template library is generated according to a configuration rule; wherein the original document is a document displayed on the current page, and the original document includes a folded field and at least one displayed field; the folded field refers to a field that hides specific content in a folded manner; wherein acquiring a target document template that matches the document type of the original document and the current user authority information from the document template library includes: Acquire an initial document template that matches the document type of the original document and the current user authority information from the document template library; acquire call functions corresponding to each field in the initial document template; fill each call function into the corresponding field in the initial document template to obtain the target document template; the target document template includes template fields and call functions corresponding to the template fields; generating a target document according to the field content of each field in the original document and the target document template; the field content of each field in the target document corresponds to the field content of the original document; The generating the target document according to the field content of each field in the original document and the target document template includes: Traverse each of the folded fields, and for each of the template fields, obtain the field content corresponding to the folded field that matches the template field based on the calling function corresponding to the template field, and fill the field content of the display field and the field content of the folded field into the corresponding template field; at the end of the traversal, determine the target document according to the target document template after filling in the field content.

2. The document generation method according to claim 1, characterized in that: The step of filling each of the calling functions into corresponding fields in the initial document template to obtain the target document template includes: Obtaining field format parameters corresponding to each field in the initial document template; Fill each of the calling functions and each of the field format parameters into the corresponding fields in the initial document template to obtain the target document template; The generating the target document according to the field content of each field in the original document and the target document template includes: Obtaining the field format corresponding to each field in the target document template according to the field format parameters corresponding to each field in the target document template; The field content of each field in the original document is filled into the target document template according to the corresponding field format to generate the target document.

3. The document generation method according to any one of claims 1 to 2, characterized in that: Before obtaining the target document template that matches the document type of the original document and the current user authority information from the document template library, the method further includes: Receive printing requests for original documents; After generating the target document according to the field content of each field in the original document and the target document template, the method further includes: Print the target document.

4. The document generation method according to claim 1, characterized in that: The original document includes at least one foldable field; The step of acquiring a target document template that matches the document type of the original document and the current user authority information from the document template library includes: In response to a selection operation on at least one folding field in the original document, determining the selected folding field as a target field to be flattened and displayed; Determine a candidate document template that matches the document type of the original document and the current user authority information from the document template library; The candidate document template that displays the target field in a flat format is determined as the target document template.

5. The document generation method according to claim 1, characterized in that: The original document includes at least one folding field; each of the folding fields includes at least one folding subfield; The step of filling each of the calling functions into corresponding fields in the initial document template to obtain the target document template includes: Traverse each folding field; For each of the folding fields, filling the calling functions corresponding to the folding subfields in the folding field into the corresponding folding subfields in the initial document template; At the end of the traversal, the currently obtained initial document template is used as the target document template.

6. A document generating device, characterized in that: The device comprises: The document template acquisition module is used to acquire a target document template that matches the document type of the original document and the current user authority information from a document template library; the document template library is generated according to a configuration rule; wherein the original document is a document displayed on the current page, and the original document includes a folded field and at least one displayed field; the folded field refers to a field that hides specific content in a folded manner; wherein acquiring a target document template that matches the document type of the original document and the current user authority information from the document template library includes: Acquire an initial document template that matches the document type of the original document and the current user authority information from a document template library; acquire call functions corresponding to each field in the initial document template; fill each call function into the corresponding field in the initial document template to obtain the target document template; the target document template includes template fields and call functions corresponding to the template fields; a target document generation module is used to generate a target document according to the field content of each field in the original document and the target document template; the field content of each field in the target document corresponds to the field content of the original document; The original document is the document displayed on the current page, and the original document includes a folded field and a displayed field; the folded field refers to a field that hides specific content in a folded manner; The target document generation module is specifically used to traverse each of the folded fields, and for each of the template fields, obtain the field content corresponding to the folded field that matches the template field based on the calling function corresponding to the template field, and fill the field content of the display field and the field content of the folded field into the corresponding template field; at the end of the traversal, determine the target document according to the target document template after filling in the field content.

7. The document generating device according to claim 6, characterized in that: The document template acquisition module is also used to receive a printing request for an original document; and the target document generation module is also used to print a target document.

8. The document generating device according to claim 6, characterized in that: The document template acquisition module includes a target field determination unit, a candidate document template matching unit and an initial document template generation unit, wherein: A target field determination unit, configured to determine the selected folded field as a target field to be displayed flatly in response to a selection operation on at least one folded field in the original document The candidate document template matching unit is used to determine the candidate document template that matches the document type of the original document and the current user authority information from the document template library. The initial document template generating unit is used to determine the candidate document template of the flat display target field as the initial document template.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Showing method and system of bills

    CN103713901A

  • Configurable printing data processing method and device

    CN112416267A

  • Template data processing method and system and related equipment

    CN116050370A