Delivery document processing method, tool and system
By automatically processing document formats by preset template files, the problem of inefficient and error-prone document format modification in project delivery is solved, the standardization and consistency of document formats are achieved, and the efficiency and quality of project delivery is improved.
Patent Information
- Application Number
- CN202510558352.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-01
AI Technical Summary
During the project delivery process, document format modification is inefficient and error-prone, making it difficult to meet the diversified requirements of different customers and supervision units, resulting in high manual operation costs and inconsistent formats.
Provide a delivery document processing method, which automatically recognizes and modifys paragraphs, titles, charts and other formats through preset template files, including style definition modules, document processing modules, label processing modules and chart processing modules, to realize automated and standardized document format modification.
It improves the efficiency and quality of document format modification, reduces the workload and probability of errors in manual operations, ensures the consistency and standardization of document formats, and shortens the project delivery cycle.
Smart Images

Figure CN120409422A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and specifically relates to a method, tool, and system for processing delivery documents. Background Art
[0002] In today's complex and diverse project delivery field, as an important carrier of project results, the format standardization of documents directly affects the quality of project delivery and customer satisfaction. During the actual project delivery process, customers or supervision units often request modifications to the format of delivery documents for purposes such as their own management needs, compliance with industry standards, or facilitation of document archiving and retrieval. However, due to differences in their own business characteristics, management concepts, and usage habits, different customers have widely varying requirements for document formats; different supervision units also have their own unique considerations for document formats due to the different industry norms and acceptance standards they follow. This inconsistency in requirements makes it difficult to find a universal standard template for delivery document formats.
[0003] For complex system projects, the number of documents involved in the delivery process is extremely large. From the feasibility study report and requirements analysis document in the project planning stage, to the technical solution document and design drawings in the design and development stage, and then to the test report and acceptance document in the test and acceptance stage, etc., it covers the entire life cycle of the project. These documents are not only numerous in quantity, but also complex in content, involving a large amount of information such as professional terms, technical parameters, and business processes, and the number of pages is often hundreds or thousands.
[0004] Under such a large document scale and complex format requirements, relying solely on manual efforts to modify document formats is undoubtedly a difficult and inefficient task. Manual operations not only require a large amount of human, material, and time costs, but also are extremely prone to omissions and errors due to human interference. For example, when modifying the title format, it may result in inconsistent font, size, color, etc. of the title due to operational errors; when adjusting the position and title of charts, some charts may be omitted or the title may not correspond to the chart. These errors not only affect the overall quality of the document, but may also bring unnecessary troubles and risks to project delivery. Summary of the Invention
[0005] In order to achieve automated and standardized modification of delivery document formats, thereby effectively improving the efficiency and quality of document format modification, reducing labor costs and error risks, the present invention provides a method, tool, and system for processing delivery documents.
[0006] In a first aspect, the technical solution of the present invention provides a method for processing delivery documents, including the following steps: S1. Preset a template file, and extract and record paragraph styles, title styles, chart title styles, and in-table font styles therefrom; S2. Copy the template file and clear its content to be the output document; S3. Traverse all paragraphs in the document to be processed, and determine whether the paragraph format is a special paragraph format. The special paragraphs include headings and chart paragraphs; If so, execute the steps for processing the special paragraph format; after the special paragraph processing is completed, execute S4; If not, execute S4. S4. Modify the paragraphs in the document to be processed to the corresponding format according to the styles defined in the template file and write them into the output document; S5. Export the output document after the traversal ends; After all paragraph format modifications and special paragraph processing are completed, export the output document in a timely manner, enabling the user to quickly obtain the final document with format modifications. This operation process is simple and efficient. The user does not need to perform cumbersome subsequent processing and can directly use the delivery document that meets the requirements, effectively shortening the project delivery cycle, improving work efficiency, and meeting the needs of customers or supervision units for timely modification and delivery of document formats.
[0007] Among them, in S3, the steps for processing the special paragraph format include: S331. Identify the heading and process the label before the heading; S332. Identify the chart title and generate or correct the chart title at the specified position in the chart according to the configuration.
[0008] S333. Copy the chart to the output document and adjust the font style in the table according to the format defined in the template file; This method for processing the delivery document effectively solves the problems of low efficiency and error-proneness in manually modifying the format of the delivery document through a series of automated steps, and realizes the automated and standardized modification of the format of the delivery document.
[0009] As a further limitation of the technical solution of the present invention, before the step of copying the template file and clearing its content to be the output document, it includes: Receiving the configuration information input by the user, including: Configuring to skip the cover, title page, table of contents, and appendix; Configuring the maximum level of the main heading; Configuring the position of the chart title.
[0010] Receiving the configuration information input by the user increases the flexibility of document processing. It is possible to select to skip specific parts, such as the cover and title page, according to different document requirements, to meet diverse document processing scenarios. Setting the maximum level of the main heading and the position of the chart title further refines the format adjustment, making the processing result more in line with the user's expectations.
[0011] As a further limitation of the technical solution of the present invention, in S3, when traversing all paragraphs in the document to be processed, the cover, title page, table of contents, and appendix are skipped according to the configuration information; The steps of determining whether the paragraph format is a special paragraph format include: Check if the paragraph has a title attribute or contains a title number; Check whether the paragraph is a chart-related paragraph; Checks whether a paragraph is inside a table.
[0012] The specific process for traversing paragraphs and handling special paragraph formats has been clarified to ensure orderly document processing. Specific sections can be skipped based on configuration, avoiding unnecessary processing and improving processing efficiency. Accurately determine paragraph formats and allocate processing paths appropriately to ensure both special and standard paragraphs are processed correctly.
[0013] As a further limitation of the technical solution of the present invention, in S331, the step of identifying the title and processing the number before the title includes: S3311. Distinguish between main titles and secondary titles based on the preset maximum level of main titles; S3312. Delete the label of the title paragraph; S3313. Generate a new label according to the label format definition and add it to the beginning of the title paragraph.
[0014] Clearly defines the steps for processing title numbers, distinguishing between primary and secondary titles, and making the document title hierarchy clearer. Deleting and re-adding built-in titles ensures consistency and standardization, facilitating table of contents generation and structured reading.
[0015] As a further limitation of the technical solution of the present invention, S3313 includes: When each level of title has an independent numbering format, the numbering format defined in the title is used first. If there is no definition, the general format is used. If the general format is empty, the general number is not used. Before writing the title, delete the number of the title paragraph and add a number according to the format and the auto-increment queue.
[0016] Detailed description of the priority rules for number generation to accommodate a variety of document numbering needs. Flexibly utilize independent numbering formats, common formats, or use no common format when no common format is available, to meet diverse document layout requirements and enhance document professionalism and standardization.
[0017] As a further limitation of the technical solution of the present invention, S3313 specifically includes: S33131. Collect the title label formats at all levels and initialize a multi-level label list, where each level corresponds to a title level and the initial value is 1; S33132. Update the label list according to the title level: If the current title level already exists in the label list, increment the label value of this level by 1 and reset the labels of all lower levels to 1; If the current title level does not exist in the label list, add a new level at the end of the label list and set its value to 1; S33133. Convert the label list into a string-form label according to the preset label format and separator; S33134. Add the generated label to the beginning of the title paragraph.
[0018] A complete label generation algorithm is provided. From initializing the label list to updating the list according to the title level, and then converting it into a string form and adding it to the title, the logic is rigorous. It can ensure accurate increment of the title labels, clear hierarchical relationships, and improve the structuring and readability of the document.
[0019] As a further limitation of the technical solution of the present invention, in S332, the steps of identifying the chart title and generating or correcting the chart title at the specified position of the chart according to the configuration include: S3321. Traverse all paragraphs of the document. When a chart paragraph is found, obtain the upper and lower paragraphs adjacent to the chart; S3322. Determine whether there is exactly one paragraph among the upper and lower paragraphs adjacent to the chart that meets the chart title condition; If not, execute S3323; if so, execute S3324; S3323. Generate an empty chart title according to the configuration and issue an alarm; execute S3325; S3324. Generate a chart title according to the chart title format and the chart serial number; S3325. Write the generated chart title to the corresponding position according to the configuration.
[0020] The identification and processing process of the chart title is standardized. By judging the adjacent paragraphs to determine the chart title, an empty title is generated and an alarm is issued when there is no appropriate title or the title is abnormal, ensuring that each chart has a corresponding title and enhancing the integrity and logic of the document content.
[0021] In a second aspect, the technical solution of the present invention also provides a delivery document processing tool, including a style definition module, a document processing module, a label processing module, and a chart processing module; The style definition module is used to preset and record various styles in the template file; The document processing module is used to copy the template file and clear the content as the output document, and traverse the document to be processed and modify the paragraph format; The label processing module is used to process the label before the title, including deleting the original label and generating a new label; A chart processing module for identifying chart titles and adjusting chart formats.
[0022] The delivery document processing function is modularized. The style definition module is responsible for basic style settings, the document processing module focuses on the overall document processing, the label processing module and the chart processing module each perform their own functions, improving the maintainability and scalability of the system and facilitating the optimization and upgrade of subsequent functions.
[0023] As a further limitation of the technical solution of the present invention, the label processing module includes a label initialization unit and a label generation unit; A label initialization unit for initializing the label list and label format; A label generation unit for generating labels according to the title level and incrementing the serial number.
[0024] As a further limitation of the technical solution of the present invention, the chart processing module includes a title recognition unit and a title generation unit; A title recognition unit for determining whether the chart title conforms to a preset rule; A title generation unit for generating an empty chart title when a title that conforms to the rule is not found.
[0025] In a third aspect, the technical solution of the present invention further provides a delivery document processing system, including: A user interface for receiving user configuration parameters; The delivery document processing tool as described in the first aspect; An interaction control component for starting a worker thread after the configuration is completed on the user interface and calling the processing tool with the configured content as a parameter to process the document according to the configuration parameters; An output module for generating a formatted output document.
[0026] A complete delivery document processing system is constructed. The user interface receives configuration parameters, the interaction control component coordinates the work, the delivery document processing tool executes the processing task, and the output module generates the result. Each part works together to achieve the automation and high efficiency of document processing.
[0027] As a further limitation of the technical solution of the present invention, the user interface provides: A graphical parameter configuration interface or a command-line parameter input interface; Preset parameters for general rules of industry delivery documents.
[0028] The user interface provides multiple parameter input methods, which is convenient for users with different usage habits. Presetting the general rule parameters of industry delivery documents reduces the user's usage threshold, makes the system ready to use out of the box, and improves the efficiency and convenience of users in processing documents.
[0029] As can be seen from the above technical solutions, the present application has the following advantages: It realizes the configuration of only the title paragraph format of a single document, and automates the modification of the formats of a large number of other documents through an automated process. It reduces the mechanical repetitive labor of modifying document formats during project delivery. To a certain extent, it can check the problematic points in the document and correct some of the problems therein, such as: the chart lacks a title, the picture is referenced by a local path, the title serial number is incorrect, the chart serial number is incorrect, etc. It also provides a user-friendly interaction interface, and all parameters are preset according to the general rules of industry-delivered documents, so as to ensure flexibility in function while guaranteeing that the invention is ready-to-use and easy to use. Description of the Drawings
[0030] To more clearly illustrate the technical solutions of the present application, the drawings required for the description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0031] Figure 1 It is a flowchart of the method provided by an embodiment of the present invention.
[0032] Figure 2 It is a flowchart of the method provided by another embodiment of the present invention.
[0033] Figure 3 It is a flowchart of the processing of the label before the title in the embodiment of the present invention.
[0034] Figure 4 It is a logic diagram of the processing of the chart title in the embodiment of the present invention.
[0035] Figure 5 It is a block diagram of the delivery document processing tool provided by the embodiment of the present invention.
[0036] Figure 6 It is a block diagram of the system provided by the embodiment of the present invention. Detailed Embodiments
[0037] During the project delivery process, it is sometimes encountered that customers or supervision units require the modification of the delivery document format for easier management. Different customers and supervision units may have different requirements for the document format. Moreover, for a complex system, there are a large number of documents, a large amount of content, and a large number of pages involved in the delivery process. Relying solely on manual modification is time-consuming and laborious, and it is also prone to omissions. Therefore, an automated tool is needed to achieve the automated modification of the delivery document format. It can be defined once and reused. To make the application purpose, features, and advantages of this application more obvious and understandable, the following will use specific embodiments and drawings to clearly and completely describe the technical solutions protected by this application. Obviously, the embodiments described below are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the scope of protection of this application.
[0038] As Figure 1 shown, an embodiment of the present invention provides a method for processing delivery documents, including the following steps: S1. Preset a template file, and extract and record the paragraph style, title style, chart title style, and in-table font style from it; By presetting the template file and extracting and recording the paragraph style, title style, chart title style, and in-table font style, it provides a unified and standard format basis for subsequent document format modification. When actually processing the to-be-processed documents from different sources, it can ensure that all documents finally follow the unified format specifications, avoiding the problem of inconsistent formats caused by differences in manual operations, greatly improving the consistency and standardization of the document format, and at the same time laying a solid foundation for subsequent automated processing.
[0039] S2. Copy the template file and clear the content as the output document; This operation method cleverly utilizes the format framework predefined by the template file. While ensuring the standardization and unity of the output document format, it does not need to construct the document format from scratch, effectively saving time and effort. Moreover, the output document after clearing the content is like a "blank template", which can conveniently receive the content of the to-be-processed document after format modification, ensuring that the finally output document not only meets the format requirements but also completely contains all the valid information of the to-be-processed document.
[0040] S3. Traverse all paragraphs in the to-be-processed document, determine whether the paragraph format is a special paragraph format. If so, execute the steps for processing the special paragraph format; after the special paragraph processing is completed, execute S4; if not, execute S4; The steps for executing the processing of the special paragraph format are as follows: S331. Identify the title and process the label before the title; During the document processing, the titles and their labels are crucial for the structural clarity and readability of the document. By automatically identifying the titles and processing the labels before the titles, it can ensure that all titles in the output document present a unified format and numbering rule. This not only makes the document structure clearer, facilitating readers to quickly locate and understand the document content, but also avoids problems such as chaotic title formats and numbering errors that may occur during manual processing, improving the quality and professionalism of the document.
[0041] S332. Identify the chart title and generate or correct the chart title at the specified position in the chart according to the configuration.
[0042] Charts are usually used in documents to visually display data or information, and the accuracy and standardization of the chart titles directly affect readers' understanding of the chart content. This method can automatically identify the chart titles and generate or correct the titles at the specified positions according to the configuration, ensuring that the positions, formats, and contents of all chart titles meet the standard requirements. This not only improves the standardization and aesthetics of the chart part in the document, but also enhances the information transmission effect of the document, enabling readers to more easily obtain the key information expressed by the charts.
[0043] S333. Copy the chart to the output document and adjust the font style in the table according to the format defined in the template file; Copy the chart completely to the output document and adjust the font style in the table according to the format defined in the template file, ensuring the integrity and format consistency of the chart in the output document. This operation avoids the situation of missing content or format disorder during the transfer of the chart, and at the same time makes the text information in the chart match the overall format of the document, further improving the overall quality and aesthetics of the document, and enhancing the professionalism and readability of the document.
[0044] S4. Modify the paragraphs in the document to be processed to the corresponding format according to the style defined in the template file and write them into the output document; Modify the formats of the paragraphs in the document to be processed according to the style defined in the template file and write them into the output document, realizing the automatic unified modification of the document format. This method greatly improves the efficiency of document format modification, reduces the workload and error probability of manual operations. Whether facing a large number of documents or complex format requirements, it can quickly and accurately complete the format modification task, ensuring that all output documents meet the predetermined format standards, providing high-quality document support for project delivery.
[0045] S5. Export the output document after the traversal ends; After completing all paragraph formatting modifications and special paragraph processing, promptly export the output document so that users can quickly obtain the final document with modified formatting. This operation process is simple and efficient. Users no longer need to perform cumbersome subsequent processing and can directly use the delivery document that meets the requirements, effectively shortening the project delivery cycle, improving work efficiency, and meeting the needs of customers or supervision units for timely modification and delivery of document formats.
[0046] This method for processing delivery documents effectively solves problems such as low efficiency and error-proneness that exist when manually modifying the formats of delivery documents through a series of automated steps, and realizes automated and standardized modification of the formats of delivery documents.
[0047] In some embodiments, before the step of copying the template file and clearing the content as the output document, it includes: receiving configuration information input by the user, including: a Skipping the configuration of the cover, title page, table of contents, and appendix; It should be noted that in different project delivery documents, the formats and contents of the cover, title page, table of contents, and appendix are often relatively fixed and quite different from the format of the main text, and some customers may not require format modification of these parts. By receiving the configuration input by the user to skip these parts, the scope of document processing can be flexibly controlled, unnecessary format modification operations on these fixed parts can be avoided, the processing efficiency is improved, and at the same time, the risk of damaging the formats of these parts due to misoperation is reduced, ensuring that the final output document meets the actual needs of users.
[0048] b Configuration of the maximum level of the main title; There are various levels of titles in the document, and different projects or users may have different focuses and processing requirements for the title levels. Receiving the configuration of the maximum level of the main title enables users to define which levels of titles need to be focused on and which levels of titles can be simplified or not specially processed according to actual needs. This function enhances the flexibility and adaptability of the method, can meet the personalized needs of different users for title format processing, and improves the pertinence and effectiveness of document format processing.
[0049] c Configuration of the position of the chart title.
[0050] The position of the chart title has an important impact on the readability and professionalism of the document. Different industries and users may have different habits and requirements for the position of the chart title. By receiving the configuration of the position of the chart title, users can flexibly set the display position of the chart title around the chart according to their own needs or industry standards, ensure that the chart title is closely combined with the chart content and the position is reasonable, improve the readability and aesthetics of the chart part in the document, and enhance the professionalism and standardization of the document.
[0051] In some embodiments, such asFigure 2 As shown, when traversing all paragraphs in the document to be processed, the cover, title page, table of contents, and appendix are skipped according to the configuration information; Special paragraph formats include the following three categories: Title paragraph (with title attribute); Figure title paragraph (descriptive text associated with the figure); Paragraphs within tables (requiring special formatting adjustments); (1) Judgment conditions for title paragraphs Attribute detection: Checks whether the paragraph has the Heading style attribute (such as Heading 1 to Heading 5 in Word). If the original document does not clearly define the heading level, the following rules are used to assist in the judgment: the paragraph font is significantly larger than the main text (such as font size ≥ 14pt); the paragraph is centered or bold; the paragraph content is short (such as ≤ 20 words) and does not contain punctuation.
[0052] Number detection: whether the beginning of the paragraph contains a number (such as 1.1, one, (A) and other preset formats).
[0053] (2) Judgment conditions for chart title paragraphs Position detection: Above or below the chart (≤ 1 line from the chart).
[0054] Content detection: Starts with keywords such as "图", "表", "Figure", "Table", etc.; the number of words is less than the threshold (such as ≤20 words); may contain serial numbers (such as " Figure 1-1 ” “Table 2.3”).
[0055] Exception handling: If there is no matching paragraph near the chart, it is judged as "missing title", an empty title is automatically generated and a warning is issued; if multiple candidate paragraphs are detected, it is judged as "conflicting title", processed as the main text and a warning is issued.
[0056] (3) Judgment conditions for paragraphs in a table Property detection: The paragraph is located in a table cell; the font, alignment, etc. need to be adjusted synchronously (according to the table style defined in the template file).
[0057] It should be noted that when traversing the document to be processed in S31, non-text sections such as the cover, title page, table of contents, and appendix are automatically skipped based on the configuration information, and the main text content is processed directly, avoiding wasting processing resources and time on these fixed sections. This not only improves the efficiency of document formatting, but also ensures that the processing process focuses on the key content of the main text, making the final output document format more consistent with the user's modification requirements for the main text, while also avoiding formatting issues such as confusion caused by misprocessing these sections.
[0058] Documents contain a variety of paragraph formats, and different paragraph formats require different processing methods. Accurately determining whether a paragraph format is a special paragraph format through S32 enables refined processing of document content. For special paragraph formats, specialized processing steps can be performed to ensure that the format meets the requirements; for ordinary paragraph formats, they are processed according to unified rules. This differentiated processing method improves the accuracy and professionalism of document format processing and avoids formatting errors or incomplete processing caused by applying a unified processing method to all paragraphs.
[0059] Depending on whether a paragraph format is special, different processing steps are executed, making the entire document formatting process clearer and more efficient. Special paragraph formats are processed in a dedicated process to ensure their formatting is carefully adjusted; standard paragraph formats are quickly modified and written to the output document, improving overall processing efficiency. This process branching design based on the judgment result enables the method to flexibly handle paragraphs of different formats, ensuring the quality and efficiency of document formatting.
[0060] In some embodiments, in S331, the step of identifying the title and processing the number before the title includes: S3311. Distinguish between main titles and secondary titles based on the preset maximum level of main titles; In a document, primary and secondary headings play different roles within the document structure, and their formatting requirements and handling may differ. Distinguishing primary and secondary headings by presetting a maximum level for primary headings clarifies the focus and rules for handling headings at different levels. For example, primary headings may require more prominent formatting to emphasize the document's hierarchical structure, while secondary headings can be formatted more simply. This differentiated handling helps improve document structure clarity and readability, allowing readers to more quickly understand the document's logical framework.
[0061] S3312. Delete the label of the title paragraph; The numbers that come with title paragraphs may be inconsistent or non-standard, or conflict with subsequently generated numbers. Deleting the numbers that come with title paragraphs prepares you for the generation of new, standardized numbers. This ensures consistent and standardized numbering across all headings in the document, avoiding confusing numbering that can affect the document's overall aesthetics and professionalism. This also facilitates the unified management and adjustment of numbers later on.
[0062] S3313. Generate a new label according to the label format definition and add it to the beginning of the title paragraph.
[0063] New labels are generated according to predefined numbering formats and added to the beginning of title paragraphs, achieving automated and standardized title numbering. This ensures that all title labels follow uniform formatting rules, improving document format consistency and standardization while also reducing errors and omissions that can occur when manually adding labels. Furthermore, automatically generated labels accurately number the document's title hierarchy, providing a clearer document hierarchy.
[0064] It should be further explained that S3313 includes: when an independent label format is set for each level of title, the label format defined in the title is used first. If there is no definition, the general format is used. If the general format is empty, the general label is not used. Before writing the title, the label of the title paragraph is deleted and the label is added according to the format and the self-increment queue.
[0065] In an embodiment of the present invention, the numbering format defined by the title is used first. When an independent numbering format is set for each level of title, the numbering format defined by the title is used first, which fully considers the special formatting requirements of titles at different levels. Titles at different levels may differ in importance, display mode, etc. By allowing independent formats to be set for each level of title, the hierarchical structure and key content of the document can be better reflected. For example, the first-level title can be highlighted using larger fonts, special colors, and other formats, while the second-level title can be relatively weakened in format. This personalized setting improves the flexibility and expressiveness of the document format, making the document more in line with the actual needs and aesthetic requirements of users.
[0066] When a specific heading level doesn't have a unique numbering format defined, a universal format is used as a supplement to ensure that all headings have the appropriate numbering format. This universal format provides a basic, unified formatting standard for headings within a document, avoiding formatting gaps or inconsistencies caused by undefined formats for some headings. This design enhances the robustness and compatibility of the method, enabling it to adapt to the diverse heading formatting definitions of different users and ensuring the integrity and standardization of document formatting.
[0067] If the general format is empty, no general number is used. Before writing the title, the existing number of the title paragraph is deleted and a number is added according to the format and the auto-increment queue. If the general format is empty, no general number is used, further demonstrating the flexibility of the method. In this case, only the existing number of the title paragraph is deleted and a number is added according to the preset format and the auto-increment queue. This avoids unnecessary number display while ensuring the correct generation and addition of title numbers. The auto-increment queue ensures the continuity and uniqueness of the title numbers, arranging them in an orderly manner within the document, making them easier for readers to read and find, while also improving the automation and accuracy of document formatting.
[0068] In some embodiments, such asFigure 3 As shown, S3313 specifically includes: S33131. Collect the numbering formats of headings at all levels and initialize a multi-level numbering list, where each level corresponds to a heading level and the initial value of each is 1; S33132. Update the numbering list according to the heading level: If the current heading level already exists in the numbering list, increment the numbering value of this level by 1 and reset the numbering of all lower levels to 1; If the current heading level does not exist in the numbering list, add a new level at the end of the numbering list and set its value to 1; S33133. Convert the numbering list into a numbered label in string form according to the preset numbering format and separator; S33134. Add the generated numbered label to the beginning of the title paragraph.
[0069] Collecting the numbering formats of headings at all levels and initializing a multi-level numbering list provides a data basis for the generation and management of subsequent heading numberings. The multi-level numbering list corresponds to the hierarchical structure of the headings, with each level corresponding to a heading level and the initial value of each being 1, clearly reflecting the hierarchical relationship of the document headings. In this way, it is convenient to uniformly manage and operate the numberings of headings at all levels, ensuring the accuracy and orderliness of the numbered label generation, and also facilitating the subsequent dynamic adjustment of the numbered label according to the change of the heading level.
[0070] The rule of updating the numbering list according to the heading level ensures that the heading numbered label can be correctly updated as the heading level changes. When the current heading level already exists in the numbering list, increment the numbering value of this level by 1 and reset the numbering of all lower levels to 1, ensuring the continuity of the numbered labels of the same-level headings and the correct distinction of the numbered labels of different-level headings; when the current heading level does not exist in the numbering list, add a new level at the end of the numbering list and set its value to 1, realizing the correct initialization of the numbered label of the new-level heading. This mechanism of dynamically updating the numbering list enables the heading numbered label to accurately reflect the hierarchical structure of the document and improves the intelligence level of document format processing.
[0071] Converting the numbering list into a numbered label in string form enables the heading numbered label to be displayed in the document in an intuitive and readable manner. The preset numbering format and separator ensure the uniformity and standardization of the numbered label string, meeting the user's reading habits and document format requirements. For example, by using a dot (.) as the separator, the multi-level heading numbered labels can be clearly separated, enabling readers to easily identify the hierarchical relationship of the headings. This conversion process improves the practicality and aesthetics of document format processing and enhances the readability of the document.
[0072] The generated label is accurately added to the beginning of the title paragraph, completing the final setting of the title label. This operation ensures the close combination of the title label and the title content, making the hierarchical structure of the document clearer. When readers read the document, they can quickly understand the logical framework and content organization of the document through the title label, improving the reading efficiency and the accuracy of information acquisition. At the same time, it also ensures the consistency and standardization of the document format, enhancing the overall quality of the document.
[0073] In some embodiments, such as Figure 4 shown, in S332, the steps of identifying the chart title and generating or correcting the chart title at the specified position of the chart according to the configuration include: S3321. Traverse all paragraphs of the document. When a chart paragraph is found, obtain the upper and lower paragraphs adjacent to the chart; in this step, by traversing all paragraphs of the document and obtaining the upper and lower paragraphs adjacent to the chart, key information is provided for accurately identifying the chart title. There are often semantic associations between the chart and its adjacent upper and lower paragraphs, which may contain relevant content of the chart title. Obtaining this paragraph information helps to more comprehensively analyze the text environment where the chart is located, improve the accuracy of chart title identification, and avoid missing or misjudging the chart title due to only focusing on the chart itself.
[0074] S3322. Determine whether there is exactly one paragraph among the upper and lower paragraphs adjacent to the chart that meets the chart title condition; If not, execute S3323; if so, execute S3324; Determining whether there is exactly one paragraph among the upper and lower paragraphs adjacent to the chart that meets the chart title condition can accurately identify the valid chart title. In an actual document, there may be multiple paragraphs associated with the chart, but only the paragraphs that meet specific conditions are the real chart titles. Through this judgment step, irrelevant paragraph information can be filtered out, ensuring that the identified chart title is accurate and providing a reliable basis for subsequent chart title generation and correction.
[0075] S3323. Generate an empty chart title according to the configuration and issue an alarm; execute S3325; When there is no paragraph that meets the chart title condition among the upper and lower paragraphs adjacent to the chart, generating an empty chart title according to the configuration and issuing an alarm has a dual role. Generating an empty chart title ensures the integrity of the document format, avoiding format errors or content omissions caused by the lack of a chart title; issuing an alarm timely reminds the user that there is a lack of a chart title in the document, enabling the user to discover the problem in time and perform manual intervention, improving the accuracy and reliability of document processing.
[0076] S3324. Generate the chart title according to the chart title format and the chart serial number; Generate a chart title according to the chart title format and chart serial number, achieving the automatic generation of chart titles. The chart title format ensures that the generated titles meet the unified specification requirements, and the chart serial numbers enable different charts to be accurately distinguished and identified. This automatic generation method not only improves the efficiency of document processing but also ensures the consistency and standardization of chart titles.
[0077] S3325. Write the generated chart title to the corresponding location according to the configuration.
[0078] Accurately write the generated chart title to the corresponding location, completing the final setting of the chart title. This operation ensures that the chart title closely corresponds to the chart content, making the format and content of the document more complete and accurate. When readers read the document, they can quickly understand the theme and content of the chart through the chart title, improving the readability and practicality of the document. At the same time, it also ensures the consistency and standardization of the document format, enhancing the overall quality of the document.
[0079] As Figure 5 shown, an embodiment of the present invention also provides a delivery document processing tool, including a style definition module, a document processing module, a label processing module, and a chart processing module; The style definition module is used to preset and record various styles in the template file; The document processing module is used to copy the template file and clear the content as the output document, and traverse the document to be processed and modify the paragraph format; The label processing module is used to process the labels before the title, including deleting the original labels and generating new labels; The chart processing module is used to identify the chart title and adjust the chart format.
[0080] The label processing module includes a label initialization unit and a label generation unit; The label initialization unit is used to initialize the label list and label format; The label generation unit is used to generate labels according to the title level and increment the serial number.
[0081] The chart processing module includes a title recognition unit and a title generation unit; The title recognition unit is used to determine whether the chart title meets the preset rules; The title generation unit is used to generate an empty chart title when no title that meets the rules is found.
[0082] The final form of this tool is a complete packaged executable program in Python, which can run without a Python environment. This tool also includes a template file. Before use, it is necessary to define the styles of various titles, paragraphs, special identifiers, etc. in the template file according to needs.
[0083] Manually preset the styles of different parts in the template file before using the tool. Specify the template file through parameters when using it.
[0084] 1) Format preparation: This tool will first extract and record the paragraph styles, heading styles for levels 1-5, icon heading styles, and table font styles from the template file (font type, font size, line spacing, paragraph spacing, paragraph beginning and ending, etc.). 2) Overall Process: Copy a sample document and clear its contents as the output document. Skip the cover, title page, table of contents, and appendixes as configured. Iterate through all paragraphs in the document to be processed. Determine the paragraph format, handle special paragraph formats, modify the paragraph to the appropriate format, and write it to the output document.
[0085] 3) Special format processing: I. Title: Titles in a document can be divided into primary titles and secondary titles. Primary titles are titles with heading tags that will be displayed in the table of contents when the table of contents is generated. Secondary titles are titles that will not be displayed in the table of contents. Primary titles without defined styles will use the Office default style, and secondary titles without defined styles will use the style of ordinary paragraphs. The distinction between titles and ordinary paragraphs is based on the heading level defined in the original document. To distinguish between primary and secondary titles in a title, you can specify the maximum level of the primary title at startup (if not specified, the default is 5). All secondary heading levels after this level will be treated as secondary titles.
[0086] II. Numbers before titles: The label format must be defined in the template file in advance. Multiple formats can be mixed. When each level of the title has a separate label format, the format defined in the title takes precedence. If no format is defined, the general format is used. The default general format is xxxx, which represents all labels cascaded from the first level to the current level. If the general format is left blank, the general format is not used. The label format supports common formats such as numbers (Arabic numerals, Chinese numerals, Roman numerals) + characters, English letters + characters, and supports basic auto-increment.
[0087] Before writing a title, the title is checked to see if it has a label at the beginning of the paragraph. If so, the existing label is deleted. (When deleting a label, the supported formats for label determination are the same as those used when defining the label format.) Before writing a title, a label is added to the title based on the format and the recorded auto-increment queue.
[0088] The overall process is as follows: 1. Label initialization. Example: [1,1,1,1,1] 2. Initialize the label format and separator.
[0089] Example: [CN, NUM, T, T, EN], ["、", ")", "", "", "."] represent Chinese numerals with a punctuation mark, Arabic numerals + a right parenthesis, two general formats, and English letters with a dot respectively.
[0090] 3. Read the title during the process of traversing the document 4. Obtain the title level 5. Determine whether there is a record of this level in the label list according to the level If there is, use it directly and set all secondary serial numbers to 1 If not, append a level after the list and set the level to 1 6. Generate a label according to the level and label format, and increment the serial number list by 1 III. Chart Title: For the title of the chart, the format located below the chart is adopted by default. This item can be configured before use (or modified using parameters when the tool is started). The charts and tables can be configured separately. Options include: below the chart and table (default), above the chart and table, turn off the chart title. The icon title can be selected with an incrementing count: "Figure: XXX" or " Figure 1 : XXX", and the titles of the chart and table have independent counting serial numbers.
[0091] The judgment conditions for the chart title in the original document are: the two paragraphs immediately above and below the chart, the number of words is less than 20 (configurable), and it starts with "Figure" or "Table".
[0092] If a chart title that meets the rules is not found in the original document, the tool will throw a warning and generate an empty title at the specified position according to the configuration: " Figure 3 : ", "Table 2: ".
[0093] If two titles that meet the rules are found in the chart context, the tool will throw a warning, write the two paragraphs in the default body style, and generate an empty chart title at the specified position according to the configuration.
[0094] IV. Charts and Tables: The figure will be directly copied to the target file. If it is a reference to a local path, the tool will throw a warning.
[0095] After the table is copied, if the font format of the table header and content is defined in the template file, the format will be modified synchronously during the copying process.
[0096] As Figure 6 shown, the technical solution of the present invention also provides a delivery document processing system, including: A user interface for receiving user configuration parameters; The delivery document processing tool as described in the above embodiment; An interaction control component, which is used to start a working thread after the configuration is completed on the user interaction interface, and call the processing tool with the configured content as a parameter to process the document according to the configuration parameters; An output module, which is used to generate a formatted output document. The system provides an interactive GUI interface, and the functions can be configured and used through the GUI interface.
[0097] The user interaction interface provides: A graphical parameter configuration interface or a command-line parameter input interface; Preset parameters for the general rules of industry delivery documents.
[0098] The user interaction GUI is an auxiliary function, and the formatting tool itself can be directly executed through the command line. The interaction interface provides a parameter setting function. After the configuration is completed on the interaction interface, the interaction control component will start a working thread and call the delivery document processing tool with the configured content as a parameter to perform actual work processing.
[0099] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing delivery documents, characterized in that, The steps include: S1. Preset a template file, extract and record paragraph styles, title styles, chart title styles and font styles within tables; S2. Copy the template file and clear the content as the output document; S3, traversing all paragraphs in the document to be processed, and determining whether the paragraph format is a special paragraph format; the special paragraphs include titles and chart paragraphs; If so, execute the step of processing the special paragraph format; after the special paragraph processing is completed, execute S4; If not, execute S4; S4. Modify the paragraphs in the document to be processed into a corresponding format according to the style defined in the template file and then write them into the output document; S5. Export the output document after the traversal is completed; In S3, the steps for processing special paragraph formats include: S331, identify the title and process the number before the title; S332, identifying the chart title, and generating or modifying the chart title at a specified position on the chart according to the configuration; S333. Copy the chart to the output document and adjust the font style in the table according to the format defined in the template file.
2. The delivery document processing method according to claim 1, wherein The steps to copy a template file and clear its contents as an output document previously included: Receive configuration information entered by the user, including: Skip the configuration of cover, title page, table of contents, and appendix; Maximum level configuration for main headers; Position configuration for the chart title.
3. The delivery document processing method according to claim 2, wherein In S3, when traversing all paragraphs in the document to be processed, the cover, title page, table of contents, and appendix are skipped according to the configuration information; The steps for determining whether a paragraph is in a special paragraph format include: Check if the paragraph has a title attribute or contains a title number; Check whether the paragraph is a chart-related paragraph; Checks whether a paragraph is inside a table.
4. The delivery document processing method according to claim 3, wherein In S331, the steps of identifying the title and processing the number before the title include: S3311. Distinguish between main titles and secondary titles based on the preset maximum level of main titles; S3312. Delete the label of the title paragraph; S3313. Generate a new label according to the label format definition and add it to the beginning of the title paragraph.
5. The delivery document processing method according to claim 4, characterized in that S3313 includes: When each level of title has an independent numbering format, the numbering format defined in the title is used first. If there is no definition, the general format is used. If the general format is empty, the general number is not used. Before writing the title, delete the number of the title paragraph and add a number according to the format and the auto-increment queue.
6. The delivery document processing method according to claim 5, wherein S3313 specifically includes: S33131. Collect the title label formats at all levels and initialize a multi-level label list, where each level corresponds to a title level and the initial value is 1; S33132. Update the label list according to the title level: If the current heading level already exists in the label list, the label value of this level will be incremented by 1, and the labels of all lower levels will be reset to 1; If the current heading level does not exist in the label list, add a new level at the end of the label list and set its value to 1; S33133. Convert the label list into a label in string form according to the preset label format and separator; S33134. Add the generated label to the beginning of the title paragraph.
7. The delivery document processing method according to claim 6, wherein In S332, the step of identifying the chart title and generating or modifying the chart title at a specified position of the chart according to the configuration includes: S3321. Traverse all paragraphs of the document. When a chart paragraph is found, obtain the paragraphs above and below it that are adjacent to the chart. S3322. Determine whether there is exactly one paragraph among the paragraphs above and below the chart that meets the chart title condition. If not, execute S3323; if so, execute S3324. S3323. Generate an empty chart title according to the configuration and issue an alarm; execute S3325. S3324. Generate a chart title according to the chart title format and the chart serial number. S3325. Write the generated chart title to the corresponding position according to the configuration.
8. A delivery document processing tool, characterized in that, It includes a style definition module, a document processing module, a label processing module, and a chart processing module. The style definition module is used to preset and record various styles in the template file. The document processing module is used to copy the template file and clear the content as the output document, traverse the document to be processed, and modify the paragraph format. The label processing module is used to process the labels before the title, including deleting the original labels and generating new labels. The chart processing module is used to identify the chart title and adjust the chart format.
9. A delivery document processing system, characterized in that, It includes: A user interface for receiving user configuration parameters. The delivery document processing tool according to claim 8. An interaction control component, which is used to start a working thread after the configuration is completed on the user interface, and call the processing tool with the configured content as a parameter to process the document according to the configuration parameters. An output module for generating a formatted output document.
10. The delivery document processing system according to claim 9, characterized in that, The user interface provides: A graphical parameter configuration interface or a command-line parameter input interface. Preset parameters for the general rules of industry delivery documents.