CN115409014A - Document template generation method and device, computer equipment and storage medium - Google Patents

Document template generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115409014A
CN115409014A CN202211155301.2A CN202211155301A CN115409014A CN 115409014 A CN115409014 A CN 115409014A CN 202211155301 A CN202211155301 A CN 202211155301A CN 115409014 A CN115409014 A CN 115409014A
Authority
CN
China
Prior art keywords
information
control information
control
document
field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211155301.2A
Other languages
Chinese (zh)
Inventor
刘广华
李微
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Deeking Cloud Computing Co ltd
Original Assignee
Kingdee Deeking Cloud Computing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Deeking Cloud Computing Co ltd filed Critical Kingdee Deeking Cloud Computing Co ltd
Priority to CN202211155301.2A priority Critical patent/CN115409014A/en
Publication of CN115409014A publication Critical patent/CN115409014A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a document template generation method and device, computer equipment and a storage medium. The method comprises the following steps: traversing each control in a document template of a source document, and analyzing control information of each traversed control; if the unbound field information in the control information is analyzed, keeping the control information unchanged; if the field information is bound in the analyzed control information, updating the control information according to metadata preset for the target document; and generating a bill template of the target bill according to the unchanged control information and the updated control information in the bill template of the source bill. By adopting the method, the generation efficiency of the document template can be improved.

Description

Document template generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a document template, a computer device, and a storage medium.
Background
With the development of computer technology, various enterprise business systems come out endlessly, such as: an ERP (Enterprise Resource Planning) system, which greatly improves the operation and management efficiency of enterprises. Many business systems have the function of making and generating document templates, and users can make document templates through the business systems so as to conveniently print and use documents.
In the conventional method, when each document template is manufactured, a user is required to accurately set and adjust attribute information such as the position and the size of each control in the document template, even for a plurality of document templates with high information overlap ratio, each document template needs to be manufactured respectively, a large amount of time is required for manufacturing and adjusting, and one document template can be obtained, so that the efficiency is low.
Disclosure of Invention
In view of the above, it is necessary to provide a document template generation method, apparatus, computer device, computer readable storage medium and computer program product capable of improving generation efficiency of a document template.
In a first aspect, the application provides a document template generation method. The method comprises the following steps:
traversing each control in a document template of a source document, and analyzing control information of each traversed control;
if the unbound field information in the control information is analyzed, keeping the control information unchanged;
if the field information is bound in the analyzed control information, updating the control information according to metadata preset for the target document;
and generating a bill template of the target bill according to the unchanged control information and the updated control information in the bill template of the source bill.
In a second aspect, the application further provides a document template generating device. The device comprises:
the control analysis module is used for traversing each control in the document template of the source document and analyzing the control information of each traversed control; if the unbound field information in the control information is analyzed, keeping the control information unchanged;
the control information updating module is used for updating the control information according to metadata preset for the target document if the field information is analyzed to be bound in the control information;
and the bill template generating module is used for generating the bill template of the target bill according to the unchanged control information and the updated control information in the bill template of the source bill.
In one embodiment, the metadata includes field information of each field in the target document and corresponding data source information; and the control information updating module is also used for modifying the data source information corresponding to the field information bound in the control information according to the target data source information corresponding to the target field information matched with the field information bound in the control information in the metadata if the field information bound in the control information is analyzed.
In one embodiment, the metadata includes field information of each field in the target document; the control information updating module is also used for clearing the control information if the field information is bound in the control information and the target field information matched with the field information bound in the control information does not exist in the metadata.
In one embodiment, the control information updating module is further configured to empty data source information corresponding to the field information bound in the control information if the field information bound in the control information is analyzed, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is the field information in the entry table in the source document.
In one embodiment, the control information updating module is further configured to clear all information in the control information if the field information is bound in the control information, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is field information in a main table in the source document.
In one embodiment, the control parsing module is further configured to keep the control information of the control unchanged if the control type of the control is parsed as a control type that does not relate to a data source; if the analyzed control type of the control is the control type related to the data source, identifying whether field information is bound in the control information; if not, executing the step of keeping the control information unchanged if the unbound field information in the control information is analyzed;
and the control information updating module is also used for executing the step of updating the control information according to metadata preset for the target document if the field information is analyzed to be bound in the control information if the field information is bound.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the steps of the bill template generation method according to the embodiments of the application.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer readable storage medium has a computer program stored thereon, and when executed by a processor, causes the processor to perform the steps of the document template generation method according to the embodiments of the present application.
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 processor is enabled to execute the steps of the document template generation method according to the embodiments of the present application.
According to the bill template generation method, the bill template generation device, the computer equipment, the storage medium and the computer program product, each control in the bill template of the source bill is traversed, the control information of each traversed control is analyzed, if the control information is analyzed to be free of binding field information, the control information is kept unchanged, if the control information is analyzed to be bound with field information, the control information is updated according to metadata preset for the target bill, and the bill template of the target bill is generated according to the control information which is kept unchanged in the bill template of the source bill and the updated control information. By keeping the control information aiming at unbound field information unchanged and updating the control information with bound field information according to the metadata of the target document, the information which does not relate to fields and does not need to be modified in the document template of the source document and the field information which is the same as the target document can be kept to the maximum extent, the document template of the source document can be quickly converted into the document template of the target document only by carrying out a small amount of differential updating on the control information with bound field information, the quick multiplexing of the document template is realized, and the generation efficiency of the document template is improved.
Drawings
FIG. 1 is a diagram of an application environment of a document template generation method in one embodiment;
FIG. 2 is a flow diagram illustrating a method for document template generation in one embodiment;
FIG. 3 is a diagram illustrating control information in a document template, according to an embodiment;
FIG. 4 is a schematic illustration of an operating interface for a document template for making a source document in one embodiment;
FIG. 5 is a schematic diagram of an embodiment of an operator interface for indicating generation of a document template;
FIG. 6 is a diagram of a document template for a target document generated in one embodiment;
FIG. 7 is a diagram illustrating metadata for a document in one embodiment;
FIG. 8 is a diagram illustrating metadata for a purchase order and metadata for a sales outbound order, in one embodiment;
FIG. 9 is a schematic diagram illustrating an overall flow of a document template generation method according to an embodiment;
FIG. 10 is a block diagram showing the structure of a document template creation apparatus according to an embodiment;
FIG. 11 is a diagram illustrating an internal structure of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The document template generation method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be placed on the cloud or other network server. The user can select the document template of the source document and select the document type of the target document through the terminal 102, and the terminal 102 can generate a document template generation request according to the document template of the source document and the document type of the target document selected by the user, and send the document template generation request to the server 104. The server 104 may respond to the document template generation request, execute the document template generation method in the embodiments of the present application, generate a document template of the target document according to the document template of the source document, and send the document template of the target document to the terminal 102 for display. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart car-mounted devices, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The server 104 may be implemented as a stand-alone server or a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a document template generation method is provided, which is described by taking the method as an example applied to the server 104 in fig. 1, and includes the following steps:
s202, traversing each control in the bill template of the source bill, and analyzing control information of each traversed control.
The document template of the source document is an existing document template on which the document template of the target document is generated. The source document is a document corresponding to a document template of the source document. And the control refers to an information unit in the document template. And the control information is used for describing the detailed information of the control. Each control has corresponding control information.
In one embodiment, the document template may be an XML (Extensible Markup Language) format file or a JSON (JavaScript Object Notification) format file, etc.
In one embodiment, the control information may be a code corresponding to the control. As shown in fig. 3, the control information in the document template includes control information corresponding to each control, for example: fig. 3 schematically shows that fixed text, pictures, main table fields and entry table fields respectively correspond to control information.
In one embodiment, the control information may include style composition information of the control. In another embodiment, in the case that the control relates to a data source, the control information may further include data source information. As shown in fig. 3, the style sheet information may include at least one of coordinate information, font, control type, field information, and parent control ID of the control. The control types may include at least one type of paper information, fixed text, pictures, tables, page number information, rows, columns, cells, and fields, etc.
In one embodiment, a user can select a document template of a source document and select a document type of a target document through a terminal, and the terminal can generate a document template generation request according to the document template of the source document and the document type of the target document selected by the user and send the document template generation request to a server. The server can respond to the document template generation request to acquire the document template of the source document and the metadata of the target document, execute traversal of each control in the document template of the source document, and analyze control information of each traversed control and subsequent steps.
The target document is a document needing to generate a document template. It will be appreciated that the source document is a different document than the target document. Such as: the source document is a purchase order and the target document is a sales delivery document.
In one embodiment, a user may make a document template of a source document through an interface shown in fig. 4 and displayed by a terminal. The user may add or adjust various controls in the interface of fig. 4 by dragging or editing, etc. Fig. 4 shows a document template of a manufactured source document, and the source document corresponding to the document template in fig. 4 is a purchase order. The document template of the purchase order in fig. 4 contains type controls such as pictures, fixed text, page number information, tables, rows, columns, cells, and fields. Such as: the information such as purchase order template, document number, document date, system single, supplier, operator, serial number, commodity, warehouse, unit, quantity, unit, amount and current time is a control of a fixed text type, the information such as $ document number, $ document date, $ system single, name, $ supplier name, $ operator, $ F (serial number), $ F (commodity code. Commodity name), $ F (warehouse. Warehouse name), $ F (unit name), $ F (quantity), $ F (unit price), $) and amount F are field type controls, and the picture in FIG. 4 is a control of a picture type.
In one embodiment, a user can select a document template of a manufactured source document and select a document type of a target document through a terminal. As shown in fig. 5, the user may select a document template from the list of completed document templates shown in fig. 5 as the document template of the source document, such as the document template of the purchase order selected in fig. 5.
The user may select the option "save as" in fig. 5, and select the document type of the target document in the save as setup window, for example, the document type of the target document selected as "sell out document" in fig. 5.
In one embodiment, as shown in fig. 5, the user may further input at least one of a template code and a template name of a document template of a target document to be generated in the setup window.
And S204, if the unbound field information in the control information is analyzed, keeping the control information unchanged.
The field information is information for characterizing a field.
In one embodiment, the field information may be a field identification or field name, etc.
Specifically, if the unbound field information in the control information is analyzed, the server may keep the corresponding control information unchanged.
Such as: controls such as pictures, fixed texts, current time and page number information in a document template of a source document do not relate to database fields, so that the control information of the controls can be kept unchanged. Such as: as the information at the column head of the data table in the document template of the source document of fig. 3 (i.e., serial number, commodity, warehouse, unit, quantity, unit price and amount) belongs to the fixed text, the corresponding control information may remain unchanged.
And S206, if the field information is bound in the analyzed control information, updating the control information according to metadata preset for the target document.
Specifically, if the field information is bound in the analyzed control information, the server may modify or clear the corresponding control information according to the metadata preset for the target document.
In one embodiment, the metadata may be an XML (Extensible Markup Language) format file or JSON (JavaScript Object notification) format file, etc.
In one embodiment, the metadata includes field information for various fields in the target document. If the field information is bound in the analyzed control information, the server can match the field information in the control information with the field information in the metadata, if the field information matched with the field information in the control information exists in the metadata, the corresponding control information is modified according to the metadata, and if the field information matched with the field information in the control information does not exist in the metadata, the corresponding control information is cleared.
And S208, generating a bill template of the target bill according to the unchanged control information and the updated control information in the bill template of the source bill.
Specifically, after traversing each control and performing corresponding processing on each control information, the server may generate and store a document template of the target document according to the control information that remains unchanged and the updated control information in the document template of the source document.
It can be understood that after traversing each control in the document template of the source document, the control information of some of the controls remains unchanged, the control information of some of the controls is updated, and the server generates the document template of the target document according to the unchanged control or the control information of each traversed control.
FIG. 6 is a schematic diagram of a document template for a target document generated from the document template for the purchase order (i.e., the document template for the source document) of FIG. 4. The controls of fixed text types such as purchase order template, document number, document date, system person, supplier, business person, serial number, commodity, warehouse, unit, quantity, unit price, amount and current time in fig. 4 have no binding field information, so the control information of these controls is directly kept unchanged in fig. 6. Controls of field types such as $ receipt number, $ receipt date, $ system single name, $ supplier name, $ salesman, $ F (serial number), $ F (commodity code. Commodity name), $ F (warehouse. Warehouse name), $ F (unit. Unit name), $ F (quantity), $ F (unit price), $ F (amount), etc. in fig. 4 have binding field information, so the receipt template of the target receipt in fig. 6 updates the control information, for example, the control information of the $ supplier.s in the receipt template of the purchase order in fig. 4 (i.e., the receipt template of the source receipt) has been cleared.
In one embodiment, after the document template of the target document is generated, the user may modify the document template of the target document, or add a field different from the source document in the target document in the document template of the template document, so as to obtain a final document template of the target document. Such as: because the control information of the fixed text in the document template of the source document in fig. 4 is kept unchanged, the fixed text information in the document template of the generated target document in fig. 6 is consistent with that in the source document, so that the user can modify the fixed text in the document template of the target document in the interface shown in fig. 6, such as: the user may modify the "purchase order print template" to a "sales export order print template".
The document template generation method comprises the steps of traversing each control in a document template of a source document, analyzing control information of each traversed control, keeping the control information unchanged if the control information is analyzed to have no field information bound, updating the control information according to metadata preset for a target document if the control information is analyzed to have field information bound, and generating the document template of the target document according to the control information kept unchanged and the updated control information in the document template of the source document. By keeping the control information aiming at unbound field information unchanged, such as keeping the style information of paper, color, font, table style and the like of the document template of the source document, keeping the information of pictures, page numbers, fixed texts and the like in the document template of the source document, and updating the control information with bound field information according to the metadata of the target document, the information which does not relate to fields in the document template of the source document and the field information which is the same as the target document can be kept to the maximum extent, the document template of the source document can be quickly converted into the document template of the target document only by carrying out a small amount of differential updating on the control information with bound field information, the document template can be quickly reused, and the generation efficiency of the document template is improved.
In one embodiment, the metadata comprises field information of each field in the target document and corresponding data source information; if the field information is bound in the analyzed control information, updating the control information according to the preset metadata aiming at the target document comprises the following steps: and if the field information is bound in the analyzed control information, modifying the data source information corresponding to the field information bound in the control information according to the target data source information corresponding to the target field information matched with the field information bound in the control information in the metadata.
The data source information refers to a source of data corresponding to the field in the database. Metadata is a file for defining an association relationship between field information and data source information. The target field information refers to field information matched with the field information bound in the control information in the metadata. The target data source information refers to data source information corresponding to the target field information in the metadata.
In one embodiment, the data source information may include database table information and database field information. The database table information is information for characterizing the data tables in the database. Database field information is information used to characterize fields in a data table. In one embodiment, the database table information may be a table name of the database table or an identification of the database table, or the like. The database field information may be a field name of the database field or an identifier of the database field.
In one embodiment, the user may establish the metadata of the target document through the terminal in advance.
In one embodiment, the field information of each field in the target document and the corresponding data source information may be recorded in the metadata in advance.
In one embodiment, the user may establish respective metadata for each document in advance.
As shown in fig. 7, is an example of metadata for a document. As can be seen from the figure, the field names and field identifications (i.e., field information) of the various fields in the document and the corresponding database table names and database field names (i.e., data source information) are recorded in the metadata.
As shown in fig. 8, the two metadata are metadata of a purchase order and metadata of a sales delivery order, and as can be seen from the figure, information in the metadata corresponding to different documents is set according to specific documents, which is different from each other. Such as: the purchase order has field information for the supplier field, while the sales draft order has no supplier field and has a different customer field and batch field than the purchase order.
In an embodiment, if the field information is bound in the analyzed control information, the server may match the field information in the control information with the field information in the metadata, and if the field information matched with the field information in the control information exists in the metadata, the server may modify the data source information corresponding to the field information bound in the control information according to the target data source information corresponding to the target field information matched with the field information bound in the control information in the metadata.
In one embodiment, the field information is a field identification. The server can match the field identification in the control information with the field identification in the metadata, and if the field identification matched with the field identification in the control information exists in the metadata, the server can modify the data source information corresponding to the field information bound in the control information according to the target data source information corresponding to the target field identification matched with the field identification in the control information in the metadata.
In one embodiment, the server may replace the data source information corresponding to the field information bound in the control information with the target data source information corresponding to the target field information in the metadata.
In one embodiment, other information in the control information than the modified data source information remains unchanged.
Such as: fields such as the document number, the document date, the producer, the clerk, the serial number, the commodity, the warehouse, the unit, the quantity, the unit price and the amount of money in the master table in the document template of the purchase order (i.e., the document template of the source document) in fig. 4 also exist in the metadata of the sales slip (i.e., the metadata of the target document) as shown in fig. 8, and therefore, the data source information corresponding to the fields in the document template of the purchase order can be modified into the data source information corresponding to the fields in the metadata of the sales slip.
In an embodiment, after traversing each control, if the data source information in the control information of the cell control is inconsistent with the data source information in the control information of the data table control, the server may clear the data source information in the control information of the cell control.
In the embodiment, the metadata containing the field information of each field in the target document and the corresponding data source information is established, and under the condition that the field information is bound in the analyzed control information, the data source information corresponding to the field information bound in the control information is modified according to the target data source information corresponding to the field information matched with the field information bound in the control information in the metadata, so that the data source information corresponding to the field information matched with the metadata of the target document in the control information is simply modified, the document template of the source document can be quickly converted into the document template of the target document, the same field is automatically reserved, the quick multiplexing of the document template is realized, and the generation efficiency of the document template is improved. In addition, the data source information corresponding to the field information bound in the control information is modified according to the target data source information corresponding to the target field information matched with the field information bound in the control information in the metadata, so that the data source information in the control information in the bill template of the source bill can be accurately modified into the corresponding data source information in the target bill, and the accuracy of generating the bill template is improved.
In one embodiment, the metadata includes field information of each field in the target document; if the field information is bound in the analyzed control information, updating the control information according to the preset metadata aiming at the target document comprises the following steps: and if the analyzed control information is bound with the field information and the metadata does not have target field information matched with the field information bound in the control information, clearing the control information.
The clearing process refers to a process of clearing all or part of the information in the control information.
In an embodiment, if the field information is bound in the analyzed control information, the server may match the field information in the control information with the field information in the metadata, and if the field information matching the field information bound in the control information does not exist in the metadata, the server may perform a clearing process on the control information.
In an embodiment, if the field information is bound in the analyzed control information and the target field information matched with the field information bound in the control information does not exist in the metadata, the server may perform removal degree identification according to the position of the field information bound in the control information in the source document, so as to determine whether all information or part information in the control information needs to be removed.
In one embodiment, if the field information bound in the control information is located in the home table of the source document, the server may determine that all information in the control information needs to be cleared. In an embodiment, if the field information bound in the control information is located in the entry table of the source document, the server may determine that part of the information in the control information needs to be cleared.
The main table refers to a position outside the data table in the source document. And the entry table refers to a data table in the source document. Such as: as shown in fig. 4, 402 is a main table and 404 is an entry table.
In one embodiment, the server may match the field information bound in the control information with the field information in the metadata of the source document to determine the position of the field information bound in the control information in the source document.
In the embodiment, if the field information is bound in the analyzed control information and the target field information matched with the field information bound in the control information does not exist in the metadata, the control information is cleared, so that the control information corresponding to the field information unmatched with the target document in the document template of the source document can be cleared quickly, the difference field between the source document and the target document is removed automatically, the document template is reused quickly, and the generation efficiency of the document template is improved.
In one embodiment, if the field information is bound in the analyzed control information and the target field information matched with the field information bound in the control information does not exist in the metadata, the clearing processing on the control information includes: and if the field information is bound in the control information, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is the field information in the entry table in the source document, clearing the data source information corresponding to the field information bound in the control information.
Specifically, if the field information is bound in the analyzed control information and the target field information matched with the field information bound in the control information does not exist in the metadata, the server can identify the clearing degree according to the position of the field information bound in the control information in the source document. If the field information bound in the control information is the field information in the entry table in the source document, the clearing degree identification result is part of information in the control information to be cleared, and the server can empty the data source information corresponding to the field information bound in the control information in response to the clearing degree identification result.
It can be understood that, if the field information bound in the control information is the field information in the entry table of the source document, because the entry table is the data table in the document template of the source document, the data in one cell in the data table cannot be completely removed, that is, the whole control information corresponding to the cell cannot be cleared, so that only the corresponding data source information is removed.
In the embodiment, if the field information is bound in the analyzed control information, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is the field information in the entry table in the source document, the data source information corresponding to the field information bound in the control information is emptied, so that the control information corresponding to the field information unmatched with the target document in the document template of the source document can be quickly cleared, the document template of the source document can be quickly converted into the document template of the target document only by performing a small amount of differential updating on the control information bound with the field information, the document template can be quickly reused, and the generation efficiency of the document template is improved. In addition, for the condition that the field information bound in the control information is the field information in the entry table in the source document, only the data source information in the control information is emptied, so that abnormal consequences caused by directly removing the control information of the whole cell in the entry table are avoided, and the applicability of the scheme is improved.
In one embodiment, if the field information is bound in the analyzed control information and the target field information matched with the field information bound in the control information does not exist in the metadata, the clearing processing on the control information includes: and if the analyzed control information is bound with field information, the metadata does not have target field information matched with the field information bound in the control information, and the field information bound in the control information is the field information in the main table in the source document, emptying all information in the control information.
Specifically, if the field information is bound in the analyzed control information and the target field information matched with the field information bound in the control information does not exist in the metadata, the server can identify the clearing degree according to the position of the field information bound in the control information in the source document. If the field information bound in the control information is the field information in the main table in the source document, the clearing degree identification result is that all information in the control information needs to be cleared, and the server can respond to the clearing degree identification result to clear all information in the control information.
It can be understood that if the field information bound in the control information is the field information in the home table of the source document, because the home table is located outside the data table in the document template of the source document, and the information in the home table is relatively independent from each other, the corresponding control information can be removed entirely.
In the embodiment, if the field information is bound in the analyzed control information, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is the field information in the main table of the source document, all information in the control information is cleared, so that the control information corresponding to the field information unmatched with the target document in the document template of the source document can be quickly cleared, the document template of the source document can be quickly converted into the document template of the target document only by carrying out a small amount of differential updating on the control information bound with the field information, the quick multiplexing of the document template is realized, and the generation efficiency of the document template is improved. In addition, for the condition that the field information bound in the control information is the field information in the main table in the source document, all information in the control information is cleared, and the applicability of the scheme is improved.
In one embodiment, the method further comprises: if the analyzed control type of the control is the control type which does not relate to the data source, keeping the control information of the control unchanged; if the control type of the analyzed control is the control type related to the data source, identifying whether field information is bound in the control information; if not, executing the step of keeping the control information unchanged if the unbound field information in the control information is analyzed; if the binding exists, the step of updating the control information according to the preset metadata aiming at the target document if the field information is analyzed to be bound in the control information is executed.
Specifically, the server may first determine the control type from the control information and then determine whether the control type relates to a data source. If the control type of the control is the control type which does not relate to the data source, the server can keep the control information of the control unchanged. If the control type of the control is the control type related to the data source, the server can identify whether the control information related to the data source has bound field information, and if the control information is not bound, the server executes the step of keeping the control information unchanged if the unbound field information in the control information is analyzed; if the control document is bound, executing the step of updating the control information according to the preset metadata aiming at the target document if the field information is analyzed to be bound in the control information.
As shown in fig. 9, since the paper information is a control type that does not involve a data source, the server can directly leave the control information of the paper information unchanged, i.e., does not perform processing, such as "done" in fig. 9. Since the table, the row, the column, the cell, the text, the picture, and the like are control types related to the data source, the server can further determine whether the control information is bound with the field information, that is, perform the determination steps of "whether there is a data source bound" and "whether there is a field information bound" in fig. 9.
In the embodiment, the control information is directly kept unchanged for the control type not related to the data source, and whether the field information is bound to the control information is further judged for the control type related to the data source, so that the processing flow is optimized, and the document template generation efficiency is improved.
Fig. 9 is a schematic overall flow chart of a document template generation method in the embodiments of the present application. Firstly, a user can select a document template of a source document through a terminal, and a server can acquire a document template object of the source document according to the selection of the user, acquire metadata of a target document and acquire field information and data source information from the metadata. The server can traverse each control in the document template object of the source document and determine the control type of the traversed control. If the control type is a control type that does not relate to the data source, such as paper information, the server may keep the corresponding control information unchanged (i.e., completion in fig. 9). If the control type is a table, a row, a column, a cell, a text or a picture and the like which relate to the data source, the server can judge whether the data source is bound in the control information, and if the data source is not bound, skipping is carried out, namely, the corresponding control information is kept unchanged. If the data source is bound, the server can judge whether the field information is bound in the control information, and if the field information is not bound, skipping is carried out, namely, the corresponding control information is kept unchanged. If the field information is bound, the server can judge whether the bound field information is in the metadata of the target document, namely whether the metadata of the target document has the target field information matched with the bound field information, and if so, the server can modify the data source information in the control information according to the data source information in the metadata; if not, the server can judge whether the bound field information is a bound field in a data table (namely, an entry table) in the source document, and if not (namely, the bound field information in the control information is a field in a main table in the source document), the server can remove the whole control, namely, empty all information in the control information; if so (that is, the field information bound in the control information is a field in the entry table in the source document), the server may clear the data source information in the control information. After traversing each control, if the data source information in the control information of the cell control is inconsistent with the data source information in the control information of the data table control, the server may clear the data source information in the control information of the cell control. And finally, the server can obtain and store a document template of the target document according to the control information obtained after traversal.
It should be understood that, although the steps in the flowcharts related to the above embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not limited to being performed in the exact order illustrated and, unless explicitly stated herein, may be performed in other orders. Moreover, at least a part of the steps in the flowcharts related to the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the application also provides a document template generating device for realizing the document template generating method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the method, so that specific limitations in one or more document template generation device embodiments provided below can be referred to the limitations on the document template generation method in the foregoing, and details are not described herein again.
In one embodiment, as shown in FIG. 10, there is provided a document template generation apparatus 1000 comprising: a control analysis module 1002, a control information update module 1004 and a document template generation module 1006, wherein:
the control analyzing module 1002 is configured to traverse each control in a document template of a source document, and analyze control information of each traversed control; and if the unbound field information in the control information is analyzed, keeping the control information unchanged.
And the control information updating module 1004 is configured to update the control information according to metadata preset for the target document if the field information is bound in the analyzed control information.
And the document template generating module 1006 is configured to generate a document template of the target document according to the unchanged control information and the updated control information in the document template of the source document.
In one embodiment, the metadata includes field information of each field in the target document and corresponding data source information. The control information updating module 1004 is further configured to modify, if the field information is parsed out to be bound in the control information, the data source information corresponding to the field information bound in the control information according to the target data source information corresponding to the target field information matched with the field information bound in the control information in the metadata.
In one embodiment, the metadata includes field information for various fields in the target document. The control information updating module 1004 is further configured to perform a clearing process on the control information if the field information is bound in the analyzed control information and the metadata does not have target field information matching the field information bound in the control information.
In an embodiment, the control information updating module 1004 is further configured to empty data source information corresponding to the field information bound in the control information if the field information bound in the control information is analyzed, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is field information in an entry table in the source document.
In an embodiment, the control information updating module 1004 is further configured to empty all information in the control information if the field information is bound in the control information, the target field information matching the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is field information in a main table in the source document.
In one embodiment, the control parsing module 1002 is further configured to keep the control information of the control unchanged if the control type of the parsed control is a control type that does not relate to the data source; if the analyzed control type of the control is the control type related to the data source, identifying whether field information is bound in the control information; if the control information is not bound, executing the step of keeping the control information unchanged if the unbound field information in the control information is analyzed;
the control information updating module 1004 is further configured to, if there is a binding, execute a step of updating the control information according to metadata preset for the target document if the field information is resolved out of the binding in the control information.
The document template generating device is used for traversing each control in the document template of the source document, analyzing the control information of each traversed control, keeping the control information unchanged if the field information is not bound in the analyzed control information, updating the control information according to the preset metadata aiming at the target document if the field information is bound in the analyzed control information, and generating the document template of the target document according to the control information which is kept unchanged and the updated control information in the document template of the source document. The control information aiming at the unbound field information is kept unchanged, the control information aiming at the bound field information is updated according to the metadata of the target document, some information which does not relate to fields in the document template of the source document and does not need to be modified and the field information which is the same as the target document can be reserved to the maximum extent, the document template of the source document can be quickly converted into the document template of the target document only by carrying out a small amount of differential updating on the control information of the bound field information, the quick multiplexing of the document template is realized, and the generation efficiency of the document template is improved.
All or part of the modules in the document template generation device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 11. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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 an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing document data, metadata of documents, finished document templates and other data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program when executed by a processor implements a document template generation method.
It will be appreciated by those skilled in the art that the configuration shown in fig. 11 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the computing device to which the present application may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above-described method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims (10)

1. A document template generation method is characterized by comprising the following steps:
traversing each control in a document template of a source document, and analyzing control information of each traversed control;
if the unbound field information in the control information is analyzed, keeping the control information unchanged;
if the field information is bound in the analyzed control information, updating the control information according to metadata preset for the target document;
and generating a bill template of the target bill according to the unchanged control information and the updated control information in the bill template of the source bill.
2. The method according to claim 1, wherein the metadata includes field information of each field in the target document and corresponding data source information; if the field information is bound in the analyzed control information, updating the control information according to metadata preset for the target document comprises:
and if the field information is bound in the control information, modifying the data source information corresponding to the field information bound in the control information according to the target data source information corresponding to the target field information matched with the field information bound in the control information in the metadata.
3. The method according to claim 1, wherein the metadata comprises field information of each field in the target document; if the field information is bound in the analyzed control information, updating the control information according to metadata preset for the target document comprises:
and if the analyzed control information is bound with field information and the metadata does not have target field information matched with the field information bound in the control information, clearing the control information.
4. The method of claim 3, wherein the clearing the control information if the field information is bound to the control information and the target field information matching the field information bound to the control information does not exist in the metadata is analyzed, the clearing the control information comprises:
and if the field information is bound in the control information, the target field information matched with the field information bound in the control information does not exist in the metadata, and the field information bound in the control information is the field information in the entry table in the source document, emptying the data source information corresponding to the field information bound in the control information.
5. The method of claim 3, wherein the clearing the control information if the field information is bound to the control information and the target field information matching the field information bound to the control information does not exist in the metadata is analyzed, the clearing the control information comprises:
and if the analyzed control information is bound with field information, the metadata does not have target field information matched with the field information bound in the control information, and the field information bound in the control information is the field information in the main table in the source document, emptying all information in the control information.
6. The method according to any one of claims 1 to 5, further comprising:
if the analyzed control type of the control is the control type which does not relate to the data source, keeping the control information of the control unchanged;
if the analyzed control type of the control is the control type related to the data source, identifying whether field information is bound in the control information;
if not, executing the step of keeping the control information unchanged if the unbound field information in the control information is analyzed;
and if the binding exists, executing the step of updating the control information according to metadata preset for the target document if the field information is analyzed to be bound in the control information.
7. A document template generation apparatus, the apparatus comprising:
the control analysis module is used for traversing each control in the document template of the source document and analyzing the control information of each traversed control; if the unbound field information in the control information is analyzed, keeping the control information unchanged;
the control information updating module is used for updating the control information according to metadata preset for the target document if the field information is bound in the analyzed control information;
and the bill template generating module is used for generating the bill template of the target bill according to the unchanged control information and the updated control information in the bill template of the source bill.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by a processor.
CN202211155301.2A 2022-09-22 2022-09-22 Document template generation method and device, computer equipment and storage medium Pending CN115409014A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211155301.2A CN115409014A (en) 2022-09-22 2022-09-22 Document template generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211155301.2A CN115409014A (en) 2022-09-22 2022-09-22 Document template generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115409014A true CN115409014A (en) 2022-11-29

Family

ID=84165842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211155301.2A Pending CN115409014A (en) 2022-09-22 2022-09-22 Document template generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115409014A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116992849A (en) * 2023-08-04 2023-11-03 北京数字政通科技股份有限公司 Method and system for creating and printing electronic document template

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116992849A (en) * 2023-08-04 2023-11-03 北京数字政通科技股份有限公司 Method and system for creating and printing electronic document template

Similar Documents

Publication Publication Date Title
US20120259710A1 (en) Design process of advertisements
US9336245B2 (en) Systems and methods providing master data management statistics
US20240095256A1 (en) Method and system for persisting data
CN102844774A (en) Web page control method, computer system and program
US20070124275A1 (en) Considering transient data also in reports generated based on data eventually stored in a data-warehouse
CN115409014A (en) Document template generation method and device, computer equipment and storage medium
CN114444478A (en) Voucher visualization method and device, electronic equipment and storage medium
JP2015184723A (en) document creation support system
CN111444368B (en) Method and device for constructing user portrait, computer equipment and storage medium
CN111026963A (en) Data query method and device, and configuration information setting method and device
CN110781235A (en) Big data based purchase data processing method and device, terminal and storage medium
US8856126B2 (en) Simplifying grouping of data items stored in a database
WO2018206819A1 (en) Data storage method and apparatus
CN114169306A (en) Method, device and equipment for generating electronic receipt and readable storage medium
CN114596147A (en) Data reconciliation method and device, computer equipment and storage medium
US9208224B2 (en) Business content hierarchy
CA2827378C (en) System and method for variant content management
CN117093759A (en) Data processing method, device, computer equipment and storage medium
CN117494689A (en) Payroll template generation method, device, apparatus, storage medium and program product
CN114663207A (en) Receipt generation method and device, computer equipment and storage medium
CN116383138A (en) Document changing method, device, computer equipment and storage medium
CN116415914A (en) Service data processing method, device, computer equipment and storage medium
CN117669528A (en) Document generation method, device, computer equipment and storage medium
CN117011054A (en) Financial information processing method, device, equipment and storage medium based on multiple channels
CN117933200A (en) Document editing method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination