CN110263317B - Method and device for generating document template - Google Patents

Method and device for generating document template Download PDF

Info

Publication number
CN110263317B
CN110263317B CN201910569982.9A CN201910569982A CN110263317B CN 110263317 B CN110263317 B CN 110263317B CN 201910569982 A CN201910569982 A CN 201910569982A CN 110263317 B CN110263317 B CN 110263317B
Authority
CN
China
Prior art keywords
tag
label
library
filled
data source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910569982.9A
Other languages
Chinese (zh)
Other versions
CN110263317A (en
Inventor
王铁成
刘丽娟
项建
刘彤彬
李昌
丁玉见
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kunlun Digital Technology Co ltd
China National Petroleum Corp
Original Assignee
Kunlun Digital Technology Co ltd
China National Petroleum Corp
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 Kunlun Digital Technology Co ltd, China National Petroleum Corp filed Critical Kunlun Digital Technology Co ltd
Priority to CN201910569982.9A priority Critical patent/CN110263317B/en
Publication of CN110263317A publication Critical patent/CN110263317A/en
Application granted granted Critical
Publication of CN110263317B publication Critical patent/CN110263317B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application provides a method and a device for generating a document template, wherein the method for generating the document template comprises the following steps: acquiring label information corresponding to a to-be-filled area in a blank document template, inquiring a preset label library according to the label information, and acquiring a to-be-filled label matched with the label information; inquiring a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and acquiring the grammar formats of the labels to be filled; updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with grammar formats; filling the grammar editing tag into the to-be-filled area to generate a document template. The editing efficiency of the document template can be improved.

Description

Method and device for generating document template
Technical Field
The application relates to the technical field of document editing, in particular to a method and a device for generating a document template.
Background
The document template can preset the basic structure of the document and the attribute of the document content, for example, the chapter architecture, character format, paragraph format, page format and the like of the document can be predefined, so that the adjustment of the document structure in the follow-up document editing is avoided, and therefore, the document is generated by using the document template, which is an effective technical means for improving the document editing efficiency.
In the process of generating the document template, various labels carrying grammar are required to be filled in corresponding positions of the document template so as to facilitate subsequent document editing, for example, from a library of a document template engine, according to the layout requirement of the document template, the labels to be filled in are queried, then, the document grammar editing is carried out for each label to be filled in, so as to obtain a document grammar editing label, and finally, the document template is generated by filling the document grammar editing label in the corresponding positions of the document template. The method comprises the steps that a consistency grammar is based on java development language, and a consistency grammar editing tag which needs to be filled in when a document template is generated by a relevant technician through the consistency grammar.
However, in the method for generating the document template, in the process of generating the document template, technicians are required to edit the document template by performing the density grammar for the labels to be filled, so that the technicians required to compile the document template know and master java or other object-oriented programming languages, and perform the density grammar editing of the labels by using the programming languages, so that the technical requirement for generating the document template is higher, the document template generation efficiency is lower, and personalized compiling of the document template cannot be realized for users who do not understand the computer programming languages, and the personalized compiling of the document template is one of the technical means for meeting the personalized requirements of the document, reducing the modification of the document template due to the personalized requirements of the users and improving the document template editing efficiency.
Disclosure of Invention
In view of this, the present application aims to provide a method and an apparatus for generating a document template, so as to improve the efficiency of generating the document template.
In a first aspect, an embodiment of the present application provides a method for generating a document template, including:
acquiring label information corresponding to a to-be-filled area in a blank document template, inquiring a preset label library according to the label information, and acquiring a to-be-filled label matched with the label information;
inquiring a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and acquiring the grammar formats of the labels to be filled;
updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with grammar formats;
filling the grammar editing tag into the to-be-filled area to generate a document template.
With reference to the first aspect, the present invention provides a first possible implementation manner of the first aspect, wherein the obtaining tag information corresponding to a to-be-filled area in a blank document template, querying a preset tag library according to the tag information, and obtaining a to-be-filled tag matched with the tag information includes:
receiving label information of labels to be filled, which are determined by a user in an area to be filled;
retrieving the tag library according to the tag information, and displaying a plurality of tags matched with the tag information;
and receiving labels selected by the user according to the displayed multiple labels to obtain the labels to be filled.
With reference to the first aspect, the present invention provides a second possible implementation manner of the first aspect, where before the acquiring tag information corresponding to a to-be-filled area in the blank document template, the method further includes:
receiving a custom tag from a user, and inquiring the tag library according to the tag identification of the custom tag;
if the custom tag is not stored in the tag library, storing the custom tag and a data source corresponding to the custom tag into the tag library.
With reference to the second possible implementation manner of the first aspect, the present invention provides a third possible implementation manner of the first aspect, wherein the storing the custom tag and the data source corresponding to the custom tag in the tag library includes:
extracting keywords contained in a data source corresponding to the custom tag;
according to the extracted keywords, calculating the similarity of the keywords corresponding to each classified label sub-library in the label library, and obtaining the classified label sub-library with the highest similarity;
and classifying the custom tags into the classified tag sub-library with the highest similarity.
With reference to the second possible implementation manner of the first aspect, the present invention provides a fourth possible implementation manner of the first aspect, wherein the method further includes:
if the label library stores the labels identical to the customized labels, displaying the stored labels and the data sources corresponding to the labels;
and receiving a renamed tag obtained by renaming the customized tag according to the displayed tag and a data source corresponding to the tag by the user, determining that the tag library does not store the tag identical to the renamed tag, and storing the renamed tag and the data source corresponding to the renamed tag into the tag library.
With reference to the first aspect, any one of the first to fourth possible implementation manners of the first aspect, the present invention provides a fifth possible implementation manner of the first aspect, wherein the method further includes:
receiving a document editing request, and loading a target document template corresponding to the document editing request;
reading a hierarchical directory in the target document template, and obtaining a target label under the hierarchical directory;
and acquiring a data source mapped by the target tag, and filling the position corresponding to the target tag according to the acquired data source to generate a document.
With reference to the fifth possible implementation manner of the first aspect, the present invention provides a sixth possible implementation manner of the first aspect, wherein the tag is a structured tag, the acquiring the data source mapped by the target tag, and filling the location corresponding to the target tag according to the acquired data source includes:
displaying data in a structured data source corresponding to the structured tag;
and receiving data selected by a user according to the structured data source, and filling the selected data according to the corresponding relation between the data field names and the target labels.
With reference to the fifth possible implementation manner of the first aspect, the present invention provides a seventh possible implementation manner of the first aspect, wherein the tag is an unstructured tag, the acquiring the data source mapped by the target tag, and filling the location corresponding to the target tag according to the acquired data source includes:
displaying data in an unstructured data source corresponding to the unstructured label;
receiving data selected by a user according to an unstructured data source, and inquiring a file stream of the data file by taking a data file identifier corresponding to the selected data as an inquiry condition;
filling the file stream to the position of the unstructured label.
With reference to the fifth possible implementation manner of the first aspect, the present invention provides an eighth possible implementation manner of the first aspect, wherein the tag is a text tag, the acquiring the data source mapped by the target tag, and filling the location corresponding to the target tag according to the acquired data source includes:
displaying a text box or a text field corresponding to the text label;
receiving text content input by a user in the text box or text field, and filling the received text content to the position of the text label;
adjusting the area size of the text box or text field according to the text content input by the user in the text box or text field;
and acquiring the text box or text field of the text content which is not input by the user, and processing the text box or text field of the text content which is not input according to a preset strategy.
In a second aspect, an embodiment of the present application provides an apparatus for generating a document template, including:
the label inquiry module is used for acquiring label information corresponding to a to-be-filled area in the blank document template, inquiring a preset label library according to the label information, and acquiring a to-be-filled label matched with the label information;
the grammar query module is used for querying a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and acquiring the grammar formats of the label mapping to be filled;
the grammar mapping module is used for updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with the grammar formats;
and the template generation module is used for filling the grammar editing tag into the region to be filled so as to generate a document template.
In a third aspect, embodiments of the present application provide a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method described above.
According to the method and the device for generating the document template, label information corresponding to the to-be-filled area in the blank document template is obtained, a preset label library is queried according to the label information, and a to-be-filled label matched with the label information is obtained; inquiring a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and acquiring the grammar formats of the labels to be filled; updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with grammar formats; filling the grammar editing tag into the to-be-filled area to generate a document template. Therefore, the grammar format corresponding to the label to be filled is obtained by presetting the label type mapping grammar format and inquiring according to the label type, so that the label to be filled is written into the grammar format, grammar format editing for the label to be filled is not required by a user, the time required for generating the document template is reduced, and the efficiency of generating the document template can be effectively improved.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a method for generating a document template according to an embodiment of the present application;
FIG. 2 is another flow chart of a method for generating a document template according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an apparatus for generating a document template according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device 400 according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
FIG. 1 is a flowchart of a method for generating a document template according to an embodiment of the present application. As shown in fig. 1, the method includes:
step 101, obtaining label information corresponding to a to-be-filled area in a blank document template, inquiring a preset label library according to the label information, and obtaining a to-be-filled label matched with the label information;
in the embodiment of the application, a user can define a chapter structure, a character format, a paragraph format, a page format and the like of the blank document template in advance, and determine each area to be filled and a label to be filled in of each area to be filled in according to the actual requirement of the user.
In the embodiment of the present application, the tag information may be a tag identifier, including but not limited to: a tag name, a tag code name, etc. The label information is some characteristic information of the labels to be filled, which are determined by the user in the area to be filled, and because the user cannot determine the accurate label information of the labels to be filled, fuzzy retrieval can be performed according to the characteristic information of the labels determined by the user, retrieval results are listed, and the user can determine the labels to be selected according to the retrieval results. As an optional embodiment, obtaining tag information corresponding to a to-be-filled area in a blank document template, querying a preset tag library according to the tag information, and obtaining a to-be-filled tag matched with the tag information, where the method includes:
a01, receiving label information of labels to be filled, which are determined by a user in a region to be filled;
a02, searching the tag library according to the tag information, and displaying a plurality of tags matched with the tag information;
and A03, receiving labels selected by the user according to the displayed multiple labels, and obtaining the labels to be filled.
In this embodiment, the user may customize the personalized tag according to the actual need and store the personalized tag in the tag library to meet the personalized requirement of the user for editing the document template, so as an optional embodiment, before obtaining the tag information corresponding to the to-be-filled area in the blank document template, the method further includes:
a11, receiving a custom tag from a user, and inquiring the tag library according to the tag identification of the custom tag;
in the embodiment of the application, the user can generate the label according to the data source through analyzing the data source to form the customized label, so that familiarity and friendliness of the user when applying the label can be improved.
In this embodiment, as an optional embodiment, the tag is identified by a tag name and/or a tag code name. The label name can be Chinese characters, and the label code name can also be Chinese characters, and the label name corresponds to the label code name one by one.
And A12, if the custom tag is not stored in the tag library, storing the custom tag and a data source corresponding to the custom tag into the tag library.
In the present embodiment, data sources include, but are not limited to: system data sources, application data sources, log data sources, etc. In order to facilitate label management, the stored labels can be classified and managed in a label library. For example, the tags are classified according to the categories of the data sources (geological domain data sources, communication domain data sources, electromechanical domain data sources, etc.), and thus, as an alternative embodiment, storing the custom tags and the data sources corresponding to the custom tags into the tag library includes:
a121, extracting keywords contained in a data source corresponding to the custom tag;
a122, calculating the similarity of the keywords corresponding to each classified label sub-library in the label library according to the extracted keywords, and obtaining the classified label sub-library with the highest similarity;
in the embodiment of the application, the classification label sub-library is identified by one or more keywords.
And A123, classifying the customized labels into the classified label sub-library with the highest similarity.
In this embodiment, as an optional embodiment, the classifying tag sub-library includes: structured tag sub-libraries, unstructured tag sub-libraries, and text (txt) tag sub-libraries. Wherein the structured tag sub-library is used to store structured tags, e.g., relational database tables/view tags; the unstructured tag sub-library is used for storing unstructured tags, such as data file tags in a file system; the text label sub-library is used to store text labels, such as labels formed by user input content.
In this embodiment, as an optional embodiment, if the tag library already stores the tag with the same tag identifier as the custom tag, the user may be notified to rename the custom tag, so the method may further include:
b11, if the label library stores the labels identical to the customized labels, displaying the stored labels and the data sources corresponding to the labels;
and B12, receiving a renamed label obtained by renaming the customized label according to the displayed label and a data source corresponding to the label by the user, determining that the label library does not store the label identical to the renamed label, and storing the renamed label and the data source corresponding to the renamed label into the label library.
In this embodiment of the present application, when the custom tag of the user is the same as the tag stored in the tag library, but the corresponding data sources are different, the user may modify the custom tag name to avoid tag duplication, and if the corresponding data sources are the same, the user may cancel renaming the custom tag and discard the storage. In this way, the user can decide whether to continue to create a new label or select an original label according to the search result by searching according to the label information of the customized label and listing the search result.
Step 102, inquiring a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and obtaining the grammar formats of the label mapping to be filled;
in this embodiment of the present application, according to the type tag sub-library in which the tag to be filled is located, the type of the tag to be filled may be obtained, that is, the type of the type tag sub-library is the type of the tag to be filled.
In the embodiment of the present application, as an alternative embodiment, the syntax format includes, but is not limited to, a density syntax format.
In the embodiment of the present application, the labels in the label library do not carry a variability grammar format. Thus, the tags in the tag library or the sort tag sub-library cannot be directly applied in the process of generating the document template.
In the embodiment of the application, for each classification tag, a corresponding grammar format is preset, and in the grammar format, information of the corresponding tag is represented by a tag variable name. In this way, in subsequent applications, the tag variable name may be replaced with a specific tag, thereby enabling the tag to have a grammatical format.
Step 103, updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with grammar formats;
in the embodiment of the application, when a user obtains a to-be-filled tag from a tag library and fills the to-be-filled tag into a corresponding to-be-filled area, a grammar format is generated for the to-be-filled tag, so that the release of the grammar format of the to-be-filled tag is realized. In this way, the grammar format corresponding to the label to be filled is obtained by inquiring in a label type matching mode, so that the label to be filled is written into the grammar format, and a user does not need to edit the density grammar format for the label to be filled, so that the user does not need to know and master java or other object-oriented programming languages, the technical requirement on generating the document template is low, and the time required for generating the document template is reduced, the generation efficiency of the document template is effectively improved, and meanwhile, the personalized compiling of the document template can be realized.
And 104, filling the grammar editing tags into the to-be-filled area to generate a document template.
In the embodiment of the application, the user can set the position (to-be-filled area), form and the like of the label in the document template. As an alternative embodiment, the document template includes, but is not limited to: contract templates, resume templates, financial templates, etc. For example, the contract template includes: a party a tag, a party b signature item tag, a general term tag, a special term tag, a legal person tag, etc., the resume template comprises: personal information labels, work experience labels, educational labels, professional skill labels, desired industry labels, desired salary labels, and the like.
In this embodiment of the present application, as an optional embodiment, filling the grammar editing tag into the region to be filled in to generate a document template, including:
c11, filling the grammar editing tag into the region to be filled;
and C12, traversing each region to be filled in the blank document template, and determining that each region to be filled in is filled with a corresponding grammar editing tag to obtain the document template.
According to the embodiment of the application, according to the label information corresponding to each to-be-filled area, a label library and a mapping relation library are sequentially queried, grammar editing labels corresponding to the label information are obtained, and the grammar editing labels are filled into the corresponding to-be-filled areas in the blank document template.
In this embodiment of the present application, editing may be performed based on a document template to obtain a document, so as an alternative embodiment, fig. 2 is another flowchart of a method for generating a document template according to an embodiment of the present application, where the method includes:
step 201, obtaining label information corresponding to a to-be-filled area in a blank document template, inquiring a preset label library according to the label information, and obtaining a to-be-filled label matched with the label information;
step 202, inquiring a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and obtaining the grammar formats of the label mapping to be filled;
step 203, updating the tag variable name in the acquired grammar format to the tag to be filled to obtain a grammar editing tag with the grammar format;
and 204, filling the grammar editing tags into the to-be-filled area to generate a document template.
In the present embodiment, steps 201-204 are the same as steps 101-104, respectively.
Step 205, receiving a document editing request, and loading a target document template corresponding to the document editing request;
in the embodiment of the application, the user can select the corresponding target document template to load according to the document actually required. For example, if the user needs to edit the personal resume document, the personal resume template is selected from the document template library to be loaded.
Step 206, reading the hierarchical directory in the target document template and obtaining a target label under the hierarchical directory;
in the embodiment of the application, the target document template comprises one or more hierarchical directories, and corresponding target labels are respectively arranged at different positions under each hierarchical directory.
Step 207, obtaining a data source mapped by the target tag, and filling a position corresponding to the target tag according to the obtained data source to generate a document.
In this embodiment, as an optional embodiment, the plurality of positions corresponding to the target tag, each of which is distinguished by a position identifier, the filling the position corresponding to the target tag according to the acquired data source to generate the document includes:
and inquiring data corresponding to the position identifier from the acquired data source aiming at each position identifier corresponding to the target tag, and filling the inquired data into the position corresponding to the position identifier to generate a document.
In the embodiment of the application, the labels in the document templates are extracted, the data sources matched with the labels are searched and acquired from the label library according to the labels, and filling information matched with the position identifications is acquired from the data sources according to the position identifications and filled in the positions of the position identifications. For example, a tag in the document template is "financial statement-001", a data source matching the "financial statement-001" is found from the tag library, and a plurality of location identifiers and filling information corresponding to or associated with each location identifier are found from the data source. For example, according to the position identification "upper left-001" in the label "financial statement-001", in the acquired data source, the filling information associated with "upper left-001" is acquired, and the associated filling information is filled into the position corresponding to "upper left-001", thereby generating the document.
In this embodiment of the present application, as an optional embodiment, the document template includes a plurality of identical labels, and the information filled in the positions corresponding to the identical labels is identical. For the same position identification under the same label, the corresponding filling information is the same.
In this embodiment, as an optional embodiment, the tag is a structured tag, the obtaining a data source mapped by the target tag, and filling, according to the obtained data source, a location corresponding to the target tag includes:
displaying data in a structured data source corresponding to the structured tag;
and receiving data selected by a user according to the structured data source, and filling the selected data according to the corresponding relation between the data field names and the target labels.
In embodiments of the present application, structured tags may support text and form filling. When the structured label is filled with data, the structured label can be respectively assigned according to the names of the data fields, so that filling of a single field or a single table or a complex table can be realized.
In this embodiment, as another optional embodiment, the tag is an unstructured tag, the obtaining a data source mapped by the target tag, and filling, according to the obtained data source, a location corresponding to the target tag includes:
displaying data in an unstructured data source corresponding to the unstructured label;
receiving data selected by a user according to an unstructured data source, and inquiring a file stream of the data file by taking a data file identifier corresponding to the selected data as an inquiry condition;
filling the file stream to the position of the unstructured label.
In the embodiment of the application, the unstructured label can support picture filling, and when filling data, a file stream is acquired according to the data file identifier to fill.
In this embodiment, as still another optional embodiment, the tag is a text tag, the obtaining a data source mapped by the target tag, and filling, according to the obtained data source, a location corresponding to the target tag includes:
displaying a text box or a text field corresponding to the text label;
receiving text content input by a user in the text box or text field, and filling the received text content to the position of the text label;
adjusting the area size of the text box or text field according to the text content input by the user in the text box or text field;
and acquiring the text box or text field of the text content which is not input by the user, and processing the text box or text field of the text content which is not input according to a preset strategy.
In an embodiment of the present application, the processing includes: and deleting or reserving the text boxes or text fields of the text content which is not input according to the preset area, and simultaneously, automatically adjusting the area size of the text labels. Therefore, the reserved area of each text box or text field of the document template is matched with the area occupied by the text content which needs to be input by the user, and the waste of the area in the document template is avoided.
In the embodiment of the application, when the txt label is filled in a document, a text box or a text field is displayed when a user positions the txt label, and the user can fill in text content in the text box or the text field to realize text filling.
FIG. 3 is a schematic diagram of an apparatus for generating a document template according to an embodiment of the present application. As shown in fig. 3, the apparatus includes:
the label inquiry module 301 is configured to obtain label information corresponding to a to-be-filled area in a blank document template, inquire a preset label library according to the label information, and obtain a to-be-filled label matched with the label information;
in the embodiment of the present application, the tag information may be a tag identifier, including but not limited to: a tag name, a tag code name, etc.
In this embodiment, as an optional embodiment, the tag query module 301 is specifically configured to:
receiving label information of labels to be filled, which are determined by a user in an area to be filled;
retrieving the tag library according to the tag information, and displaying a plurality of tags matched with the tag information;
and receiving labels selected by the user according to the displayed multiple labels to obtain the labels to be filled.
The grammar query module 302 is configured to query a mapping relation library of preset tag types and grammar formats according to the types of the tags to be filled, and obtain the grammar format mapped by the tags to be filled;
in the embodiment of the present application, as an alternative embodiment, the syntax format includes, but is not limited to, a density syntax format. For each classified label, a corresponding grammar format is preset, and in the grammar format, information of the corresponding label is represented by a label variable name. In this way, in subsequent applications, the tag variable name may be replaced with a specific tag, thereby enabling the tag to have a grammatical format.
The grammar mapping module 303 is configured to update the tag variable name in the obtained grammar format to the tag to be filled, so as to obtain a grammar editing tag with the grammar format;
the template generating module 304 is configured to fill the grammar editing tag into the to-be-filled area to generate a document template.
In this embodiment, as an optional embodiment, the template generating module 304 is specifically configured to:
filling the grammar editing tag into the region to be filled;
traversing each to-be-filled area in the blank document template, and determining that each to-be-filled area is filled with a corresponding grammar editing tag to obtain the document template.
In an embodiment of the present application, as an optional embodiment, the apparatus further includes:
a label customizing module (not shown in the figure) for receiving a customized label from a user, and inquiring the label library according to the label identification of the customized label;
if the custom tag is not stored in the tag library, storing the custom tag and a data source corresponding to the custom tag into the tag library.
In this embodiment of the present application, as an optional embodiment, the storing the custom tag and the data source corresponding to the custom tag to the tag library includes:
extracting keywords contained in a data source corresponding to the custom tag;
according to the extracted keywords, calculating the similarity of the keywords corresponding to each classified label sub-library in the label library, and obtaining the classified label sub-library with the highest similarity;
and classifying the custom tags into the classified tag sub-library with the highest similarity.
In the embodiment of the application, the classification label sub-library is identified by one or more keywords. As an alternative embodiment, the categorization label sub-library comprises: structured label sub-libraries, unstructured label sub-libraries and text label sub-libraries.
In this embodiment of the present application, as another optional embodiment, the tag customization module is specifically further configured to:
if the label library stores the labels identical to the customized labels, displaying the stored labels and the data sources corresponding to the labels;
and receiving a renamed tag obtained by renaming the customized tag according to the displayed tag and a data source corresponding to the tag by the user, determining that the tag library does not store the tag identical to the renamed tag, and storing the renamed tag and the data source corresponding to the renamed tag into the tag library.
In the embodiment of the application, the label information of the customized label is used for searching, the search result is listed, and the user can decide whether to continue to create a new label or select an original label according to the search result.
In an embodiment of the present application, as another optional embodiment, the apparatus further includes:
a template loading module (not shown in the figure) for receiving a document editing request and loading a target document template corresponding to the document editing request;
the target label acquisition module is used for reading the hierarchical catalogue in the target document template and acquiring a target label under the hierarchical catalogue;
and the document generation module is used for acquiring the data source mapped by the target tag and filling the position corresponding to the target tag according to the acquired data source so as to generate a document.
In this embodiment of the present application, as an optional embodiment, the tag is a structured tag, and the document generating module is specifically configured to:
displaying data in a structured data source corresponding to the structured tag;
and receiving data selected by a user according to the structured data source, and filling the selected data according to the corresponding relation between the data field names and the target labels.
In this embodiment of the present application, as another optional embodiment, the tag is an unstructured tag, and the document generating module is specifically configured to:
displaying data in an unstructured data source corresponding to the unstructured label;
receiving data selected by a user according to an unstructured data source, and inquiring a file stream of the data file by taking a data file identifier corresponding to the selected data as an inquiry condition;
filling the file stream to the position of the unstructured label.
In this embodiment of the present application, as yet another optional embodiment, the tag is a text tag, and the document generating module is specifically configured to:
displaying a text box or a text field corresponding to the text label;
receiving text content input by a user in the text box or text field, and filling the received text content to the position of the text label;
adjusting the area size of the text box or text field according to the text content input by the user in the text box or text field;
and acquiring the text box or text field of the text content which is not input by the user, and processing the text box or text field of the text content which is not input according to a preset strategy.
As shown in fig. 4, an embodiment of the present application provides a computer device 400 for executing the method for generating a document template in fig. 1, where the device includes a memory 401, a processor 402, and a computer program stored in the memory 401 and executable on the processor 402, where the steps of the method for generating a document template are implemented when the processor 402 executes the computer program.
Specifically, the above-described memory 401 and processor 402 can be general-purpose memories and processors, and are not particularly limited herein, and the above-described method of generating a document template can be performed when the processor 402 runs a computer program stored in the memory 401.
Corresponding to the method of generating a document template in fig. 1, the embodiments of the present application also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above-described method of generating a document template.
In particular, the storage medium can be a general-purpose storage medium, such as a removable disk, a hard disk, or the like, on which the computer program is executed to perform the above-described method of generating a document template.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments provided in the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: like reference numerals and letters in the following figures denote like items, and thus once an item is defined in one figure, no further definition or explanation of it is required in the following figures, and furthermore, the terms "first," "second," "third," etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present application, and are not intended to limit the scope of the present application, but the present application is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, the present application is not limited thereto. Any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or make equivalent substitutions for some of the technical features within the technical scope of the disclosure of the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the corresponding technical solutions. Are intended to be encompassed within the scope of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. A method of generating a document template, comprising:
acquiring label information corresponding to a to-be-filled area in a blank document template, inquiring a preset label library according to the label information, and acquiring a to-be-filled label matched with the label information;
inquiring a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and acquiring the grammar formats of the labels to be filled;
updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with grammar formats;
filling the grammar editing tag into the region to be filled to generate a document template;
before the label information corresponding to the to-be-filled area in the blank document template is obtained, the method further comprises the following steps:
receiving a custom tag from a user, and inquiring the tag library according to the tag identification of the custom tag;
if the custom tag is not stored in the tag library, storing the custom tag and a data source corresponding to the custom tag into the tag library;
the storing the custom tag and the data source corresponding to the custom tag in the tag library includes:
extracting keywords contained in a data source corresponding to the custom tag;
according to the extracted keywords, calculating the similarity of the keywords corresponding to each classified label sub-library in the label library, and obtaining the classified label sub-library with the highest similarity;
and classifying the custom tags into the classified tag sub-library with the highest similarity.
2. The method of claim 1, wherein the obtaining tag information corresponding to the to-be-filled area in the blank document template, querying a preset tag library according to the tag information, and obtaining the to-be-filled tag matched with the tag information, includes:
receiving label information of labels to be filled, which are determined by a user in an area to be filled;
retrieving the tag library according to the tag information, and displaying a plurality of tags matched with the tag information;
and receiving labels selected by the user according to the displayed multiple labels to obtain the labels to be filled.
3. The method of claim 1, wherein the method further comprises:
if the label library stores the labels identical to the customized labels, displaying the stored labels and the data sources corresponding to the labels;
and receiving a renamed tag obtained by renaming the customized tag according to the displayed tag and a data source corresponding to the tag by the user, determining that the tag library does not store the tag identical to the renamed tag, and storing the renamed tag and the data source corresponding to the renamed tag into the tag library.
4. A method according to any one of claims 1 to 3, wherein the method further comprises:
receiving a document editing request, and loading a target document template corresponding to the document editing request;
reading a hierarchical directory in the target document template, and obtaining a target label under the hierarchical directory;
and acquiring a data source mapped by the target tag, and filling the position corresponding to the target tag according to the acquired data source to generate a document.
5. The method of claim 4, wherein the tag is a structured tag, the obtaining the data source mapped by the target tag, and filling the location corresponding to the target tag according to the obtained data source, comprises:
displaying data in a structured data source corresponding to the structured tag;
and receiving data selected by a user according to the structured data source, and filling the selected data according to the corresponding relation between the data field names and the target labels.
6. The method of claim 4, wherein the tag is an unstructured tag, the obtaining the data source mapped by the target tag, and filling the location corresponding to the target tag according to the obtained data source, comprises:
displaying data in an unstructured data source corresponding to the unstructured label;
receiving data selected by a user according to an unstructured data source, and inquiring a file stream of the data file by taking a data file identifier corresponding to the selected data as an inquiry condition;
filling the file stream to the position of the unstructured label.
7. The method of claim 4, wherein the tag is a text tag, the obtaining the data source mapped by the target tag, and filling the location corresponding to the target tag according to the obtained data source, comprises:
displaying a text box or a text field corresponding to the text label;
receiving text content input by a user in the text box or text field, and filling the received text content to the position of the text label;
adjusting the area size of the text box or text field according to the text content input by the user in the text box or text field;
and acquiring the text box or text field of the text content which is not input by the user, and processing the text box or text field of the text content which is not input according to a preset strategy.
8. An apparatus for generating a document template, comprising:
the label inquiry module is used for acquiring label information corresponding to a to-be-filled area in the blank document template, inquiring a preset label library according to the label information, and acquiring a to-be-filled label matched with the label information;
the grammar query module is used for querying a mapping relation library of preset label types and grammar formats according to the types of the labels to be filled, and acquiring the grammar formats of the label mapping to be filled;
the grammar mapping module is used for updating the tag variable names in the acquired grammar formats into the tags to be filled to obtain grammar editing tags with the grammar formats;
the template generation module is used for filling the grammar editing tag into the region to be filled so as to generate a document template;
the label customizing module is used for receiving a customizing label from a user and inquiring the label library according to the label identification of the customizing label;
if the custom tag is not stored in the tag library, storing the custom tag and a data source corresponding to the custom tag into the tag library;
the storing the custom tag and the data source corresponding to the custom tag in the tag library includes:
extracting keywords contained in a data source corresponding to the custom tag;
according to the extracted keywords, calculating the similarity of the keywords corresponding to each classified label sub-library in the label library, and obtaining the classified label sub-library with the highest similarity;
and classifying the custom tags into the classified tag sub-library with the highest similarity.
CN201910569982.9A 2019-06-27 2019-06-27 Method and device for generating document template Active CN110263317B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910569982.9A CN110263317B (en) 2019-06-27 2019-06-27 Method and device for generating document template

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910569982.9A CN110263317B (en) 2019-06-27 2019-06-27 Method and device for generating document template

Publications (2)

Publication Number Publication Date
CN110263317A CN110263317A (en) 2019-09-20
CN110263317B true CN110263317B (en) 2023-06-02

Family

ID=67922509

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910569982.9A Active CN110263317B (en) 2019-06-27 2019-06-27 Method and device for generating document template

Country Status (1)

Country Link
CN (1) CN110263317B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113808696B (en) * 2020-06-15 2024-05-28 飞依诺科技股份有限公司 Ultrasonic data processing method, ultrasonic data processing device, computer equipment and storage medium
CN112001158A (en) * 2020-08-24 2020-11-27 平安国际智慧城市科技股份有限公司 Document generation method and device, computer equipment and computer readable storage medium
CN112016273B (en) * 2020-09-03 2024-03-12 平安科技(深圳)有限公司 Document catalog generation method, device, electronic equipment and readable storage medium
CN112329416A (en) * 2020-10-27 2021-02-05 维沃移动通信有限公司 Message generation method and device and electronic equipment
CN112800724A (en) * 2020-12-29 2021-05-14 杭州涂鸦信息技术有限公司 Readable file export method of visual configuration template and related device
CN113486230A (en) * 2021-07-28 2021-10-08 黄泽恒 Method for generating labeled message template
CN114239529A (en) * 2021-12-16 2022-03-25 深圳前海环融联易信息科技服务有限公司 Document generation method, device, equipment and medium based on template engine
CN116522892B (en) * 2023-07-03 2023-12-19 广东省特种设备检测研究院中山检测院 Automatic generation method and generation system of report template
CN117172228B (en) * 2023-08-15 2024-06-11 昆仑数智科技有限责任公司 Knowledge-graph-based oil and gas reserves report generation method, device and equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2345937A1 (en) * 2001-05-07 2002-11-07 Go Simon Sunatori Hierarchical document assembly method and system
CN102945287A (en) * 2012-11-29 2013-02-27 南京睿恒智晟软件科技有限公司 Java server page (JSP) data automatic paging java standard tag library (JSTL) label technology and application
CN105335338A (en) * 2014-06-25 2016-02-17 阿里巴巴集团控股有限公司 Electronic document conversion method and device
CN105955759A (en) * 2016-05-26 2016-09-21 浪潮(苏州)金融技术服务有限公司 Template engine realization method used for Web development
CN106066849A (en) * 2016-05-30 2016-11-02 车智互联(北京)科技有限公司 A kind of template page editing system and method
CN107643889A (en) * 2016-07-20 2018-01-30 平安科技(深圳)有限公司 Page rendering method and apparatus based on template engine
CN108052496A (en) * 2017-12-19 2018-05-18 国云科技股份有限公司 A kind of word picture and text formatting system and its implementation based on source file

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2345937A1 (en) * 2001-05-07 2002-11-07 Go Simon Sunatori Hierarchical document assembly method and system
CN102945287A (en) * 2012-11-29 2013-02-27 南京睿恒智晟软件科技有限公司 Java server page (JSP) data automatic paging java standard tag library (JSTL) label technology and application
CN105335338A (en) * 2014-06-25 2016-02-17 阿里巴巴集团控股有限公司 Electronic document conversion method and device
CN105955759A (en) * 2016-05-26 2016-09-21 浪潮(苏州)金融技术服务有限公司 Template engine realization method used for Web development
CN106066849A (en) * 2016-05-30 2016-11-02 车智互联(北京)科技有限公司 A kind of template page editing system and method
CN107643889A (en) * 2016-07-20 2018-01-30 平安科技(深圳)有限公司 Page rendering method and apparatus based on template engine
CN108052496A (en) * 2017-12-19 2018-05-18 国云科技股份有限公司 A kind of word picture and text formatting system and its implementation based on source file

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"cshtml一二";黄仔;《https://www.cnblogs.com/ariter/p/5884854.html》;20160919;1-4 *
"HTML"s New Template Tag";Eric Bidelman;《https://web.dev/webcomponents-template/》;20131218;1-8 *
"基于模板技术的站群快速搭建研究";刘丹华;《中国优秀硕士学位论文全文数据库 信息科技辑》;20170315;I139-505 *

Also Published As

Publication number Publication date
CN110263317A (en) 2019-09-20

Similar Documents

Publication Publication Date Title
CN110263317B (en) Method and device for generating document template
JP5435568B2 (en) Method and apparatus for reusing data access and presentation elements
US8260815B2 (en) System and method for accessing non-compatible content repositories
US9323731B1 (en) Data extraction using templates
US8627208B2 (en) Application generator for data transformation applications
JP5152877B2 (en) Document data storage method and apparatus in document base system
US7487174B2 (en) Method for storing text annotations with associated type information in a structured data store
US8417513B2 (en) Representation of objects and relationships in databases, directories, web services, and applications as sentences as a method to represent context in structured data
KR101114189B1 (en) Label system-translation of text and multi-language support at runtime and design
JP2003518664A (en) Method and system for constructing a personalized result set
KR101573561B1 (en) Method for mapping an x500 data model onto a relational database
JP2018067279A (en) Device, program, and method for recognizing data property
CN102110102A (en) Data processing method and device, and file identifying method and tool
CN116011400A (en) Automatic generation method and device for project standard test document
US9600597B2 (en) Processing structured documents stored in a database
US20110252313A1 (en) Document information selection method and computer program product
US20140095527A1 (en) Expanding high level queries
US9207917B2 (en) Application generator for data transformation applications
CN111125216B (en) Method and device for importing data into Phoenix
KR100659370B1 (en) Method for constructing a document database and method for searching information by matching thesaurus
Bouyukliev et al. Development of a personal bibliographic information system
JP4034503B2 (en) Document search system and document search method
CN118069587A (en) Three-dimensional model management method, device, equipment and storage medium
US7627553B1 (en) Custom queries for segmentation
JP2000339333A (en) System and method for supporting natural language retrieval

Legal Events

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

Address after: No. 189, Fanyang West Road, Zhuozhou City, Baoding City, Hebei Province 072750

Applicant after: BGP INC., CHINA NATIONAL PETROLEUM Corp.

Applicant after: Kunlun Digital Technology Co.,Ltd.

Address before: No. 189, Fanyang West Road, Zhuozhou City, Baoding City, Hebei Province 072750

Applicant before: BGP INC., CHINA NATIONAL PETROLEUM Corp.

Applicant before: RICHFIT INFORMATION TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
TA01 Transfer of patent application right

Effective date of registration: 20220323

Address after: Room 1501, Gehua building, No.1 Qinglong Hutong, Dongcheng District, Beijing

Applicant after: Kunlun Digital Technology Co.,Ltd.

Applicant after: CHINA NATIONAL PETROLEUM Corp.

Address before: No. 189, Fanyang West Road, Zhuozhou City, Baoding City, Hebei Province 072750

Applicant before: BGP INC., CHINA NATIONAL PETROLEUM Corp.

Applicant before: Kunlun Digital Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant