Document conversion methods, devices, electronic devices, and computer storage media

CN115659926BActive Publication Date: 2026-08-14AISINO CORPORATION
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-01
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]现有技术中,DOCX文档生成PDF文档的方法,在执行过程中需要人工对文件的排版和布局等进行调整,效率低下

Benefits of technology

[0015]在本发明实施例的方案中,通过将第一数据模型转换为第二数据模型,将第一格式文档中的目标文字数据自动写入第二数据模型,并通过第二数据模型直接生成对应于第一格式文档的第二格式文档,由于第二数据模型是根据第一数据模型转化得到的,其中第二数据模型对于文档的排版和布局方式都是依照第一数据模型自动生成的,文档的排版和布局方式不会因为目标文字数据的写入而被改变,因此无需人工调整,实现了高效地将第一格式文档转化为第二格式文档,提高了转换文档的工作效率,进而降低人工运维成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115659926B_ABST
    Figure CN115659926B_ABST
Patent Text Reader

Abstract

This invention provides a document conversion method, apparatus, electronic device, and computer storage medium. The document conversion method includes obtaining the correspondence between data tags of a first-format document and target text data, as well as streaming tags corresponding to the data tags in a first data model. The first format is an editable format, and the first data model is used to output an editable document. Based on the correspondence between data tags, target text data, and streaming tags, the target text data is written into the first data model. The first data model is converted into a second data model, which is used to output a non-editable document. Through the second data model, a second-format document corresponding to the first-format document is output, and the second format is a non-editable format. The solution of this invention improves the efficiency of document conversion, thereby reducing manual maintenance costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of data processing, and in particular to a document conversion method, apparatus, electronic device, and computer storage medium. Background Technology

[0002] With the widespread adoption of paperless office practices, the demand for generating formatted contracts and other documents has expanded unprecedentedly. DOCX is a document format whose ease of editing makes it the most widely used and frequently employed document format in work. PDF is a portable document format that can be converted from DOCX documents. PDF documents faithfully reproduce every character, color, and image of the original, ensuring accurate colors and print quality on any printer. Therefore, it is the most commonly used document format for both electronic and printed documents.

[0003] In existing technologies, methods for generating PDF documents from DOCX documents require manual adjustments to the document's layout and formatting during the process, resulting in low efficiency. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a document conversion method, apparatus, electronic device, and computer storage medium to at least solve the above-mentioned problems.

[0005] According to a first aspect of the present invention, a document conversion method is provided. The method includes obtaining the correspondence between data tags of a first-format document and target text data, and streaming tags corresponding to the data tags in a first data model. The first format is an editable format, and the first data model is used to output an editable document. Based on the correspondence between the data tags, target text data, and streaming tags, the target text data is written into the first data model. The first data model is converted into a second data model, which is used to output a non-editable document. Through the second data model, a second-format document corresponding to the first-format document is output, and the second format is a non-editable format.

[0006] In one implementation, the document conversion method further includes constructing a document tree of a first data model based on a first format document, the document tree being used to describe the directory structure of the first format document.

[0007] In another implementation, obtaining the correspondence between data tags in the first format document and target text data, as well as the streaming tags corresponding to the data tags in the first data model, includes obtaining a hash table of the first format document, which indicates the correspondence between data tags in the first format document and target text data. Based on the hash table and the data tags in the first format document, the streaming tags corresponding to the data tags in the first data model are determined.

[0008] In another implementation, based on a hash table and data tags in a first-format document, the corresponding streaming tags in the first data model are determined. This includes traversing the document tree of the first data model and searching the hash table for streaming data in the first data model whose data format matches the data tags in the first-format document. The streaming data is then labeled to obtain streaming tags.

[0009] In another implementation, the document transformation method also includes traversing the document tree of the first data model to find unlabeled streaming data in the first data model. The unlabeled streaming data is then removed from the first data model to update the first data model.

[0010] In another implementation, the document conversion method also includes generating a first data model based on the layout of the first format document.

[0011] In another implementation, the document conversion method also includes storing the second-format document in association with the first data model.

[0012] According to a second aspect of the present invention, a document conversion apparatus is provided, comprising: an acquisition module, configured to acquire the correspondence between data tags of a first-format document and target text data, and streaming tags corresponding to the data tags in a first data model, wherein the first format is an editable format and the first data model is used to output an editable document; a rewriting module, configured to write the target text data into the first data model based on the correspondence between the data tags, target text data, and streaming tags; a conversion module, configured to convert the first data model into a second data model, wherein the second data model is used to output a non-editable document; and an output module, configured to output a second-format document corresponding to the first-format document through the second data model, wherein the second format is a non-editable format.

[0013] According to a third aspect of the present invention, an electronic device is provided, including a processor and a memory storing a program. The program includes instructions that, when executed by the processor, cause the processor to perform the method as described in the first aspect.

[0014] According to a fourth aspect of the present invention, a computer storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method of the first aspect.

[0015] In the embodiment of the present invention, by converting the first data model into a second data model, the target text data in the first format document is automatically written into the second data model, and a second format document corresponding to the first format document is directly generated through the second data model. Since the second data model is obtained by converting the first data model, the document layout and typesetting of the second data model are automatically generated according to the first data model. The document layout and typesetting will not be changed due to the writing of the target text data, so no manual adjustment is required. This achieves efficient conversion of the first format document into the second format document, improves the efficiency of document conversion, and reduces manual maintenance costs. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0017] Figure 1 This is a flowchart illustrating the steps of the document conversion method according to an embodiment of the present invention.

[0018] Figure 2 To and Figure 1 A structural block diagram of the document conversion device corresponding to the embodiment.

[0019] Figure 3 This is a schematic diagram of the structure of an electronic device according to another embodiment of the present invention.

[0020] Explanation of reference numerals in the attached figures:

[0021] 210. Acquisition module; 220. Rewrite module; 230. Conversion module; 240. Output module; 300. Electronic device; 302. Processor; 304. Communication interface; 306. Memory; 308. Bus; 310. Program. Detailed Implementation

[0022] To provide a clearer understanding of the technical features, objectives, and effects of the embodiments of the present invention, specific implementation methods of the embodiments of the present invention will now be described with reference to the accompanying drawings.

[0023] In this document, “illustrative” means “serving as an example, illustration or description”, and any illustration or implementation described herein as “illustrative” should not be construed as a more preferred or advantageous technical solution.

[0024] To keep the drawings concise, only the parts relevant to the invention are shown schematically in each figure, and they do not represent the actual structure of the product. Furthermore, for ease of understanding, some figures show only one or more components with the same structure or function, or only one or more are labeled.

[0025] To facilitate understanding, before describing the specific embodiments of the present invention in detail, the prior art of the document conversion method, apparatus, electronic device and computer storage medium of the present invention will be described by way of example.

[0026] In the current technology, electronic contracts are commonly used for contract signing to facilitate the process. Different electronic contracts are used for different transactions. To prevent discrepancies in contract content, PDF documents are usually chosen for signing. However, generating an electronic contract requires first setting the content and layout in a Word document, and then converting the Word document to a PDF. During the conversion process, manual adjustments to the document's layout and formatting are still necessary, resulting in low conversion efficiency.

[0027] Therefore, the present invention provides a document conversion method, apparatus, electronic device, and computer storage medium to at least solve the above-mentioned problems.

[0028] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art should fall within the protection scope of the present invention.

[0029] The specific implementation of the embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0030] According to a first aspect of the present invention, a document conversion method is provided. See also... Figure 1 , Figure 1 This is a flowchart illustrating the steps of the document conversion method according to an embodiment of the present invention.

[0031] like Figure 1 As shown, this embodiment mainly includes the following steps:

[0032] Step S110: Obtain the correspondence between the data tags of the first format document and the target text data, as well as the streaming tags corresponding to the data tags in the first data model. The first format is an editable format, and the first data model is used to output the editable format document.

[0033] For example, in an electronic contract, the first format is an editable format. This first format document can be a Word document, which is an editable document. A Word document is also a form of electronic contract. Data tags can be elements from the Word document such as "Contract Subject Matter," "Quantity," "Price," "Remuneration," "Performance Period," "Party A's Name," "Party A's Contact Information," "Party B's Name," "Party B's Contact Information," and "Terms and Conditions." The target text data refers to the text content that needs to be filled in or has already been filled in, corresponding to "Contract Subject Matter," "Quantity," "Price," "Remuneration," "Performance Period," "Party A's Name," "Party A's Contact Information," "Party B's Name," "Party B's Contact Information," and "Terms and Conditions."

[0034] Obtain the correspondence between data tags and target text data in the first format document, that is, obtain the one-to-one correspondence between the data tags such as "Contract Subject Matter", "Quantity", "Price", and "Remuneration" of the electronic contract, i.e., the WORD document, and the text content that needs to be filled in or has been filled in corresponding to the data tags, i.e., the target text data.

[0035] In practice, electronic contracts usually have a general template, which can be in the form of a Word document for easy editing. You can fill in the corresponding content according to the data tags in the template. The content filled in is usually the content agreed upon by both parties.

[0036] It should be understood that the streaming tags corresponding to the data tags in the first data model are obtained, and these streaming tags correspond one-to-one with the data tags of the first format document. If the data tags of the first format document are such that the first data model can be a streaming data model, then this streaming data model is used to output a streaming document.

[0037] It should also be understood that a streaming document is an editable document, which can be a WORD document or a TXT document. Therefore, the first data model can be used to output editable documents. In the embodiments of the present invention, the first data model can be used to output WORD documents.

[0038] Step S120: Based on the correspondence between data tags, target text data and streaming tags, write the target text data into the first data model.

[0039] It should be understood that since data tags and target data text reside in the first format document, while streaming tags reside in the first data model, and there is a one-to-one correspondence between data tags and target text data in the first format document, and a one-to-one correspondence between data tags in the first format document and streaming tags in the first data model, it can be assumed that there is a one-to-one correspondence between data tags and target text data in the first format document and between streaming tags in the first data model. Therefore, the target text data corresponding to the data tags can be written into the first data model.

[0040] It should also be understood that, since the data tags and target text data in the first format document are in one-to-one correspondence with the streaming tags in the first data model, if the target text data corresponding to the data tags in the first format document changes, the target text data written into the first data model will change accordingly.

[0041] For example: If one of the data tags in the first format document is "Article 122 of Liability for Breach of Contract", and the target text data corresponding to this data tag is "If Party B's overdue behavior infringes upon Party A's personal or property rights, Party A has the right to deduct 50% of Party B's deposit and require Party B to bear the economic losses caused to Party A due to the failure to deliver the product." If the data tag is "Article 122 of Liability for Breach of Contract". If the corresponding target text data changes to "Due to Party B's overdue behavior, which infringes upon Party A's personal or property rights, Party A has the right to deduct 100% of Party B's deposit and demand that Party B bear the economic losses caused to Party A due to the failure to deliver the products," then the target text data written into the first data model will change to "Due to Party B's overdue behavior, which infringes upon Party A's personal or property rights, Party A has the right to deduct 50% of Party B's deposit and demand that Party B bear the economic losses caused to Party A due to the failure to deliver the products." Similarly, if the data label "Article 122 of Breach of Contract Liability" changes accordingly to "Due to Party B's overdue behavior, which infringes upon Party A's personal or property rights, Party A has the right to deduct 100% of Party B's deposit and demand that Party B bear the economic losses caused to Party A due to the failure to deliver the products," then the target text data in the first data model changes accordingly with the change of the target text data corresponding to the data label in the first format document. Other parts besides the target text data remain unchanged, such as layout and illustration positions, which are consistent with the layout and illustration positions of the first format document content and require no manual adjustment.

[0042] Step S130: Convert the first data model into a second data model. The second data model is used to output a document in a non-editable format.

[0043] For example, a first data model can be converted into a second data model using a PDF conversion engine. The second data model is used to output documents in a non-editable format, such as PDF documents.

[0044] It should be understood that the second data model can be a layout data model, which is used to output layout documents.

[0045] It should also be understood that a formatted document is a non-editable document, which can be a PDF document or an OFD document. Therefore, the second data model can be used to output documents in non-editable formats. In the embodiments of the present invention, the second data model can be used to output PDF documents.

[0046] Step S140: Using the second data model, output a second format document corresponding to the first format document. The second format is a non-editable format.

[0047] For example, the second data model outputs a second format document, such as a PDF document, corresponding to the first format document, such as a WORD document. The data tags and target text data of the second format document (PDF document) output by the second data model are exactly the same as those of the first format document (WORD document). The layout and illustration positions of the PDF document are consistent with those of the WORD document.

[0048] In summary, in the solution of this embodiment of the invention, by converting the first data model into a second data model, the target text data in the first format document is automatically written into the second data model, and a second format document corresponding to the first format document is directly generated through the second data model. Since the second data model is obtained by converting the first data model, the document layout and formatting of the second data model are automatically generated according to the first data model. The document layout and formatting will not be changed due to the writing of the target text data, so no manual adjustment is required. This achieves efficient conversion of the first format document into the second format document, improves work efficiency, and reduces manual maintenance costs.

[0049] In one implementation, the document conversion method further includes constructing a document tree of a first data model based on a first format document, the document tree being used to describe the directory structure of the first format document.

[0050] It should be understood that by constructing a document tree of the first data model, the location of data tags in the first-format document can be found through the directory structure of the first-format document described by the document tree.

[0051] It should also be understood that by accurately locating the data tags in the first-format document, the target text data corresponding to those data tags can be found one-to-one, improving search efficiency and thus improving the efficiency of document conversion.

[0052] In another implementation, obtaining the correspondence between data tags in the first format document and target text data, as well as the streaming tags corresponding to the data tags in the first data model, includes obtaining a hash table of the first format document, which indicates the correspondence between data tags in the first format document and target text data. Based on the hash table and the data tags in the first format document, the streaming tags corresponding to the data tags in the first data model are determined.

[0053] It should be understood that the hash table of the first format document is obtained only to indicate the correspondence between the data tags of the first format document and the target text data. That is to say, the hash table does not include the data tags of the first format document and the content of the target text data. The data tags of the first format document and the content of the target text data are stored in the first format document.

[0054] By obtaining a hash table and determining the corresponding streaming label in the first data model based on the hash table and the data label in the first format document, the target text data can be written subsequently.

[0055] In another implementation, based on a hash table and data tags in a first-format document, the corresponding streaming tags in the first data model are determined. This includes traversing the document tree of the first data model and searching the hash table for streaming data in the first data model whose data format matches the data tags in the first-format document. The streaming data is then labeled to obtain streaming tags.

[0056] It should be understood that traversing the document tree of the first data model, which describes the directory structure of the first format documents, means traversing the directory structure of the first format documents in the first data model.

[0057] It should also be understood that the directory structure can be understood as a folder containing multiple sub-files, and each sub-file stores different data tags and the target text data corresponding to the data tags.

[0058] The location of data tags in the first-format document is found by using the directory structure of the first-format document described by the document tree. Since the hash table indicates the correspondence between the data tags of the first-format document and the target text data, the target text data corresponding one-to-one with the data tags of the first-format document can be found by using the hash table and the location of the data tags of the first-format document found by traversing the document tree.

[0059] The hash table is used to find streaming data in the first data model whose data format matches the data tags in the first format document. The streaming data is then labeled to obtain streaming tags. These streaming tags correspond to the data tags in the first format document; therefore, the target text data corresponding to the data tags in the first format document also corresponds to the streaming tags. Thus, there is a one-to-one correspondence between the data tags in the first format document, the target text data, and the streaming tags.

[0060] For example, the streaming data in the first data model can be "Quantity", "Price", "Remuneration", "Performance Period", "Party A's Name", "Party A's Contact Information", "[Party B's Name]", "[Party B's Contact Information]", "Terms and Conditions", "[Performance Period]", "Performance Location", "Performance Method", "Liability for Breach of Contract", etc. If the data tags of the first format document are "[Party B's Name]", "[Party B's Contact Information]", and "[Performance Period]", then the streaming data in the first data model that matches the data tags in the first format document according to the hash table is "[Party B's Name]", "[Party B's Contact Information]", and "[Performance Period]".

[0061] In this process, streaming data is labeled to obtain streaming labels. This can be done by adding a "+" symbol to the found "[Party B's Name]", "[Party B's Contact Information]", and "[Performance Period]", resulting in streaming labels "+[Party B's Name]", "+[Party B's Contact Information]", and "+[Performance Period]", which can be used to distinguish the streaming data from unlabeled streaming data.

[0062] By identifying the streaming tags in the first data model, it can be determined that the target text data can be written into the first data model according to the corresponding streaming tags, preventing errors in writing the target text and thus improving the accuracy of document conversion.

[0063] In another implementation, the document transformation method also includes traversing the document tree of the first data model to find unlabeled streaming data in the first data model. The unlabeled streaming data is then removed from the first data model to update the first data model.

[0064] For example, if the streaming data in the first data model at this time is "Quantity", "Price", "Remuneration", "Performance Period", "Party A's Name", "Party A's Contact Information", "+ [Party B's Name]", "+ [Party B's Contact Information]", "Terms and Conditions", "+ [Performance Period]", "Performance Location", "Performance Method", and "Liability for Breach of Contract".

[0065] Traverse the document tree of the first data model and search for unlabeled streaming data in the first data model. The unlabeled streaming data includes "Quantity", "Price", "Remuneration", "Performance Period", "Party A's Name", "Party A's Contact Information", "Terms and Conditions", "Performance Location", "Performance Method", and "Liability for Breach of Contract".

[0066] Remove the unlabeled streaming data from the first data model. At this point, the first data model only contains the labeled streaming data, which are the streaming labels: "+ [Party B's Name]", "+ [Party B's Contact Information]", and "+ [Performance Period]", in order to update the first data model.

[0067] The first data model is updated by removing unlabeled streaming data. This ensures that the first data model retains only the streaming tags corresponding to the data tags of the first format document, improving the efficiency of finding streaming tags during subsequent traversal.

[0068] In another implementation, the document conversion method also includes generating a first data model based on the layout of the first format document.

[0069] It should be understood that the first data model is generated based on the layout of the first format document. Therefore, the layout of the first data model is consistent with the layout of the first format document. The target text data in the first data model changes accordingly as the target text data corresponding to the data tags in the first format document changes. However, other parts besides the target text data remain unchanged, such as the layout and illustration positions, which are consistent with the layout and illustration positions of the content in the first format document. No manual adjustment is required, which improves the efficiency of document conversion.

[0070] In another implementation, the document conversion method also includes storing the second-format document in association with the first data model.

[0071] It should be understood that the second format document is output through the second data model, and the second format document corresponds to the first format document. The second format is a non-editable format.

[0072] For example, in practice, second-format documents, i.e., PDF documents, are often used as electronic contract documents for signing. If modifications to the electronic contract content are required, since the second-format document is not editable, it can be associated with and stored in a first data model. This allows the first data model associated with the second-format document to be found, which is an editable document such as a Word document. By modifying the data tags and target text data of the found first-format document, the first model data can be modified. The second model data is converted from the first model data, so it changes with the first model data. The corresponding modified second-format document can then be re-output, meeting the needs for modifying electronic contracts and improving the convenience of document modification.

[0073] According to a second aspect of the present invention, a document conversion apparatus is provided, see below. Figure 2 , Figure 2 To and Figure 1 A structural block diagram of the document conversion device corresponding to the embodiment. The document conversion device of this embodiment includes:

[0074] The acquisition module 210 is used to acquire the correspondence between the data tags of the first format document and the target text data, as well as the streaming tags corresponding to the data tags in the first data model. The first format is an editable format, and the first data model is used to output the editable format document.

[0075] The rewrite module 220 is used to write the target text data into the first data model based on the correspondence between data tags, target text data and streaming tags.

[0076] The conversion module 230 is used to convert the first data model into a second data model, which is used to output a document in a non-editable format.

[0077] The output module 240 is used to output a second format document corresponding to the first format document through the second data model. The second format is a non-editable format.

[0078] In the embodiments of the present invention, a document conversion method is provided. By converting a first data model into a second data model, the target text data in the first format document is automatically written into the second data model, and a second format document corresponding to the first format document is directly generated through the second data model. Since the second data model is obtained by conversion based on the first data model, the document layout and formatting of the second data model are automatically generated according to the first data model. The document layout and formatting will not be changed due to the writing of the target text data, so no manual adjustment is required. This achieves efficient conversion of the first format document into the second format document, improves the efficiency of document conversion, and reduces manual maintenance costs.

[0079] In another implementation, the acquisition module 210 is further configured to acquire a hash table of the first format document, the hash table indicating the correspondence between data tags in the first format document and target text data. Based on the hash table and the data tags in the first format document, the streaming tags corresponding to the data tags in the first data model are determined.

[0080] In another implementation, the acquisition module 210 is further configured to traverse the document tree of the first data model and search for streaming data in the first data model whose data format matches that of the data tags in the first formatted document, based on the hash table. The streaming data is then labeled to obtain the streaming tags.

[0081] In another implementation, the acquisition module 210 further includes an update unit, which traverses the document tree of the first data model to find unlabeled streaming data in the first data model. The unlabeled streaming data is then removed from the first data model to update the first data model.

[0082] In another implementation, the document transformation and transpose also includes a generation module, which generates a first data model based on the layout of the first format document.

[0083] In another implementation, the generation module is also used to construct a document tree of the first data model based on the first format document, the document tree being used to describe the directory structure of the first format document.

[0084] In another implementation, the document transformation and transposition also includes a storage module for associating and storing the second-format document with the first data model.

[0085] According to a third aspect of the present invention, an electronic device is provided, see [link to relevant documentation]. Figure 3The present invention will now be described in the form of a structural block diagram of an electronic device 300 that can serve as a server or client of the present invention, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, user digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as user digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0086] The electronic device 300 may include: a processor 302, a communications interface 304, a memory 306, and a communications bus 308.

[0087] The processor 302, communication interface 304, and memory 306 communicate with each other via communication bus 308. Communication interface 304 is used to communicate with other electronic devices or servers.

[0088] The processor 302 is used to execute program 310, specifically the relevant steps in the above method embodiments.

[0089] Specifically, program 310 may include program code that includes computer operation instructions.

[0090] Processor 302 may be a CPU, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The smart device may include one or more processors of the same type, such as one or more CPUs; or it may include processors of different types, such as one or more CPUs and one or more ASICs.

[0091] Memory 306 is used to store program 310. Memory 306 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0092] Specifically, program 310 can be used to cause processor 302 to perform the following operations: Obtain the correspondence between data tags of a first-format document and target text data, and the streaming tags corresponding to the data tags in a first data model. The first format is an editable format, and the first data model is used to output an editable document. Based on the correspondence between data tags, target text data, and streaming tags, write the target text data into the first data model. Convert the first data model into a second data model, which is used to output a non-editable document. Through the second data model, output a second-format document corresponding to the first-format document, where the second format is non-editable.

[0093] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of the present invention can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.

[0094] The methods described above according to embodiments of the present invention can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code originally stored on a remote recording medium or a non-transitory machine-readable medium and subsequently stored on a local recording medium, downloaded via a network. Thus, the methods described herein can be processed by software stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., RAM, ROM, flash memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.

[0095] It should be understood that although this specification is described according to various embodiments, not every embodiment contains only one independent technical solution. This way of describing the specification is only for clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.

[0096] The above embodiments are only used to illustrate the embodiments of the present invention, and are not intended to limit the embodiments of the present invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present invention, and the patent protection scope of the embodiments of the present invention should be defined by the claims.

Claims

1. A document conversion method, characterized in that, include: The process involves obtaining the correspondence between data tags in a first-format document and target text data, as well as the streaming tags corresponding to the data tags in a first data model. The first format is an editable format, and the first data model is used to output an editable document. The process of obtaining the correspondence between data tags in the first-format document and target text data, as well as the streaming tags corresponding to the data tags in the first data model, includes: obtaining a hash table of the first-format document, where the hash table indicates the correspondence between data tags in the first-format document and target text data; traversing the document tree of the first data model; searching for streaming data in the first data model whose data format matches the data tags in the first-format document according to the hash table; and marking the streaming data to obtain the streaming tags. Traverse the document tree of the first data model to find unlabeled streaming data in the first data model; remove the unlabeled streaming data from the first data model to update the first data model; Based on the correspondence between the data tags, the target text data, and the streaming tags, the target text data is written into the first data model; The first data model is converted into a second data model, which is used to output a document in a non-editable format; The second data model outputs a second format document corresponding to the first format document, wherein the second format is a non-editable format.

2. The method according to claim 1, characterized in that, The method further includes: Based on the first format document, a document tree of the first data model is constructed, and the document tree is used to describe the directory structure of the first format document.

3. The method according to claim 1, characterized in that, The method further includes: The first data model is generated based on the layout of the first format document.

4. The method according to claim 1, characterized in that, The method further includes: The second format document is associated with and stored in the first data model.

5. A document conversion device, characterized in that, include: The acquisition module is used to acquire the correspondence between data tags of a first-format document and target text data, as well as the streaming tags corresponding to the data tags in a first data model. The first format is an editable format, and the first data model is used to output an editable document. Specifically, it is used to acquire a hash table of the first-format document, which indicates the correspondence between data tags of the first-format document and target text data; traverse the document tree of the first data model; search for streaming data in the first data model that has the same data format as the data tags in the first-format document according to the hash table; and mark the streaming data to obtain the streaming tags. The acquisition module further includes an update unit, which is used to traverse the document tree of the first data model, find unlabeled streaming data in the first data model, remove the unlabeled streaming data from the first data model, and update the first data model. The rewriting module is used to write the target text data into the first data model based on the correspondence between the data tags, the target text data and the streaming tags; A conversion module is used to convert the first data model into a second data model, the second data model being used to output a document in a non-editable format; The output module is used to output a second format document corresponding to the first format document through the second data model, wherein the second format is a non-editable format.

6. An electronic device, characterized in that, include: processor; Memory for stored programs; The program includes instructions that, when executed by the processor, cause the processor to perform the method according to any one of claims 1-4.

7. A computer storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method and device for converting stream mode typeset content into block mode typeset document

    CN102467496A

  • Word image-text formatting system based on source files and implementation method thereof

    CN108052496A

  • General DOC, DOCX and INDD document typesetting engine and method

    CN113011129A