A method for automatic document generation based on document recognition

By marking field types in Word documents and using natural language processing and image recognition technology to generate reusable document templates, the problems of long development cycle and high maintenance difficulty of traditional document generation solutions are solved, and efficient and flexible document automatic generation and format consistency are achieved.

CN120449854BActive Publication Date: 2025-09-05INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510941582.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-09-05
Estimated Expiration
2045-07-09

AI Technical Summary

Technical Problem

Traditional document generation solutions have a long development cycle, large amounts of code, and are difficult to maintain. Users need to learn additional template design rules, and templates cannot reuse existing Word documents, resulting in waste of resources and duplication of work.

Method used

By marking the field types in Word documents and using natural language processing and image recognition technology to identify the correspondence between fields and system fields, reusable document templates can be generated. Variable tags can be replaced according to actual business data, and auxiliary formats can be removed to output documents.

Benefits of technology

It reduces the workload of developing special tools, improves the efficiency of template generation, reduces the risk of field binding errors, ensures that the generated documents are consistent with business data in real time, and are beautifully formatted and easy to use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120449854B_ABST
    Figure CN120449854B_ABST
Patent Text Reader

Abstract

The present application provides a method for automatically generating documents based on document recognition, which relates to the field of enterprise informatization and document automation processing technology. The method includes: designing a template in Word and annotating text, QR codes / barcodes, and associated sub-table fields according to preset rules. After filling in sample data, natural language processing and image recognition technology are used to identify the field correspondence to generate a reusable variable template. After associating the template with the business function, the variable tags are automatically replaced according to the business data during actual use to generate a complete document containing a dynamic QR code and sub-table data, and the auxiliary identification format is cleared, while the formal typesetting output is retained, thereby realizing the rapid construction and automatic generation of document templates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of enterprise informatization and document automation processing technology, and specifically relates to a method for automatically generating documents based on document recognition. Background Art

[0002] In the process of enterprise informationization, automated document generation is one of the core requirements of business process management. Common document types include inbound and outbound documents, orders, and work orders, and their generation often relies on the document template functionality within the informationization system. Traditionally, software developers have developed dedicated visual document template tools (such as drag-and-drop editors) or integrated third-party template engines to implement template design, field binding, and data entry. However, these solutions have significant drawbacks:

[0003] The development of visual template tools requires dealing with complex user interaction logic, format compatibility, and integration with business systems, resulting in long development cycles, large amounts of code, and high maintenance difficulties. Using third-party tools also results in high secondary development costs and complex troubleshooting.

[0004] The operational logic of existing tools differs significantly from common office software (such as Word), requiring users to learn additional template design rules, which reduces efficiency. Furthermore, the template editing process is tightly coupled with business systems, making operations unintuitive and increasing user training costs.

[0005] In traditional solutions, templates need to be redrawn within the system, and users' existing Word documents cannot be directly reused, resulting in waste of resources and duplication of work. Summary of the Invention

[0006] This application provides a method for automatically generating documents based on document recognition to solve one of the above technical problems.

[0007] The technical solutions adopted in this application are:

[0008] The present invention provides a method for automatically generating a document based on document recognition, comprising:

[0009] Design a document template using a Word document and mark the field types according to the preset identification rules. Field types include text fields, QR code / barcode fields, and associated sub-table fields.

[0010] Fill in sample data for all fields in the document template based on business data;

[0011] Through natural language processing and image recognition technology, the corresponding system fields of each field in the sample data are identified, and the fields are replaced with variable tags to generate reusable document templates;

[0012] Associate reusable document templates with target business functions;

[0013] Call the associated document template, replace all variable tags according to the field values ​​in the actual business data, and generate the document. The QR code / barcode field generates the corresponding QR code or barcode image based on the actual content, and the associated sub-table field is cyclically populated with all records based on the sub-table data.

[0014] Remove the auxiliary formatting used to identify fields in the document and output the document in the official format.

[0015] According to one embodiment of the present application, the preset identification rule is specifically:

[0016] The text segment is marked with a first preset font;

[0017] The QR code / barcode field is marked with a second preset background;

[0018] The associated sub-table fields are marked with the third preset background;

[0019] The text fields in the sample data are marked with a first preset font.

[0020] According to one embodiment of the present application, the example data for filling in all fields in the document template based on the business data includes:

[0021] If the sample data for the QR code / barcode field is empty, the default system field contains the QR code or barcode data;

[0022] If the sample data of the QR code / barcode field is actual content, the system field corresponding to the actual content is identified and replaced with a variable tag.

[0023] According to one embodiment of the present application, the method of identifying the system fields corresponding to each field in the sample data by using natural language processing and image recognition technology, replacing the fields with variable tags, and generating a reusable document template includes:

[0024] For text fields, natural language processing is used to identify the correspondence between the content in the sample data and the system fields, and the content is replaced with variable tags.

[0025] For the QR code / barcode field, if the sample data is empty, the second preset background area is retained as the QR code / barcode placeholder; if the sample data is actual content, it is replaced with a variable marker;

[0026] For the associated sub-table fields, the correspondence between the content of the first record of the sub-table data and the system field is identified and replaced with a variable tag, and the associated relationship of the sub-table fields is recorded at the same time.

[0027] According to one embodiment of the present application, calling the associated document template, replacing all variable tags according to the field values ​​in the actual business data, and generating a document document includes:

[0028] For text fields, replace the variable tags with the corresponding field values ​​in the actual business data;

[0029] For the QR code / barcode field, generate the corresponding QR code or barcode image according to the variable tag and insert it into the second preset background area;

[0030] For the associated sub-table fields, all records of the sub-table data are traversed, the field value of each record is replaced with the corresponding variable marker, and inserted into the third preset background area according to the format.

[0031] According to one embodiment of the present application, the auxiliary format for identifying fields in the document is removed, and the document is output after retaining the formal format, specifically:

[0032] Remove all auxiliary markings and keep only the formal format of the document;

[0033] Formal formatting includes fonts, paragraph layout, table structure, and image placement.

[0034] According to an embodiment of the present application, the present invention further includes: dynamically updating the template, specifically:

[0035] When business requirements change, users modify the identification rules or field contents of the document template and resubmit the sample data;

[0036] Re-identify the updated fields and generate variable tags to re-associate the updated document template with the target business function.

[0037] According to an embodiment of the present application, the method further includes: exception handling, specifically:

[0038] When identifying fields, if multiple fields are detected to correspond to the same content, the user will be prompted to manually confirm the correction;

[0039] Before generating the document, check whether all variable tags are replaced correctly. If there are any unreplaced variable tags, the generation process will be terminated and an error message will be prompted.

[0040] A second aspect of the present application provides a computer-readable storage medium having a program stored thereon, which implements the steps in the method when executed by a processor.

[0041] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor implements the steps in the method described above when executing the program.

[0042] Due to the adoption of the above technical solution, the beneficial effects achieved by this application are as follows:

[0043] This application uses pre-defined identification rules to mark field types in Word documents, eliminating the need for specialized tools. This fully reuses Word's editing capabilities, eliminating the development and maintenance of visual template tools. Users can design templates directly using familiar office software without having to learn additional template design rules.

[0044] This application fills in template sample data based on business data and automatically identifies the correspondence between fields and system fields using natural language processing and image recognition technology to generate variable tags. This reduces the workload of manually configuring field mappings and improves template generation efficiency. The matching logic between sample data and system fields reduces the risk of field binding errors.

[0045] When this application calls the template, variable tags are replaced with actual business data, a QR code / barcode image is dynamically generated, and sub-table data is populated. Finally, auxiliary formatting (such as color and background) is removed, retaining the official output format. This ensures that the generated document format is consistent with the original template, avoiding layout disruptions caused by field binding. Flexible processing of text, QR codes / barcodes, and sub-table data meets the needs of complex business scenarios.

[0046] This application associates the generated document template with the target business function (such as order management), enabling synchronized updates between the template and business data. When business requirements change, simply modify the Word template and resubmit the sample data; no system code modifications are required. By binding the template to the business function, the generated document content is guaranteed to be consistent with the business data in real time. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0048] Figure 1 A flowchart of a method for automatically generating a document based on document recognition provided in an embodiment of the present application;

[0049] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0050] Reference numerals:

[0051] 810 , processor; 820 , communication interface; 830 , memory; 840 , communication bus. DETAILED DESCRIPTION

[0052] In order to more clearly illustrate the overall concept of the present application, a detailed description is given below in an illustrative manner in conjunction with the accompanying drawings.

[0053] The following description sets forth many specific details to facilitate a thorough understanding of the present application. However, the present application may also be implemented in other ways than those described herein, and therefore, the scope of protection of the present application is not limited by the specific embodiments disclosed below. It should be noted that the embodiments of the present application and the features of each embodiment may be combined with each other unless there is a conflict.

[0054] In this application, unless otherwise expressly specified and limited, a first feature "above" or "below" a second feature may be that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in an appropriate manner in any one or more embodiments or examples.

[0055] Example 1

[0056] like Figure 1 As shown, a method for automatically generating documents based on document recognition includes:

[0057] S100. Design a document template through a Word document, and mark the field types according to preset identification rules. The field types include text fields, QR code / barcode fields, and associated sub-table fields.

[0058] As mentioned above, the common office software Word is used to create a document template, and different types of fields are defined through specific identification rules. These field types mainly include:

[0059] Text field: refers to text information that needs to be dynamically filled, such as amount, date, etc.

[0060] QR / Barcode Field: The location used to generate or display a QR code or barcode, which typically contains an order number or other identifying information;

[0061] Related sub-table fields: refers to those that need to be dynamically filled according to the related data in the system, such as order details may contain multiple product entries.

[0062] Identification rules are pre-defined standards used to distinguish different field types. For example, text fields can be represented by red font, QR code / barcode fields can be represented by a yellow background, and related sub-table fields can be represented by a red font on a blue background.

[0063] For example, suppose you want to design an "Order Confirmation Form" template for an online shopping platform:

[0064] Text fields: In a Word document, use red font to mark the information that needs to be dynamically filled, such as the buyer's name, delivery address, total amount, etc. In this way, in actual application, the system will automatically replace these red font parts with the real data in the database.

[0065] QR Code / Barcode Field: For areas where a QR code or barcode is required (such as a tracking number), mark this area in the Word document with a yellow background. If the system already has a QR code or barcode, insert it directly. If not, generate a QR code based on the provided text and insert it into the desired location.

[0066] Related sub-table fields: An order may list information for multiple items (name, quantity, unit price, etc.). In a Word document, these sub-table fields can be identified by a blue background and red font. In actual operation, the system will traverse all related sub-table records and fill them into the specified position one by one.

[0067] It should be noted that in specific implementation scenarios, in addition to the color identification mentioned above, users can also set other identification rules based on their needs, such as using specific symbols, font size changes, etc. to distinguish different types of fields. This makes the solution more flexible and can adapt to more diverse business scenarios.

[0068] In specific implementation scenarios, based on the above solution and taking into account the needs of multinational companies, Word documents can also support template design in multiple languages. This means that even when used in different countries and regions, templates can be easily adjusted to meet local language habits and legal requirements.

[0069] In specific implementation scenarios, based on the above solution, users can also add more formatting control options to Word documents, such as alignment, margin settings, table styles, etc., to better meet personalized output needs. In addition, intelligent formatting suggestions can be introduced to help users optimize template layouts and improve the professionalism and aesthetics of documents.

[0070] In specific implementation scenarios, based on the above solution, although the template design is mainly based on Word documents, it can also be considered to be expanded to other popular document editing tools, such as Google Docs, LibreOffice Writer, etc., to ensure greater user coverage and technical applicability.

[0071] S200. Fill in sample data for all fields in the document template based on business data.

[0072] As mentioned above, actual business data from the system is used to populate pre-designed document templates. This serves to verify the rationality of the template design and provide a basis for subsequent field identification and variable tag replacement. Business data is manually entered or imported into the corresponding locations in the template, including but not limited to text fields, QR code / barcode fields, and associated subtable fields. This process not only ensures that the template accurately reflects actual business needs but also provides the necessary reference samples for automated document generation.

[0073] For example, suppose you are designing a "Goods Delivery Order" template for a logistics company:

[0074] Text fields: In the text fields of the template (such as the recipient's name and address), manually enter sample data in red font based on a real delivery order. For example, "Zhang San" could be the recipient's name, and "No. XX, XX Road, Chaoyang District, Beijing" could be the delivery address.

[0075] QR code / barcode field: For QR code or barcode fields that need to display the cargo tracking number, if there is a ready-made tracking number in the system, directly insert the corresponding QR code into the area marked with a yellow background in the Word document; if there is no ready-made data, you can manually enter a sample tracking number (such as "20250703001"), and then the system will automatically generate a QR code and place it in the designated location.

[0076] Related child table fields: If the delivery order also requires detailed information about each item (such as name, quantity, and weight), you can manually fill in the details of the first record in the blue background area of ​​the Word document as an example. For example, "Product A," quantity "2," and weight "5kg."

[0077] It should be noted that in specific implementation scenarios, in addition to manually filling in a single sample data point, the above solution can also be used to develop a function that allows users to upload files containing multiple business data points (such as Excel spreadsheets) to automatically fill in the template fields in batches. This greatly improves work efficiency and is particularly suitable for processing large numbers of documents with similar formats.

[0078] In specific implementation scenarios, based on the above solution and based on historical business data, the system can intelligently recommend the most commonly used or latest sample data for users to choose, reducing the workload of manual input while ensuring the timeliness and accuracy of the sample data.

[0079] In specific implementation scenarios, building on the above solution, users can also save different versions of sample data, making it easier to compare and select the version that best suits the current business scenario. This is particularly important for companies with frequently changing business processes, allowing them to quickly adjust templates to meet new needs.

[0080] In specific implementation scenarios, based on the above solution, when business data changes (for example, a customer modifies the delivery address), the system can synchronize these changes to the document template in real time, ensuring that all sample data used is up to date and avoiding errors caused by information lag.

[0081] S300. Through natural language processing and image recognition technology, identify the system fields corresponding to each field in the sample data, replace the fields with variable tags, and generate a reusable document template.

[0082] As mentioned above, advanced natural language processing (NLP) and image recognition technologies are used to analyze the sample data entered by the user in a Word document and match it with actual fields in the system. By intelligently identifying text, QR codes / barcodes, and associated sub-table fields within the sample data, the system automatically determines which specific field in the system database each field corresponds to and replaces these fields with variable tags (such as {% total %}). The goal is to create a universal and flexible document template that can be reused in different business scenarios, simply by dynamically populating the content based on actual business data.

[0083] For example, suppose you are designing a template for a purchase order:

[0084] Text fields: In the template, the "Supplier Name" field is highlighted in red and populated with the example value "ABC Company." Using natural language processing, the system recognizes the concept of "supplier name" and associates it with the corresponding field in the database (for example, supplier_name). The example value is then replaced with the variable token {%supplier_name%}.

[0085] QR code / barcode fields: For QR code fields containing order numbers, if a specific order number (such as "20250703001") is already entered in the template, the system will recognize it as the order number and associate it with the order number field in the database (such as order_id), ultimately replacing that field with the variable {%order_id%}. If no specific number is entered, the yellow background remains as a placeholder.

[0086] Associating child table fields: In the template, there's a table displaying product details, including information such as product name and quantity. As an example, the user manually fills in the first record: "Product A" and "10" for quantity. The system uses image recognition technology to identify these fields and associates them with related database fields (such as product_name and quantity), generating the corresponding variable tags {%product_name%} and {%quantity%}.

[0087] It should be noted that, in specific implementation scenarios, the above solution can also be expanded with natural language processing capabilities to enable it to recognize and process text in multiple languages, ensuring that templates can be effectively applied globally. This is particularly important for multinational enterprises, as it allows them to create templates in local languages ​​while still accurately matching system fields.

[0088] In specific implementation scenarios, based on the above solution, users can also be given the ability to customize field mapping rules, allowing them to adjust how fields are matched with system fields in specific situations. For example, certain industries may have unique terminology or abbreviations, and users can specify how these terms correspond to standard fields in the system.

[0089] In specific implementation scenarios, the above solution can also be used to train models using historical business data to improve the accuracy of natural language processing and image recognition. Over time, the system can learn more complex patterns, better understand emerging field descriptions, and reduce the possibility of misjudgment.

[0090] In specific implementation scenarios, building on the above solution, when the system attempts to identify and replace fields, if it encounters uncertainty, it can prompt the user through the interface to provide more information or confirm the suggested matching result. This helps improve the transparency and accuracy of the template generation process, ensuring that the final template fully meets the user's expectations.

[0091] S400: Associate the reusable document template with the target business function.

[0092] As mentioned above, the document templates generated using natural language processing and image recognition technologies are tied to specific business function modules. "Business function" here refers to specific operations or processes within the enterprise information system, such as order management and inventory management. By establishing this association, the system ensures that when a business operation (such as creating a new order) is executed, the corresponding document template is automatically called and filled in based on real-time data, thus achieving automated document generation. This step not only improves work efficiency but also ensures the consistency and accuracy of document formats.

[0093] For example, let's assume a manufacturing company is using an ERP system to manage its procurement process:

[0094] First, the user designed a purchase order template using a Word document, labeled all field types according to preset identification rules, including supplier name, product details, quantity, etc., and completed the process of replacing fields with variable tags using NLP and image recognition technology.

[0095] Next, you need to associate this purchase order template with the "Purchase Order Management" module in your ERP system. This means that whenever a new purchase order is created in the system, the template will be automatically referenced, and the actual purchase data (such as supplier name and product details) will be filled in the corresponding fields in the template to generate the final purchase order document.

[0096] When a purchasing department employee enters a new purchase information into the ERP system, the system automatically calls the previously set purchase order template, fills the actual data into the variable mark positions in the template (such as {%supplier_name%}, {%product_details%}, etc.), and generates a formal purchase order document for printing or electronic archiving.

[0097] It's important to note that, in specific implementation scenarios, the above solution can be used to allow enterprises to flexibly adjust the relationship between document templates and business functions in different business scenarios. For example, during a promotional period, a sales contract template with special preferential terms could be temporarily replaced, while the standard version would be used under normal circumstances. This allows for rapid response to changing market demands based on actual conditions.

[0098] In specific implementation scenarios, in addition to directly binding templates to single business functions, you can also consider configuring multi-level associations based on factors such as roles, permission levels, and even geographic location. For example, you can set up different invoice templates for branches in different regions according to local laws and regulations, or provide customized report templates for different levels of management.

[0099] In specific implementation scenarios, building on the above solution, machine learning algorithms can be used to analyze historical data, predict the document template that best suits current business needs, and provide intelligent recommendations to users. For example, when a user prepares to initiate a new sales quotation request, the system can automatically recommend the most suitable quotation template based on previous successful cases of similar projects.

[0100] In specific implementation scenarios, building on the above solutions, we can also explore the possibility of deep integration with other enterprise applications (such as CRM and SCM) to enable automated document generation within a wider range of business contexts. For example, by integrating with a customer relationship management system, the automatic generation of order confirmations can be triggered immediately after a customer places an order, completing the entire process from order acceptance to shipping notification without manual intervention.

[0101] S500. Call the associated document template, replace all variable tags according to the field values ​​in the actual business data, and generate a document document. Among them, the QR code / barcode field generates a corresponding QR code or barcode image according to the actual content, and the associated sub-table field is cyclically filled with all records according to the sub-table data.

[0102] As mentioned above, the system first calls the associated document template and replaces the template's variable tags (such as {%total%}) with the field values ​​from the actual business data. For QR code or barcode fields, the system generates a corresponding QR code or barcode image based on the actual content and inserts it into the designated location. For associated subtable fields, it is necessary to iterate through all records in the subtable and fill each entry into the corresponding location in the template to ensure that all information is fully and accurately reflected on the final document.

[0103] For example, suppose a retail company is using this system to generate sales invoices:

[0104] Text Field Replacement: In a pre-designed sales invoice template, several text fields are marked as variables (e.g., customer name {%customer_name%}, order total amount {%total_amount%}, etc.). When the system receives a new sales order, it automatically detects these variable tags and replaces them with the actual order information. For example, if the customer's name is "Li Hua" and the order total is "500 yuan," the generated sales invoice will display "Li Hua" and "500 yuan" in the corresponding positions.

[0105] QR Code / Barcode Field Processing: Imagine an invoice needs to display a QR code for order tracking. The system first checks whether the field already contains specific content (e.g., the order number "20250703001"). If so, a QR code is generated based on this number and placed in the area marked as the QR code area in the template. If not, the area is left blank pending subsequent additions.

[0106] Populating Related Subtable Fields: Sales invoices also include a detailed list of items, a typical example of related subtable fields. The template includes a pre-defined area for displaying information about each item (including name, quantity, unit price, etc.). The system traverses the entire order's item list, extracting relevant information one by one and populating it into the corresponding locations in the template according to the pre-defined format. For example, if an order includes three items, the system will list the specific information for each of the three items, forming a complete item list.

[0107] It should be noted that in specific implementation scenarios, the above solution can also be used to support other common document formats, such as Word documents and Excel spreadsheets, in addition to traditional PDF formats, to meet the diverse needs of different users. The advantage of doing so is that users can choose the most suitable output format based on their preferences, and it also facilitates integration with other systems or tools.

[0108] In specific implementation scenarios, based on the above solution, users can also be allowed to customize some advanced formatting settings before generating documents, such as font size, color scheme, page margins, etc. By providing such flexibility, it can be ensured that the final document is not only accurate in content but also looks and feels in line with the company's brand image requirements.

[0109] In specific implementation scenarios, building on the above solution, batch generation and printing capabilities can be developed to address situations where a large number of similar documents need to be processed simultaneously (e.g., printing monthly invoices at the end of the month). Users simply upload a file containing multiple business data items (e.g., an Excel spreadsheet), and the system will generate all the documents at once, allowing for direct printing or exporting as a compressed download.

[0110] In specific implementation scenarios, building on the above solution, a real-time data synchronization mechanism can be established. This allows the system to immediately capture changes in source data (for example, a customer changes their delivery address) and automatically apply the latest data the next time a document is generated. This helps reduce errors caused by information lags and improves work efficiency and service quality.

[0111] In specific implementation scenarios, the above solution can be supplemented with a version management mechanism, allowing users to save different versions of document templates and their generated results. This is extremely useful for audit tracking, historical data analysis, and legal dispute resolution. Furthermore, a backtracking function can be provided, allowing users to view the document status at any point in time, ensuring data integrity and traceability.

[0112] S600. Remove the auxiliary format used to identify the fields in the document, retain the formal format, and then output the document.

[0113] As mentioned above, after matching the document template to actual business data and populating variable tags, to ensure the professionalism and consistency of the generated document, remove all auxiliary formatting used to identify field types (such as red font, yellow background, and blue background). This auxiliary formatting only helps the system identify field location and type and should be removed from the final output document to ensure a clean appearance and compliance with corporate standards. This step ensures that the generated document is not only accurate in content but also aesthetically pleasing and easy to read.

[0114] For example, suppose a logistics company uses this system to generate shipment orders:

[0115] Original template: During the design phase, the user created a cargo delivery order template using a Word document. The text fields were marked in red, the QR code / barcode fields were marked with a yellow background, and the associated subtable fields were marked with a blue background and red.

[0116] Filling variable tags: When actual business data is filled into the template, the corresponding variable tags are replaced with the actual data values. For example, the "Recipient Name" field changes from {%customer_name%} to "Zhang San", and the QR code area corresponding to the order number generates a QR code image based on the actual order number.

[0117] Remove auxiliary formats: Before final output, the system will automatically remove all auxiliary formats used to identify field types. This means:

[0118] Text fields with red fonts will revert to the default or preset font color;

[0119] The QR code / barcode area with a yellow background will return to white or other background colors;

[0120] The associated sub-table fields with a blue background will also return to their normal background color, and the red font parts will also be adjusted to a unified font style.

[0121] Official format output: After the above processing, the document will be presented to the user in the official format. At this point, all information is clearly visible and the format is neat and uniform, fully meeting the company's visual image requirements.

[0122] It should be noted that in specific implementation scenarios, based on the above solution, users can also be allowed to define specific format conversion rules, such as specifying the color and font size that should be used for certain fields after removing auxiliary formatting. This allows companies to personalize documents according to their own brand guidelines, thereby improving the professionalism and recognition of documents.

[0123] In specific implementation scenarios, different versions of the formatting options can be added to the above solution, allowing users to select the appropriate output style for different purposes. For example, internal documents can use a simple layout, while documents for external publication can choose a more formal design style. This flexibility helps meet diverse business needs.

[0124] In specific implementation scenarios, the system can also provide users with intelligent format optimization suggestions based on historical data analysis and best practices, building on the above solutions. For example, it can recommend the most suitable font combination or typesetting layout for a specific industry, helping users quickly produce high-quality documents.

[0125] In specific implementation scenarios, the above solution can also be combined with a real-time preview function, allowing users to see the final effect before removing auxiliary formatting. This can help users promptly identify and correct potential formatting issues, ensuring that the generated documents are both beautiful and practical.

[0126] In specific implementation scenarios, based on the above solution, considering that users may view or print documents on different devices, support for multiple file formats (such as PDF / A, EPUB, etc.) can be added, and the display effect can be optimized to ensure a good visual experience on various platforms.

[0127] In some embodiments of the present application, the preset identification rule is specifically:

[0128] The text segment is marked with a first preset font;

[0129] The QR code / barcode field is marked with a second preset background;

[0130] The associated sub-table fields are marked with the third preset background;

[0131] The text fields in the sample data are marked with a first preset font.

[0132] As mentioned above, when designing document templates, a unified set of identification rules is required to facilitate system recognition of different field types (text fields, QR code / barcode fields, and associated sub-table fields). These rules distinguish different field types through specific formatting characteristics, ensuring accurate subsequent field recognition and variable tag replacement.

[0133] Text segments are marked with the first default font:

[0134] This regulation specifies that fields representing textual information in Word documents should be marked with a specific font style (the "first default font"). For example, all textual content that needs to be dynamically filled (such as amounts and dates) can be set to a red font. This not only helps the system quickly locate these fields, but also allows users to clearly distinguish which text fields require automatic filling when designing templates.

[0135] The QR code / barcode field is marked with the second preset background:

[0136] QR code or barcode fields are often used to display graphically encoded information such as order numbers and product serial numbers. According to this rule, these fields should be marked with a specific background color (the "secondary default background") in the document. For example, a yellow background could be used to mark the QR code or barcode area. This allows the system to accurately identify the areas used to generate the QR code or barcode and correctly insert the corresponding image in the actual application.

[0137] The associated sub-table fields are marked with the third preset background:

[0138] When a document contains multiple related data records (such as a list of items in an order), these data are called related sub-table fields. Regulations require that these fields be marked in the document with a specific background color (the "third default background"). For example, a blue background with red font could be used to highlight related sub-table fields. This helps the system recognize and process these complex multi-row data structures, ensuring that each sub-table record is correctly extracted and populated.

[0139] The text fields in the sample data are labeled with the first default font:

[0140] When filling in sample data in a document template, all text fields should follow the aforementioned rules for text fields and use the same "first default font." This means that even when filling in sample data, the font style used for the official fields should be consistent (e.g., red). This ensures that the system can accurately identify the location and type of each field, both during the template design phase and when filling in actual data.

[0141] In some embodiments of the present application, the example data for filling in all fields in the document template based on the business data includes:

[0142] If the sample data for the QR code / barcode field is empty, the default system field contains the QR code or barcode data;

[0143] If the sample data of the QR code / barcode field is actual content, the system field corresponding to the actual content is identified and replaced with a variable tag.

[0144] As mentioned above, when using the system to generate document templates, you need to fill in each field in the template based on actual business data. This process not only ensures that the template design meets actual needs but also provides the necessary reference samples for subsequent automated processing. The following are the specific steps and rules for handling different types of fields (especially QR code / barcode fields):

[0145] If the Sample Data field for the QR Code / Barcode field is empty, the default system field contains the QR code or barcode data:

[0146] In some cases, users may not be able to provide specific QR code or barcode content as sample data. For example, in an order template, if the order number has not yet been determined or the system automatically generates a QR code, the QR code field can be left blank.

[0147] When the sample data for a QR code / barcode field is empty, the system assumes that the data for that field already exists in the system and automatically populates the corresponding QR code or barcode image when generating the final document. This means that even if the template doesn't contain specific content, the system can still recognize and process these fields, ensuring that the final output document contains the correct QR code or barcode.

[0148] If the sample data in the QR code / barcode field is actual content, identify the system field corresponding to the actual content and replace the system field with a variable tag:

[0149] If the user provides a specific QR code or barcode content as sample data (such as the order number "20250703001"), the system needs to identify which system field this content corresponds to (such as the order number field order_id).

[0150] The system analyzes the specific content in the sample data, finds the matching system field, and replaces the field with a variable marker (such as {%order_id%}). The purpose of this is to dynamically insert real data values ​​instead of fixed sample data when the actual document is generated.

[0151] For example, in an order template, if the sample data contains a specific order number "20250703001," the system will recognize this as the order number field and replace it with the variable tag {%order_id%}. When a new order document is generated, the system will generate a QR code based on the actual order number and insert it into the corresponding location.

[0152] By applying these rules, the system can flexibly handle various QR code / barcode fields, whether the specific content is known in advance or automatically generated by the system. This not only increases the flexibility of template design, but also ensures that the final document accurately reflects the actual business data, enhancing the practicality and reliability of the system.

[0153] In some embodiments of the present application, the method of identifying the system fields corresponding to each field in the sample data by using natural language processing and image recognition technology, replacing the fields with variable tags, and generating a reusable document template includes:

[0154] For text fields, natural language processing is used to identify the correspondence between the content in the sample data and the system fields, and the content is replaced with variable tags.

[0155] For the QR code / barcode field, if the sample data is empty, the second preset background area is retained as the QR code / barcode placeholder; if the sample data is actual content, it is replaced with a variable marker;

[0156] For the associated sub-table fields, the correspondence between the content of the first record of the sub-table data and the system field is identified and replaced with a variable tag, and the associated relationship of the sub-table fields is recorded at the same time.

[0157] As mentioned above, in a document template, all text fields that need to be dynamically populated (such as amounts and dates) should be marked with a specific font (the "first preset font"). The system uses natural language processing technology to analyze the content of these text fields and identify their corresponding fields in the system database.

[0158] For example, in an order template, the "Customer Name" field might be highlighted in red and filled with the sample value "John Doe." The system recognizes the concept of "Customer Name" and associates it with the customer_name field in the database. It then replaces the sample value with the variable tag {%customer_name%}. This way, when an actual order is generated, the system automatically populates the field with the actual customer name.

[0159] For the QR code / barcode field, if the sample data is empty, the second preset background area is retained as the QR code / barcode placeholder; if the sample data is actual content, it is replaced with variable markers:

[0160] QR code or barcode fields are often used to display important information in a graphically encoded form, such as order numbers and product serial numbers. During template design, these fields should be marked with a specific background color (i.e., a "secondary preset background," such as yellow).

[0161] If the sample data is empty (i.e., no specific QR code or barcode content), the system will retain the background area as a placeholder for the QR code or barcode. This means that when the final document is generated, the system can automatically generate a corresponding QR code or barcode based on the actual business data and insert it into the location.

[0162] If the sample data contains specific QR code or barcode content (such as the order number "20250703001"), the system will identify the corresponding system field (such as order_id) and replace it with the variable tag {%order_id%}. This way, when a new order document is generated, the system will generate a QR code based on the actual order number and insert it into the specified location.

[0163] For the associated sub-table fields, the corresponding relationship between the content of the first record of the sub-table data and the system field is identified and replaced with a variable marker, while the association relationship of the sub-table fields is recorded:

[0164] Related child table fields typically appear when listing multiple related data records, such as a list of items in an order. These fields should be marked in the template using a specific background color (i.e., a "third default background," such as a blue background).

[0165] The system identifies the first record in the subtable and determines its correspondence with the system fields. For example, in an order template, if the first item record includes "Product Name: Product A" and "Quantity: 10," the system will identify these fields as corresponding to the product_name and quantity fields in the database, respectively, and replace them with the variable tokens {%product_name%} and {%quantity%}.

[0166] The system also records the relationships between these sub-table fields so that when generating the final document, it can correctly traverse all related sub-table records and fill them into the corresponding positions in the template one by one. For example, if an order contains multiple products, the system will traverse all product records and fill each record's information into the template according to the required format.

[0167] In some embodiments of the present application, the associated document template is called to replace all variable tags according to the field values ​​in the actual business data to generate a document, including:

[0168] For text fields, replace the variable tags with the corresponding field values ​​in the actual business data;

[0169] For the QR code / barcode field, generate the corresponding QR code or barcode image according to the variable tag and insert it into the second preset background area;

[0170] For the associated sub-table fields, all records of the sub-table data are traversed, the field value of each record is replaced with the corresponding variable marker, and inserted into the third preset background area according to the format.

[0171] As mentioned above, in a designed document template, text fields (such as customer name and order amount) are often marked with variable tags (for example, {%customer_name%}, {%total_amount%}). When the actual document is generated, the system searches for these variable tags and replaces them with the actual field values ​​obtained from the database or the current business process.

[0172] For example, in a sales invoice template, the "Customer Name" field is marked as {%customer_name%}. If the customer name in the actual business data is "Li Hua," the system will automatically replace {%customer_name%} with "Li Hua." This way, the correct customer name will appear on the generated sales invoice.

[0173] For the QR code / barcode field, generate the corresponding QR code or barcode image based on the variable tag and insert it into the second preset background area:

[0174] For fields that need to display a QR code or barcode (such as order number, product serial number, etc.), the system first checks whether the field contains a variable tag (for example, {%order_id%}).

[0175] If a variable tag is present, the system generates a QR code or barcode image based on the corresponding field value in the actual business data. For example, if the actual order number is "20250703001", the system generates a QR code image based on this number.

[0176] The system then inserts the generated QR code or barcode image into the location marked as the QR code / barcode area in the template (i.e., the "second preset background," such as the yellow background area). This way, the corresponding QR code or barcode will be correctly displayed on the final generated document.

[0177] For the associated sub-table fields, traverse all records of the sub-table data, replace the field value of each record with the corresponding variable marker, and insert it into the third preset background area according to the format:

[0178] When a document contains multiple related data records (such as a list of items in an order), these records are called related sub-table fields. In the template, these fields should be marked with a specific background color (the "third preset background," such as a blue background).

[0179] The system will traverse all records in the subtable data and extract the relevant field values ​​of each record one by one. For example, in an order template, if the order contains three items, the system will extract the name, quantity, and unit price of each of the three items.

[0180] For each record, the system locates the corresponding variable tags (such as {%product_name%} and {%quantity%}) and replaces them with the actual field values ​​for the product name, quantity, and so on. This information is then inserted into the corresponding location in the template (i.e., the blue background area) according to the pre-set formatting requirements. This way, the final invoice will fully list all product details.

[0181] In some embodiments of the present application, the auxiliary format for identifying fields in the document is removed, and the document is output after retaining the formal format, specifically:

[0182] Remove all auxiliary markings and keep only the formal format of the document;

[0183] Formal formatting includes fonts, paragraph layout, table structure, and image placement.

[0184] As mentioned above, when designing a document template, in order to help the system identify different types of fields (such as text fields, QR code / barcode fields, and related sub-table fields), specific auxiliary formats will be used for annotation. For example:

[0185] The text segment may use red font (i.e. "first default font");

[0186] QR code / barcode fields may use a yellow background (i.e., the "second default background");

[0187] Related child table fields may use a blue background (the "third preset background").

[0188] When generating the final document, the system will automatically remove these auxiliary identifications, including but not limited to specific font colors, background colors, etc. This is done to ensure that the final output document does not contain any marks used for internal system identification, making the document more professional and easy to read.

[0189] Keep only the official format of the document:

[0190] Formal formatting refers to those formatting settings that are directly related to the presentation of document content, including but not limited to the following aspects:

[0191] Fonts: All text in the document should be displayed in the preset font style, not the auxiliary font used in the design phase (such as red font). This ensures the consistency and aesthetics of the document.

[0192] Paragraph layout: including paragraph spacing, indentation, alignment, etc. These settings determine the overall layout and readability of the document.

[0193] Table structure: If the document contains a table, the system will retain the table structure and its settings such as borders and cell alignment to ensure clear presentation of data.

[0194] Image Positioning: QR codes, barcodes, or other images inserted into documents are placed in the correct location and maintain the proper size and alignment for viewing and printing.

[0195] Font Handling: The system will restore all text fields using secondary fonts (such as red) to the default or pre-set standard font style. For example, a "Customer Name" field originally marked in red will be displayed in standard black font in the final output document.

[0196] Background Processing: All areas using a specific background color (such as yellow or blue) will be restored to white or another specified background color. For example, the yellow background of a QR code / barcode field will be removed, allowing the QR code or barcode image to be displayed directly on the normal document background.

[0197] Table and image processing: The system checks and adjusts table layouts to ensure that the contents of each cell are correctly aligned and overlap-free. Meanwhile, QR codes or barcode images are precisely placed where they should be, ensuring they are clearly visible and do not affect the display of other content.

[0198] In some embodiments of the present application, the following further includes: dynamically updating the template, specifically:

[0199] When business requirements change, users modify the identification rules or field contents of the document template and resubmit the sample data;

[0200] Re-identify the updated fields and generate variable tags to re-associate the updated document template with the target business function.

[0201] As mentioned above, during actual operations, the business needs of an enterprise may change, such as adding or adjusting certain fields, changing field names or formats, etc. In this case, users can adapt to these changes by modifying the document template in the Word document.

[0202] Modify identification rules: If you need to change the identification method of a field type (such as changing a text field from red font to blue font), users can make corresponding adjustments directly in the Word document.

[0203] Modify field content: If the content of some fields has changed (such as adding new fields or changing the names of existing fields), users can add or modify these fields in the template and re-fill the sample data according to the latest business needs.

[0204] Resubmit sample data: Once the template is modified, the user needs to resubmit the sample data containing the latest business data. This step ensures that the system can generate accurate variable tags based on the latest template and data.

[0205] Re-identify the updated fields to generate variable tags:

[0206] The system will automatically reprocess the updated document template and identify new fields and their corresponding relationships through natural language processing and image recognition technology.

[0207] For text fields, the system will recognize the new field content and replace it with the corresponding variable tag (such as {% new_field%}).

[0208] For QR / barcode fields, the system checks for new QR or barcode content and generates or updates the variable tag accordingly.

[0209] For related child table fields, the system traverses the updated child table records, identifies the field value of each record, and replaces it with the corresponding variable marker.

[0210] Reassociate the updated document template with the target business function:

[0211] Once the new template's field identification and variable tag generation are complete, the system needs to re-associate the updated document template with the corresponding business function module. This means:

[0212] If changes in business requirements affect a specific functional module (such as order management, inventory management, etc.), the system will ensure that the module uses the latest document template.

[0213] For example, in an order management system, if a new field is added to record special discount information, the system will automatically call the updated template when generating a new order and correctly fill in the information in the field.

[0214] By re-association, the system ensures that all relevant business operations can use the latest document template, thus avoiding data errors or omissions caused by template mismatch.

[0215] In some embodiments of the present application, the following is also included: exception handling, specifically:

[0216] When identifying fields, if multiple fields are detected to correspond to the same content, the user will be prompted to manually confirm the correction;

[0217] Before generating the document, check whether all variable tags are replaced correctly. If there are any unreplaced variable tags, the generation process will be terminated and an error message will be prompted.

[0218] As mentioned above, when using natural language processing and image recognition technology to identify fields in templates, the system may encounter a situation where multiple different fields are identified as the same system field. For example, in an order template, the "Customer Address" and "Shipping Address" fields may both be identified as the same database field, "address."

[0219] When this happens, the system automatically detects the conflict and prompts the user to manually confirm and correct it. The prompt information can include the specific field name, location, and suggested solution.

[0220] For example, the system may pop up a dialog box that says: "Both 'Customer Address' and 'Shipping Address' are detected as 'address' fields. Please check and select the correct mapping relationship."

[0221] Users can manually adjust the field mapping relationship based on actual business needs to ensure that each field can correctly match the corresponding field in the system.

[0222] Before generating the document, verify that all variable tags are correctly replaced. If there are any unreplaced variable tags, the generation process will be terminated and an error message will be prompted:

[0223] Before generating the final document, the system will conduct a comprehensive check on all variable tags in the template to ensure that each variable tag has been correctly replaced with the field value in the actual business data.

[0224] The verification process includes the following aspects:

[0225] Check all variable tags: The system will traverse the entire document and find all defined variable tags (such as {% customer_name%}, {% order_id%}, etc.).

[0226] Verify replacement results: For each variable tag, the system checks whether it has been replaced with the corresponding actual data value. If a variable tag is not replaced (that is, it remains as it is), there may be missing data or field mapping errors.

[0227] If any unreplaced variable tags are found during the verification process, the system will immediately terminate the generation process and issue an error prompt to the user. The prompt should clearly indicate which variable tags are not replaced so that the user can quickly locate and resolve the problem.

[0228] For example, the system might display an error message: "Failed to generate document: Variable token {%customer_name%} was not replaced, please check the data source or field mapping settings."

[0229] Through the above exception handling mechanism, the system can effectively prevent and resolve potential problems during the process of identifying fields and generating documents, ensuring that the generated documents are accurate. Specifically:

[0230] Handling of multiple fields corresponding to the same content: When the system detects that multiple fields are mapped to the same system field, it will prompt the user to manually confirm and correct them to avoid data confusion or errors.

[0231] Variable tag replacement verification: Before generating a document, the system thoroughly verifies all variable tags to ensure that each tag is correctly replaced with actual business data. If any issues are found, the system will promptly terminate the process and provide detailed error information to help users quickly fix the problem.

[0232] An embodiment of a second aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of the embodiments of the first aspect when executing the program.

[0233] Figure 2 An example of a physical structure diagram of an electronic device is shown below. Figure 2 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the method in any embodiment of the first aspect above, the method including:

[0234] Design a document template using a Word document and mark the field types according to the preset identification rules. Field types include text fields, QR code / barcode fields, and associated sub-table fields.

[0235] Fill in sample data for all fields in the document template based on business data;

[0236] Through natural language processing and image recognition technology, the corresponding system fields of each field in the sample data are identified, and the fields are replaced with variable tags to generate reusable document templates;

[0237] Associate reusable document templates with target business functions;

[0238] Call the associated document template, replace all variable tags according to the field values ​​in the actual business data, and generate the document. The QR code / barcode field generates the corresponding QR code or barcode image based on the actual content, and the associated sub-table field is cyclically populated with all records based on the sub-table data.

[0239] Remove the auxiliary formatting used to identify fields in the document and output the document in the official format.

[0240] Furthermore, the logic instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as standalone products, stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for causing a computer device (such as a personal computer, server, or network device) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memories, random access memories, magnetic disks, or optical disks.

[0241] On the other hand, the present invention further provides a computer program product, comprising a computer program. The computer program may be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the method provided by each of the above methods, including:

[0242] Design a document template using a Word document and mark the field types according to the preset identification rules. Field types include text fields, QR code / barcode fields, and associated sub-table fields.

[0243] Fill in sample data for all fields in the document template based on business data;

[0244] Through natural language processing and image recognition technology, the corresponding system fields of each field in the sample data are identified, and the fields are replaced with variable tags to generate reusable document templates;

[0245] Associate reusable document templates with target business functions;

[0246] Call the associated document template, replace all variable tags according to the field values ​​in the actual business data, and generate the document. The QR code / barcode field generates the corresponding QR code or barcode image based on the actual content, and the associated sub-table field is cyclically populated with all records based on the sub-table data.

[0247] Remove the auxiliary formatting used to identify fields in the document and output the document in the official format.

[0248] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for cigarette box image recognition provided by the above methods is implemented, and the method includes:

[0249] Design a document template using a Word document and mark the field types according to the preset identification rules. Field types include text fields, QR code / barcode fields, and associated sub-table fields.

[0250] Fill in sample data for all fields in the document template based on business data;

[0251] Through natural language processing and image recognition technology, the corresponding system fields of each field in the sample data are identified, and the fields are replaced with variable tags to generate reusable document templates;

[0252] Associate reusable document templates with target business functions;

[0253] Call the associated document template, replace all variable tags according to the field values ​​in the actual business data, and generate the document. The QR code / barcode field generates the corresponding QR code or barcode image based on the actual content, and the associated sub-table field is cyclically populated with all records based on the sub-table data.

[0254] Remove the auxiliary formatting used to identify fields in the document and output the document in the official format.

[0255] Anything not described in this application can be achieved by adopting or drawing on existing technologies.

[0256] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

[0257] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A method for automatically generating documents based on document recognition, characterized in that: include: Design a document template using a Word document and mark the field types according to the preset identification rules. Field types include text fields, QR code / barcode fields, and associated sub-table fields. Fill in sample data for all fields in the document template based on business data; Through natural language processing and image recognition technology, we identify the system fields corresponding to each field in the sample data, replace the fields with variable tags, and generate a reusable document template, specifically: For text fields, natural language processing is used to identify the correspondence between the content in the sample data and the system fields, and the content is replaced with variable tags. For the QR code / barcode field, if the sample data is empty, the second preset background area is retained as the QR code / barcode placeholder; if the sample data is actual content, it is replaced with a variable marker; For the associated sub-table fields, the corresponding relationship between the content of the first record of the sub-table data and the system field is identified and replaced with a variable tag, and the associated relationship of the sub-table fields is recorded at the same time; Associate reusable document templates with target business functions; Call the associated document template, replace all variable tags according to the field values ​​in the actual business data, and generate the document. The QR code / barcode field generates the corresponding QR code or barcode image based on the actual content, and the associated sub-table field is cyclically populated with all records based on the sub-table data. Remove the auxiliary formatting used to identify fields in the document and output the document in the official format.

2. The method according to claim 1, characterized in that The preset identification rules are specifically: The text segment is marked with a first preset font; The QR code / barcode field is marked with a second preset background; The associated sub-table fields are marked with the third preset background; The text fields in the sample data are marked with a first preset font.

3. The method according to claim 1, characterized in that The sample data for filling in all fields in the document template based on business data includes: If the sample data for the QR code / barcode field is empty, the default system field contains the QR code or barcode data; If the sample data of the QR code / barcode field is actual content, the system field corresponding to the actual content is identified and replaced with a variable tag.

4. The method according to claim 1, wherein The associated document template is called to replace all variable tags according to the field values ​​in the actual business data to generate a document, including: For text fields, replace the variable tags with the corresponding field values ​​in the actual business data; For the QR code / barcode field, generate the corresponding QR code or barcode image according to the variable tag and insert it into the second preset background area; For the associated sub-table fields, all records of the sub-table data are traversed, the field value of each record is replaced with the corresponding variable marker, and inserted into the third preset background area according to the format.

5. The method according to claim 1, wherein The auxiliary format used to identify the fields in the document is removed, and the document is output after retaining the formal format. Specifically: Remove all auxiliary markings and keep only the formal format of the document; Formal formatting includes fonts, paragraph layout, table structure, and image placement.

6. The method according to claim 1, wherein Also includes: Dynamic update templates, specifically: When business requirements change, users modify the identification rules or field contents of the document template and resubmit the sample data; Re-identify the updated fields and generate variable tags to re-associate the updated document template with the target business function.

7. The method according to claim 1, characterized in that Also includes: Exception handling, specifically: When identifying fields, if multiple fields are detected to correspond to the same content, the user will be prompted to manually confirm the correction; Before generating the document, check whether all variable tags are replaced correctly. If there are any unreplaced variable tags, the generation process will be terminated and an error message will be prompted.

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

9. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps in the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Format document generation method and device, equipment and storage medium

    CN112183036A

  • Method and device for generating reimbursement document, and medium

    CN119005158A