Method for converting UOT streaming document into OFD format document

文档序号:971430 发布日期:2020-11-03 浏览:17次 中文

阅读说明:本技术 一种uot流式文档转换成ofd版式文档的方法 (Method for converting UOT streaming document into OFD format document ) 是由 崔海东 徐海华 于 2020-08-06 设计创作,主要内容包括:本申请公开了一种UOT流式文档转换成OFD版式文档的方法,包括:读取UOT格式的流式文档并解析得到所述UOT格式的流式文档的各项数据;分类汇总所述UOT格式的流式文档的各项数据得到流式文档内存模型;将所述流式文档内存模型转换为版式文档内存模型;依照OFD格式规范将所述版式内存模型写出至磁盘,生成OFD格式的版式文档。该方法能够实现将UOT格式的流式文档转换为OFD格式的版式文档。本申请还公开了一种UOT流式文档转换成OFD版式文档的装置、设备及计算机可读存储介质,均具有上述技术效果。(The application discloses a method for converting UOT streaming documents into OFD format documents, which comprises the following steps: reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format; classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model; converting the streaming document memory model into a format document memory model; writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format. The method can realize the conversion of the UOT format streaming document into the OFD format document. The application also discloses a device, equipment and a computer readable storage medium for converting UOT streaming documents into OFD format documents, which have the technical effects.)

1. A method of UOT converting a streaming document to an OFD layout document, comprising:

reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format;

classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model;

converting the streaming document memory model into a format document memory model;

writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format.

2. The method of claim 1, wherein reading the UOT formatted streaming document and parsing the UOT formatted streaming document comprises:

decompressing the physical file of the UOT streaming document in the disk into an internal memory;

and analyzing the UOT streaming document in the memory, and storing each item of data of the UOT format streaming document into a file stream.

3. The method of claim 2, wherein converting the streaming document in-memory model into a layout document in-memory model comprises:

constructing a document tree structure according to each streaming memory object of the streaming document memory model by taking a document as a unit;

and traversing the document tree structure, and extracting data in the stream memory object by taking a page as a unit to construct a format document memory model.

4. The method of claim 3, wherein writing the layout memory model out to disk according to the OFD format specification, generating a layout document in OFD format comprises:

creating a blank XML file according to the specification of the format document in the OFD format;

writing out each format memory object of the format document memory model to the corresponding XML file;

and organizing the XML file into an electronic file physical package, and packaging and compressing to obtain the format document in the OFD format.

5. The method of claim 4, wherein the performing the packing compression comprises:

and packing and compressing by a Zip compression method and a Deflate compression method.

6. An apparatus for converting UOT streaming documents into OFD format documents, comprising:

the analysis module is used for reading the streaming document in the UOT format and analyzing to obtain various data of the streaming document in the UOT format;

the creating module is used for classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model;

the conversion module is used for converting the streaming document memory model into a format document memory model;

and the generating module is used for writing the format memory model out to a disk according to the OFD format specification to generate a format document in the OFD format.

7. The apparatus of claim 6, wherein the conversion module comprises:

the first conversion unit is used for constructing a document tree structure according to each streaming memory object of the streaming document memory model by taking a document as a unit;

and the second conversion unit is used for traversing the document tree structure and extracting data in the stream memory object by taking a page as a unit to construct a format document memory model.

8. The apparatus of claim 7, wherein the generating module comprises:

a creating unit configured to create a blank XML file according to a specification of the format document in the OFD format;

a writing-out unit, configured to write out each format memory object of the format document memory model to the corresponding XML file;

and the compression unit is used for organizing the XML file into an electronic file physical package, and packaging and compressing the XML file to obtain the format document in the OFD format.

9. An apparatus for converting UOT streaming documents into OFD format documents, comprising:

a memory for storing a computer program;

a processor for implementing the steps of the method of UOT converting a streaming document to an OFD format document according to any of claims 1 to 5 when executing the computer program.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the UOT method of converting a streaming document into an OFD-format document according to any one of claims 1 to 5.

Technical Field

The application relates to the technical field of file conversion, in particular to a method for converting UOT streaming documents into OFD format documents; it also relates to an UOT apparatus, a device and a computer readable storage medium for converting a streaming document into an OFD format document.

Background

UOT (Uniform Office Text, Chinese Office software document format) document is a streaming format specification. The streaming document can be automatically typeset, the content is easy to change, potential safety hazards exist in the transfer process, and the requirement of long-term storage of the electronic document cannot be met. An Open file Layout (OFD) Document is a format specification, has a small file size and portability, has a presentation effect independent of equipment, and is Fixed in Layout and free from board running when being read, printed or printed on various equipment. In addition, the OFD file is permanently readable and usable, and does not depend on any specific software, so that the long-term storage of the file is really realized. In the future, electronic documents, electronic certificates, electronic stamps and the like exist in the OFD format, and the demand for converting streaming documents in the UOT format into format documents in the OFD format will gradually expand. However, a corresponding conversion tool is currently lacking, so that the UOT format streaming document cannot be converted into the OFD format layout document.

In view of the above, how to convert a streaming document in UOT format into a format document in OFD format has become a technical problem to be solved by those skilled in the art.

Disclosure of Invention

The application aims to provide a method for converting UOT streaming documents into OFD format documents, which can convert UOT format streaming documents into OFD format documents. It is another object of the present application to provide an apparatus, a device and a computer-readable storage medium for converting a streaming document in UOT format into a layout document in OFD format, all of which have the above technical effects.

To solve the above technical problem, the present application provides a method for converting UOT streaming documents into OFD format documents, comprising:

reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format;

classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model;

converting the streaming document memory model into a format document memory model;

writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format.

Optionally, the reading and parsing the streaming document in UOT format to obtain the data of each item of the streaming document in UOT format includes:

decompressing the physical file of the UOT streaming document in the disk into an internal memory;

and analyzing the UOT streaming document in the memory, and storing each item of data of the UOT format streaming document into a file stream.

Optionally, the converting the streaming document memory model into a format document memory model includes:

constructing a document tree structure according to each streaming memory object of the streaming document memory model by taking a document as a unit;

and traversing the document tree structure, and extracting data in the stream memory object by taking a page as a unit to construct a format document memory model.

Optionally, writing the format memory model out to a disk according to the OFD format specification to generate a format document in the OFD format, including:

creating a blank XML file according to the specification of the format document in the OFD format;

writing out each format memory object of the format document memory model to the corresponding XML file;

and organizing the XML file into an electronic file physical package, and packaging and compressing to obtain the format document in the OFD format.

Optionally, the performing of the packing compression includes:

and packing and compressing by a Zip compression method and a Deflate compression method.

In order to solve the above technical problem, the present application further provides an apparatus for converting UOT streaming documents into OFD format documents, including:

the analysis module is used for reading the streaming document in the UOT format and analyzing to obtain various data of the streaming document in the UOT format;

the creating module is used for classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model;

the conversion module is used for converting the streaming document memory model into a format document memory model;

and the generating module is used for writing the format memory model out to a disk according to the OFD format specification to generate a format document in the OFD format.

Optionally, the conversion module includes:

the first conversion unit is used for constructing a document tree structure according to each streaming memory object of the streaming document memory model by taking a document as a unit;

and the second conversion unit is used for traversing the document tree structure and extracting data in the stream memory object by taking a page as a unit to construct a format document memory model.

Optionally, the generating module includes:

a creating unit configured to create a blank XML file according to a specification of the format document in the OFD format;

a writing-out unit, configured to write out each format memory object of the format document memory model to the corresponding XML file;

and the compression unit is used for organizing the XML file into an electronic file physical package, and packaging and compressing the XML file to obtain the format document in the OFD format.

In order to solve the above technical problem, the present application further provides an apparatus for converting UOT streaming documents into OFD format documents, including:

a memory for storing a computer program;

a processor for implementing the steps of the method for converting UOT streaming documents to OFD format documents as described above when executing said computer program.

To solve the above technical problem, the present application further provides a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the method for converting UOT streaming documents into OFD format documents as described above.

The method for converting UOT streaming documents into OFD format documents comprises the following steps: reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format; classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model; converting the streaming document memory model into a format document memory model; writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format.

Therefore, according to the method for converting UOT streaming documents into OFD format documents, the memory document models corresponding to the two formats are respectively constructed in the memory, and the UOT streaming documents can be directly converted into the OFD format documents by converting the streaming document memory models into the format document memory models and further converting the format document memory models into the OFD format documents. The OFD format document after conversion has clear structure and meets the standard, the typesetting consistency can be ensured, and the layout is fixed without board running.

The device, the equipment and the computer-readable storage medium for converting UOT streaming documents into OFD format documents have the technical effects.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the prior art and the embodiments are briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.

Fig. 1 is a schematic flowchart of a method for converting UOT streaming documents into OFD format documents according to an embodiment of the present application;

FIG. 2 is a diagram illustrating an UOT format storage structure according to an embodiment of the present application;

fig. 3 is a schematic diagram of a storage structure in an OFD format according to an embodiment of the present application;

FIG. 4 is a diagram illustrating a document tree structure provided by an embodiment of the present application;

fig. 5 is a schematic diagram of an apparatus for converting UOT streaming documents into OFD format documents according to an embodiment of the present application.

Detailed Description

The core of the application is to provide a method for converting UOT streaming documents into OFD format documents, which can realize the conversion of UOT format streaming documents into OFD format documents. At the other core of the present application, there are provided an apparatus, a device and a computer-readable storage medium for converting a streaming document in UOT format into a layout document in OFD format, all of which have the above technical effects.

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

Referring to fig. 1, fig. 1 is a schematic diagram of a method for converting UOT streaming documents into OFD format documents according to an embodiment of the present application, and referring to fig. 1, the method includes:

s101: reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format;

UOT document format and OFD document format both use XML (Extensible Markup Language) Language to describe data format, and use Zip packing mode and Deflate compression method to form exchangeable single file format.

Referring to FIG. 2, the UOT structure stores documents in a multi-directory + multi-file structure. The directory includes a root directory, a metadata directory, and a data directory. The root directory mainly includes document contents, image contents, styles, extension information, and the like. The metadata directory mainly includes data information at an application level and a document level. The data directory mainly stores plug-in multimedia files.

Referring to fig. 3, the OFD structure describes and stores data in the form of container + document. The container is a virtual storage system, and aggregates various data description files and provides corresponding access interfaces and data compression methods. Documents are roughly divided into three layers, including a virtual storage system, a document model, and page content. The virtual storage system comprises a package organization structure and an in-package directory structure. The document model includes organizational structures such as documents, pages, schemas, file-level resources, and the like. The page content includes page level resources, text, graphics, images, and the like.

In view of the fact that the OFD format documents and UOT format documents have greater similarity in data structure, the method and the device adopt a mode that memory document models corresponding to two formats are respectively built in a memory, and a streaming document memory model is converted into a format document memory model, so that the format document memory model is converted into an OFD format document, and the conversion from UOT streaming documents to the OFD format documents is realized.

Step S101 is to read the UOT formatted streaming document from the disk and parse the data to obtain UOT formatted streaming document, so as to further create a corresponding streaming document memory model according to the UOT formatted streaming document data.

In a specific embodiment, reading the streaming document in UOT format and parsing to obtain data items of the streaming document in UOT format includes: decompressing the physical file of UOT streaming document in the disk to the memory; and (3) parsing UOT streaming documents in the memory, and saving each item of data of the UOT format streaming documents into a file stream.

Specifically, a stream parsing engine decompresses the physical file of the UOT stream document in the disk into the memory by using a decompression technology, and reads each part of data in the UOT stream document package structure into a file stream for storage by using an XML parsing technology.

S102: classifying and summarizing various data of the streaming document in the UOT format to obtain a memory model of the streaming document;

specifically, on the basis of reading the streaming document in UOT format and analyzing the content of the streaming document in UOT format, the data of the streaming document in UOT format is further classified and summarized by the image-text composition engine to form streaming memory structures such as text objects, image objects, metadata objects, and the like, so that the data of the streaming document in UOT format is converted into a corresponding streaming document memory model. The stream document memory model is expressed as a plurality of stream memory objects in the memory, such as text objects, graphic objects and the like, and all the objects are uniformly managed and maintained by the document objects.

S103: converting the streaming document memory model into a format document memory model;

specifically, this step is directed to converting the streaming document memory model into a layout document memory model. In a specific embodiment, converting the streaming document memory model into the layout document memory model includes: constructing a document tree structure according to each streaming memory object of the streaming document memory model by taking a document as a unit; and traversing the document tree structure, and extracting data in the stream memory object by taking a page as a unit to construct a format document memory model. Specifically, on the basis of obtaining the stream-type document memory model, the stream-type document memory model is split, recombined and typeset, and a document tree structure is constructed. And traversing the document tree structure, calculating to obtain coordinate values of the format memory objects in the container based on the data of each streaming memory object in the streaming document model, and the used character set, font, graphic element information, resources and the like, and forming the format document memory model by taking the page as a unit.

In the embodiment, a tree structure is adopted, so that the tree structure is visual and understandable on one hand; on the other hand, the tree structure has natural recursion characteristics, and is simple to operate and high in performance. Referring to fig. 4, the document tree structure in the present embodiment takes a document object as a root node, and the next layer of the document object includes a page set, a schema set, and a common resource. The page set is further composed of a plurality of pages, each page is divided into two blocks of content and page resources, and the content comprises nodes such as texts, graphs and graphs. The page resource is composed of pictures, audios and videos and other multimedia types. The outline set mainly comprises bookmarks and navigation objects.

In addition, the coordinate values of the layout memory object are calculated as follows: the page space specifies that the upper left corner of the page is the origin, the X axis increases to the right, and the Y axis increases downward. Transformation to the device space is accomplished according to origin translation, axis direction transformation, coordinate numerical transformation, and the like. The coordinate numerical transformation is to convert the length data of the primitive into the pixel length in the device through the resolution and other information of the device. The specific transformation matrix is as follows:

the transformation matrix provides a transformation rule between two coordinates, described by a one-dimensional array of length 6. Is shaped as [ a b c d e f ]]. The transformation matrix is a 3 by 3 matrix in the format ofAssuming that the coordinates before transformation, i.e. the coordinates of the streaming memory object, are (x, y), and the coordinates after transformation, i.e. the coordinates of the layout memory object, are (x ', y'), the formula is satisfied

S104: writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format.

Specifically, the storage engine writes out the format memory model to the disk according to the format standard format, so as to finally obtain the format document in the OFD format. Writing the format memory model out to a disk to generate a format document in an OFD format, wherein the method comprises the following steps: creating a blank XML file according to the specification of the format document in the OFD format; writing out each format memory object of the format document memory model to a corresponding XML file; and organizing the XML file into an electronic file physical package, and packaging and compressing to obtain the format document in the OFD format.

Specifically, the storage engine creates various blank XML files according to the specification of the format document in the OFD format, and writes out each format memory object of the format document memory model into a corresponding XML file through the write stream. Further, organizing each XML file into a single electronic physical package according to the specification, and packaging and compressing the XML files to obtain the format document in the OFD format.

In a specific real-time manner, the performing the packing compression includes: and packing and compressing by a Zip compression method and a Deflate compression method. It should be understood that the packing compression method provided by this embodiment is only one embodiment provided by this application, and is not limited to this embodiment, and other compression methods may be adopted in addition to the Deflate compression method.

In summary, the method for converting UOT streaming documents into OFD format documents provided by the present application includes: reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format; classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model; converting the streaming document memory model into a format document memory model; and writing the format memory model out to a disk to generate a format document in an OFD format. The method comprises the steps of respectively constructing memory document models corresponding to two formats in a memory, and directly converting UOT streaming documents into OFD format documents by converting the streaming document memory models into format document memory models and further converting the format document memory models into the OFD format documents. The OFD format document after conversion has clear structure and meets the standard, the typesetting consistency can be ensured, and the layout is fixed without board running.

The present application also provides an apparatus for converting UOT streaming documents into OFD format documents, which apparatus is described below and may be referred to in correspondence with the method described above. Referring to fig. 5, fig. 5 is a schematic diagram of an apparatus for converting UOT streaming documents into OFD format documents according to an embodiment of the present application, and referring to fig. 5, the apparatus includes:

the parsing module 10 is configured to read a streaming document in UOT format and parse the streaming document in UOT format to obtain various items of data of the streaming document;

the creating module 20 is configured to classify and summarize each item of data of the UOT-format streaming document to obtain a streaming document memory model;

a conversion module 30, configured to convert the streaming document memory model into a format document memory model;

and the generating module 40 is configured to write the layout memory model out to a disk according to the OFD format specification, and generate a layout document in the OFD format.

On the basis of the above embodiment, as a specific implementation manner, the conversion module 30 includes:

the first conversion unit is used for constructing a document tree structure according to each streaming memory object of the streaming document memory model by taking a document as a unit;

and the second conversion unit is used for traversing the document tree structure and extracting data in the stream memory object by taking a page as a unit to construct a format document memory model.

On the basis of the foregoing embodiment, as a specific implementation manner, the generating module 40 includes:

a creating unit configured to create a blank XML file according to a specification of the format document in the OFD format;

a writing-out unit, configured to write out each format memory object of the format document memory model to the corresponding XML file;

and the compression unit is used for organizing the XML file into an electronic file physical package, and packaging and compressing the XML file to obtain the format document in the OFD format.

On the basis of the foregoing embodiment, as a specific implementation manner, the parsing module 10 includes:

the decompression unit is used for decompressing the physical file of the UOT streaming document in the disk into an internal memory;

and the analyzing unit is used for analyzing the UOT streaming document in the memory and storing each item of data of the UOT format streaming document into a file stream.

The application also provides an apparatus for UOT converting a streaming document into an OFD format document, the apparatus comprising a memory and a processor. Wherein the memory is used for storing the computer program; a processor for executing a computer program to implement the steps of:

reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format; classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model; converting the streaming document memory model into a format document memory model; writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format.

For the introduction of the device provided in the present application, please refer to the above method embodiment, which is not described herein again.

The present application further provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:

reading a streaming document in UOT format and analyzing to obtain various data of the streaming document in UOT format; classifying and summarizing all data of the UOT format streaming document to obtain a streaming document memory model; converting the streaming document memory model into a format document memory model; writing the format memory model out to a disk according to the OFD format specification to generate a format document of the OFD format.

The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

For the introduction of the computer-readable storage medium provided in the present application, please refer to the above method embodiments, which are not described herein again.

The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device, the apparatus and the computer-readable storage medium disclosed by the embodiments correspond to the method disclosed by the embodiments, so that the description is simple, and the relevant points can be referred to the description of the method.

Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

The methods, apparatuses, devices and computer readable storage media for converting UOT streaming documents into OFD format documents provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于动态数据的演示文稿方法、系统及计算机终端设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!