Automatic document generation method and system

文档序号:1953418 发布日期:2021-12-10 浏览:15次 中文

阅读说明:本技术 一种文档自动化生成方法和系统 (Automatic document generation method and system ) 是由 王宇翔 杨懿 赵凯 丁守兵 汪梦杰 田伟 于 2021-11-10 设计创作,主要内容包括:本发明提供了一种文档自动化生成方法和系统,涉及数据处理的技术领域,包括:获取样本文档模板,并对样本文档模板中的内容进行分类,并对为分类添加动态标识数据,得到适配文件,其中,分类的类型包括:段落,表格和可视化图例;提取适配文件中的目标文件,其中,目标文件包括:第一目标文件和第二目标文件,其中,第一目标为文件为包含段落和/或表格的文件,第二目标文件为包含可视化图例的id的文件;对目标文件中的动态标识数据进行动态转置,得到目标适配文件;在获取到用户发送的需求文件之后,确定出需求文件对应的目标适配文件,并基于目标适配文件构建目标文档,解决了现有的文档自动化生成的方法和系统的开发成本较高的技术问题。(The invention provides a method and a system for automatically generating a document, which relate to the technical field of data processing and comprise the following steps: obtaining a sample document template, classifying contents in the sample document template, adding dynamic identification data for classification, and obtaining an adaptation file, wherein the classification type comprises: paragraphs, tables and visual legends; extracting an object file in the adaptation file, wherein the object file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing paragraphs and/or tables, and the second target file is a file containing id of a visual legend; dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file; after the demand file sent by the user is obtained, the target adaptation file corresponding to the demand file is determined, and the target document is constructed based on the target adaptation file, so that the technical problem that the existing document automatic generation method and system are high in development cost is solved.)

1. An automatic document generation method is characterized by comprising the following steps:

obtaining a sample document template, classifying contents in the sample document template, and adding dynamic identification data to the classification to obtain an adaptation file, wherein the classification type comprises: paragraphs, tables and visual legends;

extracting a target file in the adaptation file, wherein the target file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend;

dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file;

after a demand file sent by a user is obtained, a target adaptation file corresponding to the demand file is determined, and a target document is constructed based on the target adaptation file.

2. The method of claim 1, wherein extracting the target file from the adaptation files comprises:

modifying the format of the adaptation file into a compressed file format to obtain a target adaptation file;

and extracting the target file from the target adaptation file.

3. The method of claim 1, wherein dynamically transposing the dynamic identification data in the target file based on the adaptation file to obtain a target adaptation file comprises:

dynamically transposing the dynamic identification data in the target file to obtain a transposed identification;

and obtaining the target adaptation file based on the transposition identifier.

4. The method according to claim 1, wherein after acquiring a demand file sent by a user, determining a target adaptation file corresponding to the demand file, and constructing a target document based on the target adaptation file comprises:

after a demand file sent by a user is obtained, determining a transposition identifier corresponding to the demand file;

simulating based on the transposition identifier corresponding to the demand file to obtain a simulation file;

converting the demand file into an sql file, and determining a target adaptation file corresponding to the demand file based on the sql file;

and constructing the target document by using the simulation file and the target adaptation file corresponding to the demand file.

5. An automated document generation system, comprising: a document processing module, a plurality of configuration modules and a business service module, wherein,

the document processing module is configured to obtain a sample document template, classify content in the sample document template, and add dynamic identification data to the classification to obtain an adaptation file, where the classification type includes: paragraphs, tables and visual legends;

the document processing module is configured to extract a target file in the adaptation file, where the target file includes: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend;

the configuration modules are used for dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file;

the business service module is used for determining a target adaptation file corresponding to a demand file after the demand file sent by a user is obtained, and constructing a target document based on the target adaptation file.

6. The system of claim 5, wherein the document processing module comprises: a file derivation unit and a dynamic transposition unit, wherein,

the file derivation unit is used for acquiring a sample document template, classifying the contents in the sample document template, adding dynamic identification data for classification, modifying the format of the adaptation file into a compressed file format, obtaining a target adaptation file, and extracting the target file from the target adaptation file;

the dynamic transposition unit is used for dynamically transposing the dynamic identification data in the target file to obtain a transposition identification; and obtaining the target adaptation file based on the transposition identifier.

7. The system of claim 6, wherein the business service module comprises: a virtual buried point module, a data simulation module and a data quantization module, wherein,

the data simulation module is used for determining a transposition identifier corresponding to a demand file after the demand file sent by a user is obtained; simulating based on the transposition identifier corresponding to the demand file to obtain a simulation file;

the data quantization module is used for converting the demand file into an sql file and determining a target adaptation file corresponding to the demand file based on the sql file;

and the virtual buried point module is used for constructing the target document by utilizing the simulation file and the target adaptation file corresponding to the demand file.

8. The system of claim 7, further comprising:

and the carrier module is used for inquiring the target adaptation file corresponding to the demand file according to the sql file and sending the target adaptation file corresponding to the demand file to the virtual buried point module.

9. The system of claim 5, further comprising:

the visual assembly module is used for adapting a visual legend corresponding to the demand file when the demand file is a file containing visual legend demand, and mapping the adapted visual legend to the target document;

and the product output module is used for analyzing the target document in the compressed format sent by the plurality of configuration modules and sending the analyzed target document to the user.

10. The system of claim 5,

the configuration modules are also used for converting the target document into texts in other formats.

Technical Field

The invention relates to the technical field of data processing, in particular to a method and a system for automatically generating a document.

Background

Currently, the common normalization of many companies or leaders requires the reporting summary of some work and is presented in word document written form or electronic file. The template styles of the documents are complex, the content is large, the template styles are frequently changed, the development is undoubtedly a tedious problem, a large amount of time is spent on compiling the template styles and configuring the templates, the cost for configuring the templates in the whole process is the highest, almost three fifths of the whole development process, placeholders for configuring data in the template configuration process are prone to errors, and the cost is also consumed for writing some complex form styles in the other process.

No effective solution has been proposed to the above problems.

Disclosure of Invention

In view of the above, the present invention provides a method and a system for automatically generating a document, so as to alleviate the technical problem of high development cost of the existing method and system for automatically generating a document.

In a first aspect, an embodiment of the present invention provides an automatic document generation method, which obtains a sample document template, classifies contents in the sample document template, and adds dynamic identification data to the classification to obtain an adaptation file, where the classification type includes: paragraphs, tables and visual legends; extracting a target file in the adaptation file, wherein the target file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend; dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file; after a demand file sent by a user is obtained, a target adaptation file corresponding to the demand file is determined, and a target document is constructed based on the target adaptation file.

Further, extracting the target file in the adaptation file includes: modifying the format of the adaptation file into a compressed file format to obtain a target adaptation file; and extracting the target file from the target adaptation file.

Further, based on the adaptation file, dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file, including: dynamically transposing the dynamic identification data in the target file to obtain a transposed identification; and obtaining the target adaptation file based on the transposition identifier.

Further, after a demand file sent by a user is obtained, a target adaptation file corresponding to the demand file is determined, and a target document is constructed based on the target adaptation file, including: after a demand file sent by a user is obtained, determining a transposition identifier corresponding to the demand file; simulating based on the transposition identifier corresponding to the demand file to obtain a simulation file; converting the demand file into an sql file, and determining a target adaptation file corresponding to the demand file based on the sql file; and constructing the target document by using the simulation file and the target adaptation file corresponding to the demand file.

In an embodiment of the present invention, there is also provided a document automatic generation system, including: the system comprises a document processing module, a plurality of configuration modules and a business service module, wherein the document processing module is used for obtaining a sample document template, classifying the content in the sample document template, and adding dynamic identification data for the classification to obtain an adaptive file, wherein the classification type comprises: paragraphs, tables and visual legends; the document processing module is configured to extract a target file in the adaptation file, where the target file includes: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend; the configuration modules are used for dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file; the business service module is used for determining a target adaptation file corresponding to a demand file after the demand file sent by a user is obtained, and constructing a target document based on the target adaptation file.

Further, the document processing module includes: the file derivation unit is used for obtaining a sample document template, classifying the contents in the sample document template, adding dynamic identification data for the classification, modifying the format of the adaptation file into a compressed file format, obtaining a target adaptation file, and extracting the target file from the target adaptation file; the dynamic transposition unit is used for dynamically transposing the dynamic identification data in the target file to obtain a transposition identification; and obtaining the target adaptation file based on the transposition identifier.

Further, the business service module includes: the device comprises a virtual buried point module, a data simulation module and a data quantization module, wherein the data simulation module is used for determining a transposition identifier corresponding to a demand file after the demand file sent by a user is obtained; simulating based on the transposition identifier corresponding to the demand file to obtain a simulation file; the data quantization module is used for converting the demand file into an sql file and determining a target adaptation file corresponding to the demand file based on the sql file; and the virtual buried point module is used for constructing the target document by utilizing the simulation file and the target adaptation file corresponding to the demand file.

Further, the system further comprises: and the carrier module is used for inquiring the target adaptation file corresponding to the demand file according to the sql file and sending the target adaptation file corresponding to the demand file to the virtual buried point module.

Further, the system further comprises: the visual assembly module is used for adapting a visual legend corresponding to the demand file when the demand file is a file containing visual legend demand, and mapping the adapted visual legend to the target document; and the product output module is used for analyzing the target document in the compressed format sent by the plurality of configuration modules and sending the analyzed target document to the user.

Furthermore, the configuration modules are also used for converting the target document into texts in other formats.

In the embodiment of the present invention, an adaptation file is obtained by obtaining a sample document template, classifying contents in the sample document template, and adding dynamic identification data to the classification, wherein the classification type includes: paragraphs, tables and visual legends; extracting a target file in the adaptation file, wherein the target file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend; dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file; after a demand file sent by a user is obtained, a target adaptation file corresponding to the demand file is determined, a target document is constructed based on the target adaptation file, the purpose of gradually and efficiently generating the document is achieved, the technical problem that the existing document automatic generation method and system are high in development cost is solved, and therefore the technical effect of reducing research and development cost is achieved.

Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.

FIG. 1 is a schematic diagram of an automated document generation system according to an embodiment of the present invention;

fig. 2 is a flowchart of a method for automatically generating a document according to an embodiment of the present invention.

Detailed Description

To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

In the prior art, because the generation of a word needs to manually configure a large number of template files and complicated coding work, the automation of the word document has a great technical defect, but the provision of report services for enterprises and leaders is an indispensable part. According to the current statistics, there are 6 ways to realize the automatic generation of word, but none of the ways can completely solve the work of configuring a large number of template documents and compiling complex table styles, and can not only focus on the work of business level. The following are advantages and disadvantages of each of the 6 modes:

jacob is an abbreviation for Java-COM Bridge, which is described inA bridge is constructed between Java and Microsoft COM components. The calling of the COM interface of Microsoft Office on a Java platform is realized through the Jacob.

The advantages are that: calling a COM (component object model) interface of Microsoft office to generate a word file format specification;

the disadvantages are as follows: the server can only be a windows platform, and does not support unix and linux, and office software must be installed on the server, so that the problem of cross-platform cannot be met.

Apache POI includes a series of APIs that can operate various Format files based on MicroSoft OLE 2 Compound Document Format, through which Excel, Word, etc. files can be read and written in Java.

The advantages are that: windows, unix and linux can be supported in a cross-platform manner;

the disadvantages are as follows: compared with the processing of word files, POI is more suitable for excel processing, some simple file operations can be realized for the word, patterns cannot be set, and the format of the generated word file is not standard enough, so that the table pattern with complex operation cannot be met.

Java2Word is another component (class library) that calls MS Office Word documents in a Java program, which provides a simple set of interfaces for the Java program to call its services to manipulate the Word documents. The services include: opening a document, creating a document, finding text, replacing text, inserting a visual legend, inserting a table, inserting text at a bookmark, inserting a visual legend, inserting a table, and the like. The technology has the advantages that: is simple enough and much simpler to operate than Freemarker;

the disadvantages are as follows: the method is not strong in Freemarker, cannot generate a word document according to a template, and cannot well operate style information of the word document, so that the principle of simplicity and easiness in use cannot be met.

The functionality of FreeMarker to generate word documents is implemented by XML + FreeMarker. The method comprises the steps of firstly storing a word file as xml, inserting a special character string placeholder into the xml file, translating the xml into a Freemarker template, finally analyzing the Freemarker template by java, and calling the Freemarker by coding to realize text replacement and output doc.

The advantages are that: the function of the programming method is stronger than that of java2word, and the programming method is also pure java programming;

the disadvantages are as follows: the generated file is essentially xml, is not a real word file format, and there are many common word formats which cannot be processed or are strange, such as: hyperlink, line feed, messy codes, partial generated files cannot be opened and the like, and the generated reading document has large memory occupation and complicated template configuration, so that the problems that partial documents cannot be opened and the memory occupation is large cannot be met.

The FreeMarker modified version generates the word document by xml + FreeMarker in zip. The method comprises the steps of firstly changing a suffix name docx of a template file into zip, then extracting document.xml.rels in a zip compressed file and document.xml.rels under a _ rels folder, inserting a special placeholder into the document.xml, filling configuration information of a visual legend into the document.xml.rels, writing the filled document.xml.and document.xml.rels into the zip in a streaming mode, and outputting the docx.

The advantages are that: the problems that the format of the real word file is not the format, the document is opened abnormally and the document occupies a large memory are solved;

the disadvantages are as follows: the complicated template configuration cannot be solved.

PageOffice, which encapsulates Microsoft Office cumbersome, generates word filesThe vba interface provides a simple and easy-to-use java programming object, supports generation of a word file, simultaneously realizes online editing of a word file and reading of the content of the word file, and currently, the PageOffice supports java, php and c # (. net) languages.

The advantages are that: the cross-platform support of windows, unix and linux, the generation of word file format standard, the support of various format operations such as text, visual legend, table, font, paragraph, color, hyperlink and header, the support of multi-word combination, no need of concurrent processing, no consumption of server resources and stable operation;

the disadvantages are as follows: files must be generated at the client (an interface may not be displayed), and the files cannot be generated at the server. Therefore, the problem of java pure backend and the problem of only paying attention to the service and not paying attention to the generated document can not be realized.

From the above, it is very necessary to design an automated word document generation tool which is cross-platform, multi-style, multi-data source, low in storage occupation ratio, simple in structural configuration and service-based.

Accordingly, the following examples are presented in this application.

The first embodiment is as follows:

according to an embodiment of the present invention, there is provided an embodiment of a document automatic generation system, and fig. 1 is a schematic diagram of a document automatic generation system according to an embodiment of the present invention, as shown in fig. 1, the system includes: a document processing module 10, several configuration modules 20 and a business service module 30.

The document processing module 10 is configured to obtain a sample document template, classify content in the sample document template, and add dynamic identification data to the classification to obtain an adaptation file, where the classification type includes: paragraphs, tables and visual legends;

the document processing module 10 is configured to extract a target file in the adaptation file, where the target file includes: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend;

the configuration modules 20 are configured to perform dynamic transposition on the dynamic identification data in the target file to obtain a target adaptation file;

the business service module 30 is configured to determine a target adaptation file corresponding to a demand file after acquiring the demand file sent by a user, and construct a target document based on the target adaptation file.

It should be noted that several configuration modules can selectively convert the word document into other types of text formats, including html, pdf, ppt, etc.

In the embodiment of the present invention, an adaptation file is obtained by obtaining a sample document template, classifying contents in the sample document template, and adding dynamic identification data to the classification, wherein the classification type includes: paragraphs, tables and visual legends; extracting a target file in the adaptation file, wherein the target file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend; dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file; after a demand file sent by a user is obtained, a target adaptation file corresponding to the demand file is determined, a target document is constructed based on the target adaptation file, the purpose of gradually and efficiently generating the document is achieved, the technical problem that the existing document automatic generation method and system are high in development cost is solved, and therefore the technical effect of reducing research and development cost is achieved.

In an embodiment of the present invention, the document processing module includes: a file derivation unit and a dynamic transposition unit.

The file derivation unit is used for acquiring a sample document template, classifying the contents in the sample document template, adding dynamic identification data for classification, modifying the format of the adaptation file into a compressed file format, obtaining a target adaptation file, and extracting the target file from the target adaptation file;

the dynamic transposition unit is used for dynamically transposing the dynamic identification data in the target file to obtain a transposition identification; and obtaining the target adaptation file based on the transposition identifier.

In the embodiment of the invention, different types of modules in a sample document template are adapted to a plurality of module services according to unique type identifiers, if the sample document template is a form, the identifiers of rows and columns in an original form are respectively adapted to fields corresponding to the rows and columns of the plurality of modules, and the sequence of the original form is determined; if the paragraph characters are the paragraph characters, the position of the dynamic data in the sample document template needs to be manually adapted; in the case of a visualization legend, the identification of the visualization legend service needs to be adapted in the field of the visualization legend. And then executing a file derivation module, extracting the data adaptation file and the visual legend adaptable file in the docx file suffix document from the compressed file, and if the data adaptation file and the visual legend adaptable file are not executed for the first time, executing the data adaptation file and the visual legend adaptable file subsequently.

After the adaptive file in the file derivation unit is extracted, the adaptive file of the whole data is formatted, and the data is arranged according to the form of rows. Transpose according to dynamic identification after formatting by an adaptation pair in several stations. If not, subsequent iterations are not required.

In this embodiment of the present invention, the service module includes: the device comprises a virtual buried point module, a data simulation module and a data quantization module.

The data simulation module is used for determining a transposition identifier corresponding to a demand file after the demand file sent by a user is obtained; simulating based on the transposition identifier corresponding to the demand file to obtain a simulation file;

the data quantization module is used for converting the demand file into an sql file and determining a target adaptation file corresponding to the demand file based on the sql file;

and the virtual buried point module is used for constructing the target document by utilizing the simulation file and the target adaptation file corresponding to the demand file.

In the embodiment of the invention, a data simulation unit acquires adaptive data from a plurality of data and adds default data; the virtual embedded point unit extracts data from the carrier unit through the data quantization unit, and associates and maps the extracted real data and default data in the data simulation unit;

the data quantization unit quantizes the query sql into a query condition corresponding to the data source component according to the service requirement, loads the data source, and returns the result to the virtual buried point unit for subsequent data processing.

In an embodiment of the present invention, the system further includes:

and the carrier module is used for inquiring the target adaptation file corresponding to the demand file according to the sql file and sending the target adaptation file corresponding to the demand file to the virtual buried point module.

In the embodiment of the invention, the carrier unit is mainly a data source and comprises a relational database, a non-relational database, a local file, a remote file, an excel, a csv and the like, and service query support is provided according to service requirements in the data quantization unit.

In an embodiment of the present invention, the system further includes:

the visual assembly module is used for adapting a visual legend corresponding to the demand file when the demand file is a file containing visual legend demand, and mapping the adapted visual legend to the target document;

and the product output module is used for analyzing the target document in the compressed format sent by the plurality of configuration modules and sending the analyzed target document to the user.

In the embodiment of the invention, the visualization assembly module is mainly used for carrying out adaptation on the document visualization legend in a plurality of tables, and the visualization legend is directly mapped to the visualization style of the target document after the adaptation.

In the visualization diffraction module, an echarts component in the front end is quoted to realize the rendering effect of visualization data, whether visualization assembly is needed in a document or not and the visualization diffraction module can be directly adapted in a plurality of tables.

After the data preparation is finished, the Freemarker analyzes the matched configuration file, and the analysis can load the original data file of the document, the dynamic data and the matched file of the visual legend together.

And after the analysis is finished, loading the dynamic data and the visual data into a zip stream, and outputting the target document in a product output module.

The above system is explained in detail below:

firstly, a docx document template needs to be provided, secondly, the content in the document is combed, and after no abnormity occurs, paragraphs, tables and visual content in the document are classified. If the paragraph is a paragraph, the $ { + unique identifier } transpose needs to be manually used for a dynamic data part in the paragraph, because the paragraph cannot determine the exact position of a value, a field of the identifier cannot begin with a number, if the paragraph is an identifier position with multiple characters connected in series, the identifier field is preferably compiled in advance through a notebook and then copied to a corresponding position, if the paragraph is directly edited in a document, xml may disassemble the unique identifier, and a system cannot identify a keyword; if the form is a form, row and column values in the form need to be respectively filled into a plurality of fields according to a natural sequence, if a plurality of forms are distinguished by a plurality of categories, each form needs to be adapted by another new row, and each form is ensured not to be interfered with each other; in the case of the visualization part, the unique identifier of the visualization needs to be adapted in several stations to distinguish each different visualization legend. If the documents are the same, paragraphs, tables and visual project numbers are required to be matched and consistent, and data consistency is ensured.

After the adaptation of the document in the plurality of stations is completed, the data and the visual configuration file in the document need to be derived and extracted through a file derivation module. Since the essence of the docx file is a zip file, the suffix of the docx is corrected to a zip format and is opened by compression software, and a document.xml is a data file in the word folder, and paragraph and table data in the document are stored in the area where the visualization data is not stored, and only the visualization data is stored in the area where the visualization data is not storedAnd searching a document.xml.rels file in an id-to- _ rels folder by the id of the data, wherein the document stores the same id as the document.xml, and a relative path pointing to a visualization sample in a visualization legend path of the document, wherein the specific path is media/+ visualization sample name, so that a mapping relation is formed between two adaptation files, and the two adaptation files and the original docx file are extracted and assigned to the project.

After the adaptive file is extracted, the dynamic data needs to be processed through a dynamic transposition module, and dynamic transposition needs to be performed on the dynamic identification data in the document. The document.xml file is also required to be formatted before transposition, and if the document is a paragraph, the unique identifier is already defined and does not need to be considered; if the table is a table, the table determines the unique cell according to the combination of the rows and the columns, the adaptation directory of the table in the digital table needs to be read, the unique key is constructed according to the combination of the rows and the columns read in the adaptation environment and the identification of the table, and if the table is a formatted data adaptation file, each row in the table has only the unique cell, so that the transposition is not abnormal; rels file with a "broken" on the adapted file if it is a visual document>The identifier of the character is cut, the visual initialization id is 6, and the number of the identifiers is sequentially increased and only the unique identifiers in a plurality of numbers are used for transposition. If the dynamic data text description exists in the table, the unique identification of the data needs to be inAnd performing medium adaptation, and covering the previous adapted file after the transposition is completed.

Before executing the data quantization module, the data simulation module extracts the row and column keys of the document table from the plurality of tables and assembles a default identifier, the default identifier and the default identifierAnd after the identification of the middle transposition is kept consistent, the inquired data is converted into an sql mode according to the service requirement, then the information of the required database is adapted in an adaptation file, the system quantizes the executed sql information into specific data source inquiry information, and returns the quantization result to the virtual buried point module.

According to whether business requirements need visual support, if so, assembling visual corresponding id patterns in the plurality of tables, and calling a visual diffraction module to diffract dynamic visual dynamic data into a real visual example;

combining a data simulation module in a core service module with real data in a virtual buried point module, mapping the simulation data and the real data, and generating a dynamic data set in a key-value mode;

after a data set is generated, a file analysis module is called, data adaptation and visual adaptation files are analyzed through a Freemarker, and the latest dynamic data are loaded into a template file;

after the analysis is completed, the paragraph, the table and the visual file are respectively loaded into the compressed file stream through a terminal output module, and a docx document is generated;

if the business needs other types of files, the file derivation module can be called, and the derivation needing can be configured in the plurality of stationsOther types of files, i.e., docx files, may be converted to the desired file format.

Example two:

an embodiment of the present invention further provides a method for automatically generating a document, as shown in fig. 2, where fig. 2 is a flowchart of the method for automatically generating a document, and the method for automatically generating a document includes:

step S102, obtaining a sample document template, classifying the content in the sample document template, and adding dynamic identification data for the classification to obtain an adaptation file, wherein the classification type comprises: paragraphs, tables and visual legends;

step S104, extracting a target file in the adaptation file, wherein the target file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend;

step S106, dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file;

step S108, after the demand file sent by the user is obtained, a target adaptation file corresponding to the demand file is determined, and a target document is constructed based on the target adaptation file.

In the embodiment of the present invention, an adaptation file is obtained by obtaining a sample document template, classifying contents in the sample document template, and adding dynamic identification data to the classification, wherein the classification type includes: paragraphs, tables and visual legends; extracting a target file in the adaptation file, wherein the target file comprises: the system comprises a first target file and a second target file, wherein the first target file is a file containing the paragraph and/or the table, and the second target file is a file containing the id of the visualization legend; dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file; after a demand file sent by a user is obtained, a target adaptation file corresponding to the demand file is determined, a target document is constructed based on the target adaptation file, the purpose of gradually and efficiently generating the document is achieved, the technical problem that the existing document automatic generation method and system are high in development cost is solved, and therefore the technical effect of reducing research and development cost is achieved.

Preferably, extracting the target file in the adaptation file includes: modifying the format of the adaptation file into a compressed file format to obtain a target adaptation file; and extracting the target file from the target adaptation file.

Preferably, based on the adaptation file, dynamically transposing the dynamic identification data in the target file to obtain a target adaptation file, including: dynamically transposing the dynamic identification data in the target file to obtain a transposed identification; and obtaining the target adaptation file based on the transposition identifier.

Preferably, after the demand file sent by the user is obtained, determining a target adaptation file corresponding to the demand file, and constructing a target document based on the target adaptation file includes: after a demand file sent by a user is obtained, determining a transposition identifier corresponding to the demand file; simulating based on the transposition identifier corresponding to the demand file to obtain a simulation file; converting the demand file into an sql file, and determining a target adaptation file corresponding to the demand file based on the sql file; and constructing the target document by using the simulation file and the target adaptation file corresponding to the demand file.

In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.

In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.

In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.

Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:相似文本的推荐方法、装置和电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!