Method and apparatus for merging files of multiple formats into one OFD file

The method and apparatus convert multiple file formats into a unified OFD file, addressing storage and sharing inconveniences and security risks by maintaining a consistent display and structure.

JP7748057B2Active Publication Date: 2025-10-02JIANGSU ZHONGWEI TECH SOFTWARE SYST
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2024526875
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2021-11-05
Filing Date
2022-11-04
Publication Date
2025-10-02
Estimated Expiration
2042-11-04

AI Technical Summary

Technical Problem

Existing methods for merging multiple files result in separate files that are inconvenient for storage, sharing, transfer, and offline reading, and traditional electronic file archiving formats lack unified national or industry standards, posing security risks.

Method used

A method and apparatus that converts multiple files of different formats into a single OFD file by creating a base structure, extracting and copying file resources, and packaging them to generate a unified OFD file, maintaining hierarchical structure and replacing duplicate IDs.

Benefits of technology

Unifies file formats into a single OFD format, facilitating easy archiving, transfer, and sharing while ensuring security and maintaining display consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007748057000002
    Figure 0007748057000002
  • Figure 0007748057000003
    Figure 0007748057000003
  • Figure 0007748057000001
    Figure 0007748057000001
Patent Text Reader

Abstract

The present invention discloses a method and apparatus for merging files of multiple formats into one OFD file, which includes the steps of converting files of multiple different formats into a standard OFD file, creating one base OFD file structure, extracting the multiple OFD files to obtain the extracted folder, copying OFD file resources into the base OFD file structure while maintaining the hierarchical structure according to the structure of the OFD file structure, and replacing the resources in order if there are duplicate resource IDs, to generate an integrated and merged OFD file. The method described in the present invention allows files of different formats to be merged to form one OFD format file with a unified format and display standard, and unifies the formats of multiple files of the same or different formats to facilitate archiving, transferring, viewing, and sharing as a whole.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS This application claims priority to a Chinese patent application filed with the China Patent Office on November 5, 2021, application number 202111305218.4, with the invention title "Method and apparatus for merging files of multiple formats into one OFD file," the entire contents of which are incorporated herein by reference.

[0002] The present invention relates to the field of merging and displaying methods, and more particularly to an apparatus and method for merging files of multiple formats into one OFD file. [Background technology]

[0003] Currently, merging multiple files uses a method of analyzing and rendering using a reader device, assuming that the originals will not be destroyed, to merge multiple files into a single file so that they can be read all at once. However, the files are essentially still multiple files; only the method of reading the files has changed, making it inconvenient to store, share, transfer, and read files offline.

[0004] On October 14, 2016, China's National Standardization Administration officially approved and published the independent national standard GB / T 33190-2016, "Electronic File Storage and Exchange Format: Layout Document" (OFD), on World Standards Day. OFD, short for Open Fixed-layout Document, is China's independent and controllable electronic file layout document format, the international standard for which is PDF. OFD layout files have a fixed layout, no layout shifting, and are what you see, what you get (WYSIWYG)—making them the "digital paper" of the computer age. They are ideal for electronic document publishing, digital information transmission, and archiving. Traditional electronic file archiving formats lack unified national or industry standards. Streaming file formats, such as DOC, WPS, and PPTX, are prone to content changes and pose potential security risks during transfer, making them inadequate for long-term electronic file preservation. Summary of the Invention [Problem to be solved by the invention]

[0005] SUMMARY OF THE INVENTION It is an object of the present invention to provide a method and apparatus for merging files of multiple formats into a single OFD file, which overcomes one or more of the problems of the conventional methods mentioned above. [Means for solving the problem]

[0006] The method and apparatus proposed by the present invention for merging files of multiple formats into one OFD file includes: converting a plurality of files of different formats into an OFD format file; creating a base OFD file structure; Extracting multiple OFD format files and obtaining an extracted folder; copying file resources corresponding to the OFD format file into a base OFD file structure and packaging them to generate an integrated and merged OFD file.

[0007] In some embodiments, the file formats include wps, doc / docx, xls / xlsx, ppt / pptx, cad, jpg, tif, gif, png, pdf, and html.

[0008] In some embodiments, the step of extracting the OFD format file is a step of changing the extension .ofd of the OFD file to .zip to form a compressed file, and extracting the compressed file to obtain the extracted folder.

[0009] In some embodiments, the step of packaging to generate the consolidated and merged OFD file comprises: copying the file contents and file resources in the folder into the base OFD file structure while maintaining the hierarchical structure; merging a directory of multiple OFD format files onto an underlying OFD file structure and moving files referenced by the directory; replacing duplicate resource ids and moving associated file resources; packaging the folders and generating a merged OFD format file.

[0010] In some embodiments, the step of merging directories of multiple OFD format files onto a single underlying OFD file structure and moving files referenced by the directories includes: overwriting the OFD.xml in the first OFD file with the OFD.xml in the base OFD file structure; The steps are: analyzing files under the Doc_N directory under the same file directory, reading the document.xml file, writing the content of ofd:Pages in the document.xml file into the corresponding xml of the base OFD file structure, and adjusting the content of the corresponding ofd:Pages BaseLog if there are multiple OFD files with the same file path.

[0011] In some embodiments, the step of replacing duplicate resource ids and moving associated file resources comprises: Traverse resource IDs from the first page, copy file resources referenced by the IDs into the corresponding folders, and if there are any duplicate IDs, change the IDs, rename the file resources, and copy them under the corresponding folders.

[0012] How to merge files in multiple formats into one OFD file using the file-within-file merging method: obtaining a file within a plurality of files; converting the file in the file into an OFD format file; creating a base OFD file structure; Extracting multiple OFD format files and obtaining an extracted folder; copying and packaging file resources corresponding to the OFD format file into a base OFD file structure to generate an integrated and merged OFD file; Includes.

[0013] In some embodiments, the file within the file includes a file processing sheet, a final draft, and each of the previous revisions.

[0014] A system for merging files of multiple formats into a single OFD file includes a client and a server, The client can upload files of different formats, receive and display the merged OFD format file, The server is used to store and execute computer instructions to implement the above-described method of merging files of multiple formats into an OFD file and / or the method of merging files within a file.

[0015] An apparatus for merging files of multiple formats into one OFD file comprises at least one storage medium and at least one processor; the at least one storage medium is adapted to store computer instructions; The at least one processor is adapted to execute the computer instructions to implement the method for merging files of multiple formats into an OFD file and / or the method for merging files within a file as described above.

[0016] The advantages of the apparatus and method for merging files of multiple formats into an OFD file described in the present invention are as follows:

[0017] According to the device and method for merging files of multiple formats into an OFD file described in the present invention, files of different formats are used to form an OFD format file with a unified format and display standard, and the formats of multiple files of the same or different formats are unified, making it easy to archive, transfer, view, and share them as a whole.

[0018] Using this method, a set of multiple sub-documents such as file processing sheets, final drafts, and past revisions can be converted and merged into a single OFD format file. The content and images of the resulting electronic official documents can be extracted using OCR methods, and the images can be scanned and merged into a two-layer OFD format file. Metadata for electronic archiving can be embedded in the OFD file. [Brief explanation of the drawings]

[0019] [Figure 1] 1 is a flowchart of a method for merging files of multiple formats into an OFD file in some embodiments of the present invention. [Figure 2] 1 is a diagram showing the hierarchical organization of an OFD file. DETAILED DESCRIPTION OF THE INVENTION

[0020] Semantic interpretation The essence of an OFD file is a compressed package that is a single xml file.

[0021] In some embodiments of the present invention, a system for merging files of multiple formats into one OFD file includes a client and a server. In relation to what is shown in FIG. 1, merging files of multiple formats into one OFD file using this system includes the following steps:

[0022] Step 1. Select and upload files in the client. Upload file formats include, but are not limited to: wps, doc / docx, xls / xlsx, ppt / pptx, cad, jpg, tif, gif, png, pdf, html.

[0023] Step 2. The server receives the file uploaded by the client, determines the format of the different file, and calls the corresponding conversion method according to the file format to convert it into a PDF format file, and then converts the PDF format file into an OFD format OFD file. The conversion into a PDF format file according to the file format includes the following steps:

[0024] 1) For wps, doc / docx files, generate a pdf using Word.Application. The specific steps are as follows:

[0025] 1.1.Open the Word application, 1.2.Hide word, 1.3.Get all documents open in Word and return a Documents object. 1.4. Call the Open method in the Documents object to open the document and return the open document object, Document. 1.5. Call the ExportAsFixedFormat method of the Document object to save the document in PDF format. 1.6. Close the document, 1.7.Exit the Word application.

[0026] 2) For xls / xlsx, generate a pdf using Excel.Application. The specific steps are as follows:

[0027] 2.1.Open the Excel application, 2.2.Hide Excel, 2.3.Get all open documents in Excel and return a Documents object. 2.4. Call the Open method in the Documents object to open the document and return the open document object, Document. 2.5. Call the ExportAsFixedFormat method of the Document object to save the document in PDF format. 2.6. Close the document, 2.7.Exit the Word application.

[0028] 3) For ppt / pptx, use PowerPoint.Application to generate the pdf.

[0029] 4) For CAD, we use Aspose.CAD to generate PDF. Here, when layers in the CAD design have different sizes, the auto-scale feature scales the layers according to the uniform page size in the PDF. When scaling, if the CAD is displayed in black and white in the PDF, we can override this feature using setBackgroundColor to set the required background and shape color.

[0030] 5) Convert jpg, tif, gif, png images to pdf using PdfWriter, the specific steps are as follows:

[0031] 5.1.Create a PDF document, 5.2. Add a page, 5.3. Load the image, 5.4. Draw an image to a PDF, set its position and size within the PDF file, 5.5. Save and exit.

[0032] Step 3. The server creates a base OFD file structure (the base OFD file structure contains only the structure).

[0033] Step 4. The client traverses multiple OFD files, and the server creates a new file directory, copies the multiple OFD files traversed by the client into the new file directory, renames the .ofd extensions of the OFD files in the new file directory to .zip, and extracts the files from the .zip file to obtain the extracted OFD folder for the corresponding OFD files. The hierarchical organizational structure is shown in Figure 2.

[0034] Step 5. The server copies the file contents and file resources in the folder into the base OFD file structure while maintaining the hierarchical structure, packages them, and generates an integrated and merged OFD file. Specifically, this process includes the following steps:

[0035] Step 5.1. Merge multiple OFD folder directories on the base OFD file structure, and the OFD.xml file in the xml file package of the OFD folder is the entry file, which overwrites the OFD.xml in the first OFD file with the OFD.xml in the base OFD file structure.

[0036] Step 5.2. Move the referenced file to the directory. The server analyzes the files under the Doc_N directory under the same file directory, reads the document.xml file in the xml file package, and writes the contents of ofd:Pages in the document.xml file into the corresponding xml of the base OFD file structure sequentially. If there are the same file paths in multiple OFD folders, adjust the contents of the corresponding ofd:Pages BaseLog. For example, if the page number of file 1 is ' <ofd:page baseloc=""Pages / Page_11 / Content.xml”" id=""12” / ">', when subsequent files are merged, continue incrementing from Pages_12,ID=13 and copy the files under the corresponding page numbers. If all n file directories are 1 to 10, you need to adjust the file directories of these folders so that the adjusted directories are 1 to 10, 11 to 20, ..., {(n-1)*10+1} to (n*10), and then copy the corresponding referenced files. The script information is as follows: JPEG0007748057000001.jpg163170

[0037] Step 5.3. Replace duplicate resource IDs. The server traverses the contents of the Pages content.xml, traverses the resource IDs from the first page, copies the file resources referenced by the IDs into the corresponding folder, and if there are duplicate IDs, changes the ID, renames the file resources, and copies them into the xml file package under the corresponding OFD folder.

[0038] Step 5.4. Merge the file resources in the xml file packages in multiple OFD folders to form one xml file package, change the extension to ofd, and generate a consolidated and merged OFD file.

[0039] The file resources include fonts, font sizes, images, text, etc.

[0040] Step 5.3 above may be performed in preference to step 5.2.

[0041] The method for merging files within a file using the above method for merging files of multiple formats into an OFD file includes the following steps.

[0042] S1. From Version.xml in the root directory, obtain multiple files within the file, including the file processing sheet, the final draft, and each previous revision.

[0043] S2. Convert the file in the file to an OFD format file.

[0044] S3. Create the base OFD file structure.

[0045] S4. After traversing the multiple OFD files, the server creates a new file directory, copies the traversed multiple OFD files into the new file directory on the server, renames the .ofd extension of each OFD file in the new file directory to .zip, extracts the files from the .zip file, and obtains an OFD folder after extracting the corresponding OFD files.

[0046] S4. The server copies the file contents and file resources in the OFD folder into the base OFD file structure while maintaining the hierarchical structure, packages them, and generates an integrated and merged OFD file. Specifically, this process includes the following steps:

[0047] Step 5.1. Merge multiple OFD folder directories on the base OFD file structure, and the OFD.xml file is the entry file, which overwrites the OFD.xml in the first OFD file with the OFD.xml in the base OFD file structure.

[0048] S5.2. Move the referenced file to the directory. The server analyzes the files under the Doc_N directory under the same file directory, reads the document.xml file in the xml file package, writes the contents of the ofd:Pages in the document.xml file sequentially into the corresponding xml of the base OFD file structure, and adjusts the contents of the corresponding ofd:Pages BaseLog if there are multiple OFD files with the same file path.

[0049] S5.3. Replace duplicate resource IDs. The server traverses the contents of the Pages content.xml in the xml file package, traverses the resource IDs from the first page, copies the file resources referenced by the IDs into the corresponding folder, and if there are any duplicate IDs, changes the ID, renames the file resources, and copies them under the corresponding OFD folder.

[0050] S5.4. Package the OFD folder, change the extension to ofd, and generate a consolidated and merged OFD file.

[0051] By merging files within files as described above, the historical records of the files can be merged into a single whole, making it easier to archive, transfer, view, and share files within files as a whole.

[0052] In some embodiments of the present invention, an apparatus for merging files of multiple formats into one OFD file is proposed, comprising at least one storage medium and at least one processor: at least one storage medium adapted to store computer instructions; At least one processor is adapted to execute the computer instructions to implement the above-described method for merging files of multiple formats into an OFD file and / or the method for merging files within a file.

[0053] The above description is only a preferred embodiment of the present invention, and those skilled in the art may make some similar modifications and improvements without departing from the inventive concept of the present invention, which should also be deemed to fall within the protection scope of the present invention.< / ofd:page>

Claims

1. 1. A method for merging multiple files of different formats into one OFD file, executed by at least one processor, comprising: obtaining a plurality of OFD format files corresponding to the plurality of files in different formats by converting each of the plurality of files in different formats into an OFD format file; creating a base OFD file structure; a step of obtaining a plurality of compressed files corresponding to the plurality of OFD format files by compressing each of the plurality of OFD format files to form a compressed file, and extracting the plurality of compressed files to obtain a plurality of OFD folders after extraction; merging directories of the plurality of OFD folders on the base OFD file structure, and moving each of the plurality of OFD format files referenced in the merged directories of the plurality of OFD folders to a corresponding position in the base OFD file structure; packaging the file resources in the plurality of OFD folders to generate a single merged OFD file; 1. A method for merging multiple files of different formats into one OFD file, comprising:

2. The formats of the multiple files in different formats include wps, doc / docx, xls / xlsx, ppt / pptx, cad, jpg, tif, gif, png, pdf, and html. The method of claim 1, wherein the file is a multiple file format file.

3. 1. A method for merging a plurality of files-within-files of different formats into one OFD file, executed by at least one processor, comprising: Retrieving multiple files in different formats using Version.xml in the root directory; converting each of the plurality of files in the different formats into an OFD format file, thereby obtaining a plurality of OFD format files corresponding to the plurality of files in the different formats; creating a base OFD file structure; a step of obtaining a plurality of compressed files corresponding to the plurality of OFD format files by compressing each of the plurality of OFD format files to form a compressed file, and extracting the plurality of compressed files to obtain a plurality of OFD folders after extraction; merging directories of the plurality of OFD folders on the base OFD file structure, and moving each of the plurality of OFD format files referenced in the merged directories of the plurality of OFD folders to a corresponding position in the base OFD file structure; packaging the file resources in the plurality of OFD folders to generate a single merged OFD file; 1. A method for merging files within a plurality of files of different formats into one OFD file, comprising:

4. The files within the file include a file processing sheet, a final draft, and each of the previous revisions. The method for merging multiple files-in-files of different formats into one OFD file according to claim 3.

5. 1. A system for merging multiple files of different formats or files within multiple files of different formats into one OFD file, comprising: A client and a server, The client is used to upload multiple files of different formats or files within multiple files of different formats to the server, and receives and displays the merged single OFD file from the server; The server computer at least one processor; a storage device storing a computer program for causing the at least one processor to execute the method for merging a plurality of files of different formats into a single OFD file according to claim 1 or 2 or the method for merging files within a plurality of files of different formats into a single OFD file according to claim 3 or 4; and A system comprising:

6. 1. An apparatus for merging multiple files of different formats or files within multiple files of different formats into one OFD file, comprising: The device comprises: at least one processor; At least one storage medium storing a computer program for causing the at least one processor to execute the method for merging a plurality of files of different formats into a single OFD file according to claim 1 or 2 or the method for merging files within a plurality of files of different formats into a single OFD file according to claim 3 or 4; and An apparatus comprising:

Citation Information

Patent Citations

  • OFD file merging display and directory generation method

    CN111753502A

  • Generic Infrastructure for converting documents between formats with merge capabilities

    US20030182450A1

  • Document format processing apparatus and document format processing method

    US20150046797A1