CN113011151A - Method, device and equipment for generating requirement document template and storage medium - Google Patents

Method, device and equipment for generating requirement document template and storage medium Download PDF

Info

Publication number
CN113011151A
CN113011151A CN202110425548.0A CN202110425548A CN113011151A CN 113011151 A CN113011151 A CN 113011151A CN 202110425548 A CN202110425548 A CN 202110425548A CN 113011151 A CN113011151 A CN 113011151A
Authority
CN
China
Prior art keywords
template
document template
replaced
content
processed
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.)
Granted
Application number
CN202110425548.0A
Other languages
Chinese (zh)
Other versions
CN113011151B (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110425548.0A priority Critical patent/CN113011151B/en
Publication of CN113011151A publication Critical patent/CN113011151A/en
Application granted granted Critical
Publication of CN113011151B publication Critical patent/CN113011151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/10Requirements analysis; Specification techniques

Landscapes

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

Abstract

The application relates to the technical field of artificial intelligence, and discloses a method, a device, equipment and a storage medium for generating a demand document template, wherein the method comprises the following steps: obtaining a required document template to be processed according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the required document template configuration file based on a rolling type template technology; replacing a content control with a non-Word built-in content control as an object type in a to-be-processed demand document template according to a demand document template configuration file based on a Docxtpl technology in combination with a Jinja2 technology to obtain a demand document template with the replaced non-built-in control; and replacing the content control with the built-in content control of the Word in the object type in the requirement document template of the replaced non-built-in control according to the requirement document template configuration file based on the Win32com technology to obtain the target requirement document template. The automatic generation of the required document template is realized, and the working efficiency is improved.

Description

Method, device and equipment for generating requirement document template and storage medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a demand document template.
Background
In the whole software development process and process management, the quality of the requirement document protects and restricts the quality of subsequent development and testing. When a requirement document template is constructed in a writing mode, historical requirement documents are manually removed and cleaned to serve as the template, and dirty data are easily left and typesetting errors are easily caused by manual removal.
Disclosure of Invention
The application mainly aims to provide a method, a device, equipment and a storage medium for generating a demand document template, and aims to solve the technical problems that in the prior art, when the demand document template is written and constructed, dirty data is easily left and typesetting is easily made mistakes due to manual removal and cleaning of historical demand documents as templates.
In order to achieve the above object, the present application provides a method for generating a requirement document template, where the method includes:
acquiring a request for generating a required document template, wherein the request for generating the required document template carries a configuration file of the required document template;
responding to the request for generating the required document template, and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library;
based on a rolling type template technology, performing framework construction of a demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file to obtain a demand document template to be processed;
based on the Docxtpl technology and the Jinja2 technology, according to the content data to be replaced of the configuration file of the demand document template, performing content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed to obtain a demand document template with the non-built-in control replaced;
and performing content replacement on the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain a target requirement document template.
Further, the step of performing framework building of the demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file based on the rolling template technology to obtain the demand document template to be processed includes:
reading a line of data from the document structure configuration data of the required document template configuration file by a head-to-tail traversal method to obtain line configuration data to be processed;
when the row configuration data to be processed is a required name, obtaining a document replacer name list, searching the row configuration data to be processed in the document replacer name list to obtain a required name searching result, when the required name searching result is successful, determining a current document replacer according to a document replacer corresponding to the required name searching result, otherwise, constructing a document replacer according to the row configuration data to be processed to obtain a document replacer to be processed, obtaining a first-level sub-template from the first-level sub-template library to obtain a first-level sub-template to be added, adding the first-level sub-template to be added into the document replacer to be processed, and taking the document replacer to be processed as the current document replacer;
when the row configuration data to be processed is the name of a user story, acquiring the current document replacer, acquiring a second-level sub-template from the second-level sub-template library to obtain a second-level sub-template to be added, and adding the second-level sub-template to be added to the current document replacer;
when the row configuration data to be processed is the name of the associated subsystem, acquiring the current document replacer, acquiring a third-level sub-template from the third-level sub-template library according to the row configuration data to be processed to obtain a third-level sub-template set to be added, and adding the third-level sub-template set to be added to the current document replacer;
repeatedly executing the step of reading a line of data from the document structure configuration data of the required document template configuration file by adopting the head-to-tail traversal method to obtain the line configuration data to be processed until the traversal of the document structure configuration data in the required document template configuration file is completed;
and obtaining the required document template to be processed according to the current document replacer.
Further, the step of performing content replacement on the content control with the object type of the non-Word built-in content control in the to-be-processed requirement document template according to the to-be-replaced content data of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology to obtain the requirement document template with the non-built-in control replaced includes:
based on the Docxtpl technology, adopting a head-to-tail traversal method to extract a content control with an object type of a non-Word built-in content control from the required document template to be processed as a first content control to be replaced;
performing content replacement on the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on a Docxtpl technology in combination with a Jinja2 technology;
repeatedly executing the Docxtpl-based technology, adopting a head-to-tail traversal method, extracting a content control with an object type of a non-Word built-in content control from the to-be-processed required document template, and taking the content control as a first to-be-replaced content control until the traversal of the to-be-processed required document template is completed;
and determining the requirement document template of the replaced non-built-in control according to the traversed requirement document template to be processed.
Further, the step of extracting a content control with an object type of a non-Word built-in content control from the to-be-processed demand document template as a first to-be-replaced content control by using a head-to-tail traversal method based on the Docxtpl technology includes:
acquiring the to-be-processed requirement document template by a Docxtemplate method of the Docxxtpl technology;
generating a Docxtpl container according to the to-be-processed requirement document template to obtain the to-be-processed Docxtpl container;
extracting a content control with an object type of a non-Word built-in content control from the to-be-processed required document template by adopting a head-to-tail traversal method, taking the content control as a first to-be-replaced content control, and storing the first to-be-replaced content control in the to-be-processed Docxtpl container;
the step of replacing the content of the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology includes:
judging whether the first content control to be replaced contains an image or not based on the Docxtpl container to be processed to obtain a classification judgment result;
and performing content replacement on the first content control to be replaced according to the Docxtpl container to be processed, the classification judgment result and the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology and the Jinja2 technology.
Further, the step of replacing the content of the first content control to be replaced according to the classification judgment result and the content data to be replaced of the required document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology includes:
when the classification judgment result is that the image is contained, based on the Docxtpl container to be processed, performing content replacement on the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file by adopting an InlineImage method of the Docxtpl technology;
and when the classification judgment result is that no image is contained, based on the Docxtpl container to be processed, performing content replacement on the first content control to be replaced by adopting the Jinja2 grammar according to the content data to be replaced of the requirement document template configuration file.
Further, the step of performing content replacement on the content control with the object type of Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain the target requirement document template includes:
generating a Win32com container according to the requirement document template replacing the non-built-in control to obtain a Win32com container to be processed;
based on a Win32com technology, a content control with an object type of Word built-in content control is obtained from the requirement document template of the replaced non-built-in control by a head-to-tail traversal method, a second content control to be replaced is obtained, and the second content control to be replaced is stored in the Win32com container to be processed;
performing content replacement on the second content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Win32com container to be processed;
repeatedly executing the Win32 com-based technology, acquiring a content control with an object type of a Word built-in content control from the replaced non-built-in control required document template by a head-to-tail traversal method, obtaining a second content control to be replaced, and storing the second content control to be replaced in the Win32com container to be processed until the traversal of the replaced non-built-in control required document template is completed;
and determining the target demand document template according to the traversed demand document template of the replaced non-built-in control.
Further, the step of performing content replacement on the second content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Win32com container to be processed includes:
and acquiring a Word built-in content control set based on the Win32com container to be processed, and performing content replacement on the second content control to be replaced according to the Word built-in content control set and the content data to be replaced of the requirement document template configuration file.
The present application further provides a device for generating a requirement document template, the device including:
the request acquisition module is used for acquiring a request for generating a required document template, wherein the request for generating the required document template carries a required document template configuration file;
the template library acquisition module is used for responding to the requirement document template generation request and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library;
the requirement document template framework building module is used for building a framework of a requirement document template according to the first-level sub template library, the second-level sub template library, the third-level sub template library and the requirement document template configuration file based on a rolling template technology to obtain a requirement document template to be processed;
a content replacement module of the non-Word built-in content control, configured to replace, based on a Docxtpl technology in combination with a Jinja2 technology, the content of the content control with the object type of the non-Word built-in content control in the to-be-processed demand document template according to the to-be-replaced content data of the demand document template configuration file, so as to obtain a demand document template in which the non-built-in control has been replaced;
and the Word built-in content control content replacing module is used for replacing the content of the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain the target requirement document template.
The present application further proposes a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of any of the above methods when executing the computer program.
The present application also proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of any of the above.
The method, the device, the equipment and the storage medium for generating the demand document template are characterized in that firstly, based on a rolling template technology, frame construction of the demand document template is carried out according to a first-level sub-template library, a second-level sub-template library, a third-level sub-template library and a demand document template configuration file to obtain the demand document template to be processed, then based on Docxtpl technology and Jinja2 technology, according to content data to be replaced of the demand document template configuration file, content replacement is carried out on a content control with an object type of a non-Word built-in content control in the demand document template to be processed to obtain the demand document template with the non-built-in control replaced, finally based on Win32com technology, according to the content data to be replaced of the demand document template configuration file, content replacement is carried out on the content control with the object type of the Word built-in content control in the demand document template with the non-built-in control replaced, the target requirement document template is obtained, so that the automatic generation of the requirement document template is realized, the technical problems that dirty data are easily left and typesetting is easily made mistakes due to the fact that historical requirement documents are manually removed and cleaned to serve as templates are solved, and the working efficiency of a product manager is improved; the content controls of different object types are replaced by different methods, so that the content replacement accuracy of the content controls is improved, the time for modifying the content controls manually in the follow-up process is reduced, and the working efficiency of a product manager is further improved.
Drawings
FIG. 1 is a flowchart illustrating a method for generating a requirement document template according to an embodiment of the present application;
FIG. 2 is a block diagram illustrating a schematic structure of a device for generating a requirement document template according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The objectives, features, and advantages of the present application will be further described with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In order to solve the technical problems that in the prior art, when a requirement document template is constructed by writing, the requirement document of history is manually removed and cleaned to serve as the template, and dirty data are easily left over and typesetting is easily made mistakes due to manual removal, the application provides a generation method of the requirement document template, and the method is applied to the technical field of artificial intelligence. According to the method for generating the demand document template, the framework of the demand document template is built through a configuration file and a sub-template library to obtain the demand document template to be processed, the content of a content control which is not a Word built-in content control in the demand document template to be processed is replaced based on Docxtpl technology combined with Jinja2 technology, the content of a content control which is a Word built-in content control in the demand document template to be processed is replaced based on Win32com technology, and the demand document template to be processed, which completes the content replacement of the content control, is used as a target demand document template, so that the demand document template is automatically generated, the technical problems that dirty data are easily left and mistakes are easily made due to the fact that a historical demand document is manually removed and cleaned to serve as the template are avoided, and the work efficiency of product management is improved; the content controls of different object types are replaced by different methods, so that the content replacement accuracy of the content controls is improved, the time for modifying the content controls manually in the follow-up process is reduced, and the working efficiency of a product manager is further improved.
Referring to fig. 1, an embodiment of the present application provides a method for generating a requirement document template, where the method includes:
s1: acquiring a request for generating a required document template, wherein the request for generating the required document template carries a configuration file of the required document template;
s2: responding to the request for generating the required document template, and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library;
s3: based on a rolling type template technology, performing framework construction of a demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file to obtain a demand document template to be processed;
s4: based on the Docxtpl technology and the Jinja2 technology, according to the content data to be replaced of the configuration file of the demand document template, performing content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed to obtain a demand document template with the non-built-in control replaced;
s5: and performing content replacement on the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain a target requirement document template.
The embodiment firstly carries out framework construction of a demand document template according to a first-level sub-template library, a second-level sub-template library, a third-level sub-template library and a demand document template configuration file based on a rolling template technology to obtain a demand document template to be processed, then carries out content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed according to content data to be replaced of the demand document template configuration file based on Docxtpl technology and Jinja2 technology to obtain the demand document template with the non-Word built-in control replaced, and finally carries out content replacement on the content control with the object type of the Word built-in content control in the demand document template with the non-built-in control replaced according to the content data to be replaced of the demand document template configuration file based on Win32com technology to obtain a target demand document template, thereby realizing automatic generation of the demand document template, the technical problems that dirty data are easy to leave and typesetting is easy to make mistakes due to the fact that historical demand documents are manually removed and cleaned to serve as templates are solved, and the working efficiency of a product manager is improved; the content controls of different object types are replaced by different methods, so that the content replacement accuracy of the content controls is improved, the time for modifying the content controls manually in the follow-up process is reduced, and the working efficiency of a product manager is further improved.
For S1, the requirement document template generation request input by the user may be acquired, or the requirement document template generation request sent by the third-party application system may also be acquired.
Wherein, an open _ workbook method of Xlrd is adopted to obtain a configuration file of the template of the requirement document. The configuration file of the requirement document template can be obtained from a database, can also be the configuration file of the requirement document template input by a user, and can also be the configuration file of the requirement document template sent by a third-party application system. The format of the requirement document template configuration file can be Excel or csv. Excel, microsoft office Excel, is a form processing program.
Xlrd is an Excel interface of Python, Excel file contents can be conveniently read by using the Xlrd, and the Xlrd is a cross-platform library and can be used on platforms such as windows, linux/unix and the like.
The requirement document template generation request is a request for generating a template of a requirement document used for software development.
A requirements document template configuration file comprising: document structure configuration data and content data to be replaced. The document structure configuration data is the configuration data of a requirement name, a user story name, an associated subsystem name, a release version, who I is, what is needed, what problem is solved, a business flow chart, an interaction chart, a system interaction chart, acceptance conditions and a prototype chart. The content data to be replaced comprises a non-Word built-in content control and a Word built-in content control. non-Word built-in content controls include, but are not limited to: image controls, text controls. Word built-in content controls include text class controls, text classes including but not limited to: company, title, author, date.
Word, i.e., microsoft office Word, is a Word processing program.
For S2, the first level sub-template library, the second level sub-template library, and the third level sub-template library may be obtained from the database, or the first level sub-template library, the second level sub-template library, and the third level sub-template library input by the user, or the first level sub-template library, the second level sub-template library, and the third level sub-template library sent by the third-party application system.
And the first level sub-template library is a sub-template of the starting part of the requirement document. The first level sub-template library includes but is not limited to: requirement document title, date, author, revision record, affiliate list, catalog, document summary.
And the second level sub-template library is a sub-template of the user story text of the requirement document. The second level sub-template library includes but is not limited to: story description, business process, acceptance conditions, UI (interface) interaction, system interaction.
And the third level sub-template library is a sub-template of an association subsystem of the user story text of the requirement document. The third level sub-template library includes but is not limited to: associating subsystem names, prototypes, rules, usage frequency, performance requirements, user communication records, traffic variables.
For step S3, based on the rolling template technology, acquiring sub-templates from the first-level sub-template library, the second-level sub-template library and the third-level sub-template library according to the document structure configuration data of the requirement document template configuration file, generating a frame of the requirement document template according to the acquired sub-templates, and taking the frame of the requirement document template as the requirement document template to be processed. The method is based on a rolling type template technology, namely, document structure configuration data of the required document template configuration file is traversed from beginning to end to obtain data, and sub-templates are obtained from the first-level sub-template library, the second-level sub-template library and the third-level sub-template library according to the obtained data, so that a flexible framework of the required document template is realized.
For S4, extracting a content control with an object type of a non-Word built-in content control from the to-be-processed requirement document template by a traversal method from beginning to end; based on the Docxtpl technology and the Jinja2 technology, performing content replacement on the extracted content control with the object type of non-Word built-in content control according to the content data to be replaced of the requirement document template configuration file; and determining the requirement document template replacing the non-built-in control according to the requirement document template to be processed after the content replacement of the content control of the non-Word built-in content control of all object types is completed.
Docxtpl, a software package, is mainly implemented by loading Docx (File extension of Microsoft Word) document templates to modify them.
Jinja2, a python-based template engine, functions relatively similar to smart of PHP, freemaker and velocity of J2 ee. Jinja2 is fully unicode capable and has an integrated sandbox execution environment.
For S5, adopting a method of traversing from beginning to end to extract the content control with the object type of Word built-in content control from the requirement document template of the replaced non-built-in control; based on Win32com technology, performing content replacement on the content control with the extracted object type being Word built-in content control according to the content data to be replaced of the requirement document template configuration file; and determining the target requirement document template according to the requirement document template of the replaced non-built-in control, which completes the content replacement of the content control of which all object types are the Word built-in content control. That is, the target requirement document template is a requirement document.
Win32com, Python.
It is understood that steps S4 through S5 may be performed synchronously.
In an embodiment, the step of performing framework building of the demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file based on the rolling template technology to obtain the demand document template to be processed includes:
s31: reading a line of data from the document structure configuration data of the required document template configuration file by a head-to-tail traversal method to obtain line configuration data to be processed;
s32: when the row configuration data to be processed is a required name, obtaining a document replacer name list, searching the row configuration data to be processed in the document replacer name list to obtain a required name searching result, when the required name searching result is successful, determining a current document replacer according to a document replacer corresponding to the required name searching result, otherwise, constructing a document replacer according to the row configuration data to be processed to obtain a document replacer to be processed, obtaining a first-level sub-template from the first-level sub-template library to obtain a first-level sub-template to be added, adding the first-level sub-template to be added into the document replacer to be processed, and taking the document replacer to be processed as the current document replacer;
s33: when the row configuration data to be processed is the name of a user story, acquiring the current document replacer, acquiring a second-level sub-template from the second-level sub-template library to obtain a second-level sub-template to be added, and adding the second-level sub-template to be added to the current document replacer;
s34: when the row configuration data to be processed is the name of the associated subsystem, acquiring the current document replacer, acquiring a third-level sub-template from the third-level sub-template library according to the row configuration data to be processed to obtain a third-level sub-template set to be added, and adding the third-level sub-template set to be added to the current document replacer;
s35: repeatedly executing the step of reading a line of data from the document structure configuration data of the required document template configuration file by adopting the head-to-tail traversal method to obtain the line configuration data to be processed until the traversal of the document structure configuration data in the required document template configuration file is completed;
s36: and obtaining the required document template to be processed according to the current document replacer.
According to the method, based on the rolling type template technology, the framework building of the demand document template is carried out according to the first-level sub template library, the second-level sub template library, the third-level sub template library and the demand document template configuration file, so that the framework of the demand document template is built flexibly, and the personalized demand document template requirement is met.
For S31, a method of traversal from beginning to end is adopted, a line of data is read from the document structure configuration data of the required document template configuration file, and the read data is used as the line configuration data to be processed. That is, there is only configuration data of one sub-template per line of data in the document structure configuration data at most.
For S32, a list of document replacer names may be obtained from the database, or a list of document replacer names may be obtained from a third-party application system. Each requirement name in the list of document replacer names corresponds to a document replacer.
Document replacers, i.e., Composer containers. And the Composer container is realized based on docxcompoe, and is used for splicing the sub-templates obtained from the first-level sub-template library, the second-level sub-template library and the third-level sub-template library.
Searching the row configuration data to be processed in the document replacer name list, and when a required name is searched in the document replacer name list, the fact means that a document replacer corresponding to the row configuration data to be processed already exists, so that the required name searching result is determined to be successful; when the required name is not found in the document replacer name list, it means that there is no document replacer corresponding to the row configuration data to be processed, and thus it is determined that the required name search result is a failure.
And when the requirement name searching result is successful, taking the document replacer corresponding to the requirement name searching result as the current document replacer. When the required name searching result is failure, a document replacer is newly built, the text content of the line configuration data to be processed is used as the name of the newly built document replacer, and then the newly built document replacer is used as the document replacer to be processed; acquiring a first-level sub-template from the first-level sub-template library, taking the acquired first-level sub-template as a first-level sub-template to be added, and adding the first-level sub-template to be added to the starting position in the document replacer to be processed; and taking the to-be-processed document replacer added with the to-be-added first-level sub-template as the current document replacer, and adding the name of the to-be-processed document replacer into the document replacer name list.
For S33, when the row configuration data to be processed is the user story name, acquiring a document replacer currently in use as the current document replacer, acquiring a second-level sub-template from the second-level sub-template library, taking the acquired second-level sub-template as the second-level sub-template to be added, and adding the second-level sub-template to be added to the end position in the current document replacer.
For S34, when the row configuration data to be processed is the associated subsystem name, acquiring a document replacer currently used as the current document replacer, acquiring a third-level sub-template from the third-level sub-template library according to the row configuration data to be processed, taking all the acquired third-level sub-templates as a third-level sub-template set to be added, and adding the third-level sub-template set to be added to an end position in the current document replacer.
For S35, steps S31 through S35 are repeatedly executed until the traversal of the document structure configuration data in the required document template configuration file is completed.
And S36, splicing the data in the current document replacer, and taking the spliced document as the to-be-processed required document template.
In an embodiment, the step of performing content replacement on the content control with the object type of the non-Word built-in content control in the to-be-processed requirement document template according to the to-be-replaced content data of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology to obtain the requirement document template with the non-built-in control replaced includes:
s41: based on the Docxtpl technology, adopting a head-to-tail traversal method to extract a content control with an object type of a non-Word built-in content control from the required document template to be processed as a first content control to be replaced;
s42: performing content replacement on the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on a Docxtpl technology in combination with a Jinja2 technology;
s43: repeatedly executing the Docxtpl-based technology, adopting a head-to-tail traversal method, extracting a content control with an object type of a non-Word built-in content control from the to-be-processed required document template, and taking the content control as a first to-be-replaced content control until the traversal of the to-be-processed required document template is completed;
s44: and determining the requirement document template of the replaced non-built-in control according to the traversed requirement document template to be processed.
According to the embodiment, content replacement of the content control with the object type of the non-Word built-in content control is realized based on the Docxtpl technology and the Jinja2 technology, so that manual modification and replacement of the content control with the object type of the non-Word built-in content control are not needed, the time for modifying the content control manually subsequently is shortened, and the work efficiency of a product manager is further improved.
For S41, acquiring the to-be-processed requirement document template by a Docxtemplate method of Docxtpl; based on the Docxtpl technology, a method of traversing from beginning to end is adopted, a content control with an object type of a non-Word built-in content control is extracted from the required document template to be processed, and the extracted content control is used as a first content control to be replaced.
For S42, based on the Docxtpl technique in combination with the Jinja2 technique, the first content control to be replaced is searched from the content data to be replaced of the requirement document template configuration file to obtain first target content data, and the first target content data is used to replace the content of the first content control to be replaced.
And S43, repeating the steps S41 to S43 until the traversal of the requirement document template to be processed is completed, so that the content replacement of the content controls of which all object types are non-Word built-in content controls in the requirement document template to be processed is automatically completed.
And S44, determining the requirement document template of the replaced non-built-in control according to the result of content replacement of the first content control to be replaced and the requirement document template to be processed which is traversed and completes content replacement of the content control of the non-Word built-in content control.
In an embodiment, the step of extracting a content control with an object type of a non-Word built-in content control from the to-be-processed demand document template by a method of traversing from beginning to end based on the Docxtpl technology as a first to-be-replaced content control includes:
s411: acquiring the to-be-processed requirement document template by a Docxtemplate method of the Docxxtpl technology;
s412: generating a Docxtpl container according to the to-be-processed requirement document template to obtain the to-be-processed Docxtpl container;
s413: extracting a content control with an object type of a non-Word built-in content control from the to-be-processed required document template by adopting a head-to-tail traversal method, taking the content control as a first to-be-replaced content control, and storing the first to-be-replaced content control in the to-be-processed Docxtpl container;
the step of replacing the content of the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology includes:
s421: judging whether the first content control to be replaced contains an image or not based on the Docxtpl container to be processed to obtain a classification judgment result;
s422: and performing content replacement on the first content control to be replaced according to the Docxtpl container to be processed, the classification judgment result and the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology and the Jinja2 technology.
According to the embodiment, content replacement of the content control with the object type of the non-Word built-in content control is realized based on the Docxtpl technology and the Jinja2 technology, so that manual modification and replacement of the content control with the object type of the non-Word built-in content control are not needed, the time for modifying the content control manually subsequently is shortened, and the work efficiency of a product manager is further improved.
For S411, the to-be-processed requirement document template is obtained by the Docxtpl method of the Docxtpl technique.
For S412, a Docxtpl container is generated, the identifier of the to-be-processed requirement document template is used as the identifier of the generated Docxtpl container, and the generated Docxtpl container is used as the to-be-processed Docxtpl container.
The Docxtpl containers to be processed are designed in KV. The Docxtpl container to be processed comprises a key and a Value, wherein the key is a Jinja2 placeholder corresponding to the first content control to be replaced, the Jinja2 placeholder corresponding to the first content control to be replaced is a JInja2 placeholder buried in the DocxTemplate template in advance, and the Value is stored in the Value and needs to be replaced by the first content control to be replaced.
For step S413, a method of traversing from beginning to end is adopted, a content control with an object type of a non-Word built-in content control is extracted from the to-be-processed demand document template, and the extracted content control is used as a first to-be-replaced content control; storing the first to-be-replaced content control in the to-be-processed Docxpl container for subsequent content replacement of the first to-be-replaced content control based on the to-be-processed Docxpl container.
For S421, it is determined whether the first content control to be replaced in the to-be-processed Docxtpl container contains an image, and when the first content control to be replaced contains an image, the classification determination result is determined as containing an image, and when the first content control to be replaced does not contain an image, the classification determination result is determined as not containing an image.
For S422, based on the Docxtpl technique in combination with the Jinja2 technique, replacing, by using different methods, the Value corresponding to the first content control to be replaced in the to-be-processed Docxtpl container according to different values of the classification determination result.
Optionally, the step of determining the requirement document template of the replaced non-built-in control according to the traversed requirement document template to be processed includes: and generating a document according to the to-be-processed requirement document template and the to-be-processed Docxtpl container, and taking the generated document as the requirement document template of the replaced non-built-in control. That is to say, the data in the to-be-processed Docxtpl container replaces the content control with the object type of the non-Word built-in content control in the to-be-processed requirement document template, and the to-be-processed requirement document template after replacement is used as the requirement document template of the replaced non-built-in control.
In an embodiment, the step of replacing the content of the first content control to be replaced according to the classification judgment result and the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology includes:
s4241: when the classification judgment result is that the image is contained, based on the Docxtpl container to be processed, performing content replacement on the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file by adopting an InlineImage method of the Docxtpl technology;
s4242: and when the classification judgment result is that no image is contained, based on the Docxtpl container to be processed, performing content replacement on the first content control to be replaced by adopting the Jinja2 grammar according to the content data to be replaced of the requirement document template configuration file.
According to the method, different replacement methods are adopted according to different values of the classification judgment result, so that manual modification and replacement of the content control with the object type of the non-Word built-in content control are not needed, the time for modifying the content control manually subsequently is shortened, and the working efficiency of a product manager is further improved.
For step S4241, when the classification judgment result is that an image is included, searching from the content data to be replaced of the requirement document template configuration file according to the first content control to be replaced, and taking the searched data as first target content data; replacing Value corresponding to the first content control to be replaced in the Docxtpl container to be processed by using the InlineImage method of the Docxpl technology according to the first target content data, that is, replacing a str object in the Value corresponding to the first content control to be replaced in the Docxpl container to be processed by using an InlineImage object (that is, the first target content data).
For step S4242, when the classification determination result is that no image is included, searching from the content data to be replaced of the required document template configuration file according to the first content control to be replaced, and determining first target content data; and replacing the Value corresponding to the first to-be-replaced content control in the to-be-processed Docxtpl container according to the first target content data by adopting the Jinja2 grammar.
In an embodiment, the step of performing content replacement on the content control with the object type of Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain the target requirement document template includes:
s51: generating a Win32com container according to the requirement document template replacing the non-built-in control to obtain a Win32com container to be processed;
s52: based on a Win32com technology, a content control with an object type of Word built-in content control is obtained from the requirement document template of the replaced non-built-in control by a head-to-tail traversal method, a second content control to be replaced is obtained, and the second content control to be replaced is stored in the Win32com container to be processed;
s53: performing content replacement on the second content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Win32com container to be processed;
s54: repeatedly executing the Win32 com-based technology, acquiring a content control with an object type of a Word built-in content control from the replaced non-built-in control required document template by a head-to-tail traversal method, obtaining a second content control to be replaced, and storing the second content control to be replaced in the Win32com container to be processed until the traversal of the replaced non-built-in control required document template is completed;
s55: and determining the target demand document template according to the traversed demand document template of the replaced non-built-in control.
According to the embodiment, the content control with the object type of the Word built-in content control is replaced based on the Win32com technology, so that the content control with the object type of the Word built-in content control does not need to be manually modified and replaced, the time for manually modifying the content control subsequently is shortened, and the working efficiency of a product manager is further improved.
For S51, generating a Win32com container according to the requirement document template of the replaced non-built-in control, and taking the generated Win32com container as a Win32com container to be processed;
the Win32com vessel to be treated was designed for KV. The Win32com container to be processed comprises a key and a Value, wherein the key is the Word built-in content control id of the second content control to be replaced, and the Value is stored in the Value and needs to be replaced.
It is understood that each Word built-in content control has a unique Word built-in content control id.
For S52, starting Word APP by a Client method of the Win32com technology, and then acquiring the to-be-processed required document template by the started Word APP; based on the Win32com technology, a content control with an object type of Word built-in content control is obtained from the requirement document template of the replaced non-built-in control by a head-to-tail traversal method, and the extracted content control is used as a second content control to be replaced.
For S53, based on the Win32com container to be processed, searching the second content control to be replaced from the content data to be replaced of the required document template configuration file, and taking the searched data as second target content data; and replacing the content of the second content control to be replaced by adopting a Client method of Win32com according to second target content data.
And S54, repeating the steps S52 to S54 until the traversal of the requirement document template with the replaced non-built-in control is completed, so that the content replacement of all the content controls with the object type of Word built-in content control in the requirement document template to be processed is automatically completed.
And S55, generating a document according to the traversed requirement document template of the replaced non-built-in control and the to-be-processed Win32com container, and taking the generated document as the target requirement document template. That is to say, the content in the Win32com container to be processed is replaced with the content control with the object type of the Word built-in content control in the requirement document template of the replaced non-built-in control, and the requirement document template of the replaced non-built-in control after replacement is taken as the target requirement document template.
In an embodiment, the step of performing content replacement on the second content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Win32com container to be processed includes:
s531: and acquiring a Word built-in content control set based on the Win32com container to be processed, and performing content replacement on the second content control to be replaced according to the Word built-in content control set and the content data to be replaced of the requirement document template configuration file.
According to the embodiment, the content control with the object type of the Word built-in content control is replaced based on the Win32com technology, so that the content control with the object type of the Word built-in content control does not need to be manually modified and replaced, the time for manually modifying the content control subsequently is shortened, and the working efficiency of a product manager is further improved.
For S531, acquiring a Word built-in content control set, searching a key corresponding to the second content control to be replaced in the Win32com container to be processed in the Word built-in content control set, and when the search is successful, taking an object corresponding to the ID searched in the Word built-in content control set as an object to be replaced; and replacing the object to be replaced by the Value corresponding to the second content control to be replaced in the Win32com container to be processed by adopting content.
Referring to fig. 2, the present application further provides a device for generating a requirement document template, where the device includes:
a request obtaining module 100, configured to obtain a request for generating a required document template, where the request for generating the required document template carries a required document template configuration file;
a template library obtaining module 200, configured to respond to the request for generating a required document template, and obtain a first-level sub-template library, a second-level sub-template library, and a third-level sub-template library;
a requirement document template frame construction module 300, configured to perform frame construction of a requirement document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the requirement document template configuration file based on a rolling template technology, so as to obtain a requirement document template to be processed;
a non-Word built-in content control content replacement module 400, configured to perform content replacement on a content control whose object type is a non-Word built-in content control in the to-be-processed demand document template according to-be-replaced content data of the demand document template configuration file based on a Docxtpl technology in combination with a Jinja2 technology, so as to obtain a demand document template in which the non-built-in control has been replaced;
and the Word built-in content control content replacing module 500 is used for replacing the content of the content control with the Word built-in content control in the object type in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain the target requirement document template.
The embodiment firstly carries out framework construction of a demand document template according to a first-level sub-template library, a second-level sub-template library, a third-level sub-template library and a demand document template configuration file based on a rolling template technology to obtain a demand document template to be processed, then carries out content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed according to content data to be replaced of the demand document template configuration file based on Docxtpl technology and Jinja2 technology to obtain the demand document template with the non-Word built-in control replaced, and finally carries out content replacement on the content control with the object type of the Word built-in content control in the demand document template with the non-built-in control replaced according to the content data to be replaced of the demand document template configuration file based on Win32com technology to obtain a target demand document template, thereby realizing automatic generation of the demand document template, the technical problems that dirty data are easy to leave and typesetting is easy to make mistakes due to the fact that historical demand documents are manually removed and cleaned to serve as templates are solved, and the working efficiency of a product manager is improved; the content controls of different object types are replaced by different methods, so that the content replacement accuracy of the content controls is improved, the time for modifying the content controls manually in the follow-up process is reduced, and the working efficiency of a product manager is further improved.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for storing data such as a generation method of the requirement document template. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of generating a requirements document template. The method for generating the requirement document template comprises the following steps: acquiring a request for generating a required document template, wherein the request for generating the required document template carries a configuration file of the required document template; responding to the request for generating the required document template, and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library; based on a rolling type template technology, performing framework construction of a demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file to obtain a demand document template to be processed; based on the Docxtpl technology and the Jinja2 technology, according to the content data to be replaced of the configuration file of the demand document template, performing content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed to obtain a demand document template with the non-built-in control replaced; and performing content replacement on the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain a target requirement document template.
The embodiment firstly carries out framework construction of a demand document template according to a first-level sub-template library, a second-level sub-template library, a third-level sub-template library and a demand document template configuration file based on a rolling template technology to obtain a demand document template to be processed, then carries out content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed according to content data to be replaced of the demand document template configuration file based on Docxtpl technology and Jinja2 technology to obtain the demand document template with the non-Word built-in control replaced, and finally carries out content replacement on the content control with the object type of the Word built-in content control in the demand document template with the non-built-in control replaced according to the content data to be replaced of the demand document template configuration file based on Win32com technology to obtain a target demand document template, thereby realizing automatic generation of the demand document template, the technical problems that dirty data are easy to leave and typesetting is easy to make mistakes due to the fact that historical demand documents are manually removed and cleaned to serve as templates are solved, and the working efficiency of a product manager is improved; the content controls of different object types are replaced by different methods, so that the content replacement accuracy of the content controls is improved, the time for modifying the content controls manually in the follow-up process is reduced, and the working efficiency of a product manager is further improved.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements a method for generating a requirement document template, including the steps of: acquiring a request for generating a required document template, wherein the request for generating the required document template carries a configuration file of the required document template; responding to the request for generating the required document template, and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library; based on a rolling type template technology, performing framework construction of a demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file to obtain a demand document template to be processed; based on the Docxtpl technology and the Jinja2 technology, according to the content data to be replaced of the configuration file of the demand document template, performing content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed to obtain a demand document template with the non-built-in control replaced; and performing content replacement on the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain a target requirement document template.
The method for generating the executed demand document template comprises the steps of firstly building a frame of the demand document template according to a first-level sub-template library, a second-level sub-template library, a third-level sub-template library and a demand document template configuration file based on a rolling template technology to obtain the demand document template to be processed, then carrying out content replacement on a content control of which the object type is a non-Word built-in content control in the demand document template to be processed according to the content data to be replaced of the demand document template configuration file based on a Docxpl technology and a Jinja2 technology to obtain the demand document template of which the non-built-in control is replaced, and finally carrying out content replacement on the content control of which the object type is the Word built-in content control in the demand document template of which the non-built-in control is replaced according to the content data to be replaced of the demand document template configuration file based on a Win32com technology, the target requirement document template is obtained, so that the automatic generation of the requirement document template is realized, the technical problems that dirty data are easily left and typesetting is easily made mistakes due to the fact that historical requirement documents are manually removed and cleaned to serve as templates are solved, and the working efficiency of a product manager is improved; the content controls of different object types are replaced by different methods, so that the content replacement accuracy of the content controls is improved, the time for modifying the content controls manually in the follow-up process is reduced, and the working efficiency of a product manager is further improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. A method for generating a requirement document template, the method comprising:
acquiring a request for generating a required document template, wherein the request for generating the required document template carries a configuration file of the required document template;
responding to the request for generating the required document template, and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library;
based on a rolling type template technology, performing framework construction of a demand document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the demand document template configuration file to obtain a demand document template to be processed;
based on the Docxtpl technology and the Jinja2 technology, according to the content data to be replaced of the configuration file of the demand document template, performing content replacement on a content control with an object type of a non-Word built-in content control in the demand document template to be processed to obtain a demand document template with the non-built-in control replaced;
and performing content replacement on the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain a target requirement document template.
2. The method for generating a requirement document template according to claim 1, wherein the step of performing framework building of the requirement document template according to the first-level sub-template library, the second-level sub-template library, the third-level sub-template library and the requirement document template configuration file based on a rolling template technology to obtain the requirement document template to be processed comprises:
reading a line of data from the document structure configuration data of the required document template configuration file by a head-to-tail traversal method to obtain line configuration data to be processed;
when the row configuration data to be processed is a required name, obtaining a document replacer name list, searching the row configuration data to be processed in the document replacer name list to obtain a required name searching result, when the required name searching result is successful, determining a current document replacer according to a document replacer corresponding to the required name searching result, otherwise, constructing a document replacer according to the row configuration data to be processed to obtain a document replacer to be processed, obtaining a first-level sub-template from the first-level sub-template library to obtain a first-level sub-template to be added, adding the first-level sub-template to be added into the document replacer to be processed, and taking the document replacer to be processed as the current document replacer;
when the row configuration data to be processed is the name of a user story, acquiring the current document replacer, acquiring a second-level sub-template from the second-level sub-template library to obtain a second-level sub-template to be added, and adding the second-level sub-template to be added to the current document replacer;
when the row configuration data to be processed is the name of the associated subsystem, acquiring the current document replacer, acquiring a third-level sub-template from the third-level sub-template library according to the row configuration data to be processed to obtain a third-level sub-template set to be added, and adding the third-level sub-template set to be added to the current document replacer;
repeatedly executing the step of reading a line of data from the document structure configuration data of the required document template configuration file by adopting the head-to-tail traversal method to obtain the line configuration data to be processed until the traversal of the document structure configuration data in the required document template configuration file is completed;
and obtaining the required document template to be processed according to the current document replacer.
3. The method for generating a requirement document template according to claim 1, wherein the step of performing content replacement on a content control with an object type of a non-Word built-in content control in the requirement document template to be processed according to the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology to obtain the requirement document template with the non-built-in control replaced comprises:
based on the Docxtpl technology, adopting a head-to-tail traversal method to extract a content control with an object type of a non-Word built-in content control from the required document template to be processed as a first content control to be replaced;
performing content replacement on the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on a Docxtpl technology in combination with a Jinja2 technology;
repeatedly executing the Docxtpl-based technology, adopting a head-to-tail traversal method, extracting a content control with an object type of a non-Word built-in content control from the to-be-processed required document template, and taking the content control as a first to-be-replaced content control until the traversal of the to-be-processed required document template is completed;
and determining the requirement document template of the replaced non-built-in control according to the traversed requirement document template to be processed.
4. The method for generating a requirement document template according to claim 3, wherein the step of extracting a content control with an object type of a non-Word built-in content control from the requirement document template to be processed by a head-to-tail traversal method based on the Docxtpl technology as a first content control to be replaced comprises:
acquiring the to-be-processed requirement document template by a Docxtemplate method of the Docxxtpl technology;
generating a Docxtpl container according to the to-be-processed requirement document template to obtain the to-be-processed Docxtpl container;
extracting a content control with an object type of a non-Word built-in content control from the to-be-processed required document template by adopting a head-to-tail traversal method, taking the content control as a first to-be-replaced content control, and storing the first to-be-replaced content control in the to-be-processed Docxtpl container;
the step of replacing the content of the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology includes:
judging whether the first content control to be replaced contains an image or not based on the Docxtpl container to be processed to obtain a classification judgment result;
and performing content replacement on the first content control to be replaced according to the Docxtpl container to be processed, the classification judgment result and the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology and the Jinja2 technology.
5. The method for generating the requirement document template according to claim 4, wherein the step of replacing the content of the first content control to be replaced according to the classification judgment result and the content data to be replaced of the requirement document template configuration file based on the Docxtpl technology in combination with the Jinja2 technology comprises:
when the classification judgment result is that the image is contained, based on the Docxtpl container to be processed, performing content replacement on the first content control to be replaced according to the content data to be replaced of the requirement document template configuration file by adopting an InlineImage method of the Docxtpl technology;
and when the classification judgment result is that no image is contained, based on the Docxtpl container to be processed, performing content replacement on the first content control to be replaced by adopting the Jinja2 grammar according to the content data to be replaced of the requirement document template configuration file.
6. The method for generating a requirement document template according to claim 1, wherein the step of replacing the content control with a Word built-in content control as an object type in the requirement document template of the replaced non-built-in control according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain a target requirement document template comprises:
generating a Win32com container according to the requirement document template replacing the non-built-in control to obtain a Win32com container to be processed;
based on a Win32com technology, a content control with an object type of Word built-in content control is obtained from the requirement document template of the replaced non-built-in control by a head-to-tail traversal method, a second content control to be replaced is obtained, and the second content control to be replaced is stored in the Win32com container to be processed;
performing content replacement on the second content control to be replaced according to the content data to be replaced of the requirement document template configuration file based on the Win32com container to be processed;
repeatedly executing the Win32 com-based technology, acquiring a content control with an object type of a Word built-in content control from the replaced non-built-in control required document template by a head-to-tail traversal method, obtaining a second content control to be replaced, and storing the second content control to be replaced in the Win32com container to be processed until the traversal of the replaced non-built-in control required document template is completed;
and determining the target demand document template according to the traversed demand document template of the replaced non-built-in control.
7. The method for generating a requirements document template according to claim 6, wherein said step of content-replacing said second content control to be replaced according to said content data to be replaced of said requirements document template configuration file based on said Win32com container to be processed comprises:
and acquiring a Word built-in content control set based on the Win32com container to be processed, and performing content replacement on the second content control to be replaced according to the Word built-in content control set and the content data to be replaced of the requirement document template configuration file.
8. An apparatus for generating a requirement document template, the apparatus comprising:
the request acquisition module is used for acquiring a request for generating a required document template, wherein the request for generating the required document template carries a required document template configuration file;
the template library acquisition module is used for responding to the requirement document template generation request and acquiring a first-level sub-template library, a second-level sub-template library and a third-level sub-template library;
the requirement document template framework building module is used for building a framework of a requirement document template according to the first-level sub template library, the second-level sub template library, the third-level sub template library and the requirement document template configuration file based on a rolling template technology to obtain a requirement document template to be processed;
a content replacement module of the non-Word built-in content control, configured to replace, based on a Docxtpl technology in combination with a Jinja2 technology, the content of the content control with the object type of the non-Word built-in content control in the to-be-processed demand document template according to the to-be-replaced content data of the demand document template configuration file, so as to obtain a demand document template in which the non-built-in control has been replaced;
and the Word built-in content control content replacing module is used for replacing the content of the content control with the object type of the Word built-in content control in the replaced non-built-in control requirement document template according to the content data to be replaced of the requirement document template configuration file based on the Win32com technology to obtain the target requirement document template.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110425548.0A 2021-04-20 2021-04-20 Method, device and equipment for generating requirement document template and storage medium Active CN113011151B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110425548.0A CN113011151B (en) 2021-04-20 2021-04-20 Method, device and equipment for generating requirement document template and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110425548.0A CN113011151B (en) 2021-04-20 2021-04-20 Method, device and equipment for generating requirement document template and storage medium

Publications (2)

Publication Number Publication Date
CN113011151A true CN113011151A (en) 2021-06-22
CN113011151B CN113011151B (en) 2022-03-18

Family

ID=76389025

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110425548.0A Active CN113011151B (en) 2021-04-20 2021-04-20 Method, device and equipment for generating requirement document template and storage medium

Country Status (1)

Country Link
CN (1) CN113011151B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106610927A (en) * 2016-12-19 2017-05-03 厦门二五八网络科技集团股份有限公司 Translation template-based internet article establishment method and system
CN110837727A (en) * 2019-10-23 2020-02-25 深圳价值在线信息科技股份有限公司 Document template generation method and device, terminal equipment and medium
CN111950247A (en) * 2020-07-08 2020-11-17 北京明略软件系统有限公司 Configuration-based Word document generation method
CN112329413A (en) * 2019-08-02 2021-02-05 阿里巴巴集团控股有限公司 Template building method, file generation method, template system, device and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106610927A (en) * 2016-12-19 2017-05-03 厦门二五八网络科技集团股份有限公司 Translation template-based internet article establishment method and system
CN112329413A (en) * 2019-08-02 2021-02-05 阿里巴巴集团控股有限公司 Template building method, file generation method, template system, device and computer equipment
CN110837727A (en) * 2019-10-23 2020-02-25 深圳价值在线信息科技股份有限公司 Document template generation method and device, terminal equipment and medium
CN111950247A (en) * 2020-07-08 2020-11-17 北京明略软件系统有限公司 Configuration-based Word document generation method

Also Published As

Publication number Publication date
CN113011151B (en) 2022-03-18

Similar Documents

Publication Publication Date Title
CN110297656B (en) Method and device for evaluating codes based on configuration model and computer equipment
CN110472219B (en) Electronic file generation method, electronic file generation device, computer equipment and storage medium
CN109933754B (en) Method, apparatus, computer device and storage medium for searching contract modification part
CN110175031B (en) Method, device, computer equipment and storage medium for converting SQL language into DSL language
CN113536735B (en) Text marking method, system and storage medium based on keywords
CN110765741A (en) Data processing method and device, computer equipment and storage medium
CN111813630A (en) Method and device for collecting log information and computer equipment
CN113011151B (en) Method, device and equipment for generating requirement document template and storage medium
CN108897727B (en) Contract filing method and device, computer equipment and storage medium
CN112580122B (en) Drawing processing method, device, computer equipment and storage medium
CN112541739B (en) Method, device, equipment and medium for testing question-answer intention classification model
CN112528882A (en) Method, device, equipment and medium for identifying house property certificate information based on OCR (optical character recognition)
CN113408244B (en) Method, device, equipment and medium for generating Word document by Java application
CN109657210B (en) Text accuracy rate calculation method and device based on semantic analysis and computer equipment
CN113986245A (en) Object code generation method, device, equipment and medium based on HALO platform
CN114968346A (en) Method, device, equipment and storage medium for detecting field comments of DDL script
CN113448982A (en) DDL statement analysis method and device, computer equipment and storage medium
CN113918461A (en) Interface test method, device, equipment and storage medium
CN113760361A (en) Code file generation method, computer device and readable storage medium
CN113128191B (en) Method and device for scripted generation of arbitration document
CN109710904B (en) Text accuracy rate calculation method and device based on semantic analysis and computer equipment
CN114661713B (en) Data synchronization method, device, equipment and storage medium
CN113850081B (en) Text processing method, device, equipment and medium based on artificial intelligence
CN115062252B (en) Method for solving format conflict of webpage generation file when WPS and Word are opened
CN113239152B (en) Dialogue repair method, device, equipment and storage medium suitable for multi-round dialogue

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
GR01 Patent grant
GR01 Patent grant