CN111797595A - Method and device for generating OFD format page based on XML template - Google Patents

Method and device for generating OFD format page based on XML template Download PDF

Info

Publication number
CN111797595A
CN111797595A CN202010418994.4A CN202010418994A CN111797595A CN 111797595 A CN111797595 A CN 111797595A CN 202010418994 A CN202010418994 A CN 202010418994A CN 111797595 A CN111797595 A CN 111797595A
Authority
CN
China
Prior art keywords
metadata
ofd
xml template
generating
page based
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010418994.4A
Other languages
Chinese (zh)
Inventor
薛军超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guanqun Information Technology Nanjing Co ltd
Original Assignee
Guanqun Information Technology Nanjing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guanqun Information Technology Nanjing Co ltd filed Critical Guanqun Information Technology Nanjing Co ltd
Priority to CN202010418994.4A priority Critical patent/CN111797595A/en
Publication of CN111797595A publication Critical patent/CN111797595A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/189Automatic justification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method for generating an OFD format page based on an XML template, which comprises the following steps: acquiring an XML template, wherein the XML template comprises a series of metadata; sequentially reading the metadata; converting the metadata into an OFD file meeting the standard according to the type of the metadata; and outputting the OFD file. The invention generates the OFD layout page through the XML template, has the advantages of convenience, flexibility and unification, and helps an application to generate OFD files with the same layout display effect in batch.

Description

Method and device for generating OFD format page based on XML template
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating an OFD format page based on an XML template.
Background
The OFD (Open file-layout Document, abbreviation: OFD) is the format of the format Document of our country defined by the national standard GB/T33190-2016 electronic file storage and exchange format Document of our country. The OFD meets the requirement of informatization construction in China, and is becoming one of the basic standards of informatization application of various industries in China. By the layout document, the page content described by the layout document has fixed appearance information such as position, size, color and the like, and the display effect of the page content on all terminals is completely fixed and consistent.
The OFD is a compressed package file in the ZIP compressed format with a file suffix ". OFD", so that the OFD is essentially a ZIP compressed package. According to the standard definition, the OFD contains two types of data files: a is the file and page information stored in XML format, it defines the basic information of the format file; and the other is resource information stored in other formats, such as a resource file in a font, an image, multimedia, and the like.
XML, Extensible Markup Language (XML), is an international popular universal data description Language format, and has many advantages such as simplicity, easy understanding, and easy application. The OFD adopts the basic information description format as a format document, and can be said to be the core data format of the OFD.
There is currently an important need in OFD format applications: it is necessary to generate files in a fixed layout format in batch, where the fixed layout format is the same but different in data content. In practical application, a large number of application scenarios exist, such as electronic invoices or electronic certificates, which are characterized in that the layout format is completely fixed, only the contents of the invoices or the certificates are different, and the applications need to be generated in a large number and for a long time. The existing solution is to directly generate the OFD full page data through a computer program, which needs to redesign and regenerate the computer program every time, and has complex application process and low execution efficiency.
Disclosure of Invention
In view of the above problems, the present invention provides a method and apparatus for generating an OFD layout page based on an XML template.
In order to solve the technical problems, the invention adopts the technical scheme that: a method for generating an OFD format page based on an XML template comprises the following steps: acquiring an XML template, wherein the XML template comprises a series of metadata; sequentially reading the metadata; converting the metadata into an OFD file meeting the standard according to the type of the metadata; and outputting the OFD file.
As a preferred scheme, before the obtaining of the XML template, generating the XML template further includes: acquiring original data; respectively converting the original data into metadata according to the types of the original data; and combining a plurality of metadata in sequence to generate an XML template.
Preferably, each of said metadata includes one or more of the following information: metadata name, metadata value, metadata type, metadata location, and metadata attributes.
As a preferred scheme, the converting the metadata into an OFD file meeting the standard according to the type of the metadata specifically includes: when the metadata is of a character type, typesetting the characters in the metadata, acquiring the position information of each character and then outputting the position information in an OFD (office format description) form; and when the metadata is of a picture type, the pictures in the metadata are output in an OFD form after the scaling and the rotation coefficient are calculated.
Preferably, the method further comprises embedding the font, and adding the specified font into the OFD file.
Preferably, the method can also be applied to generating a PDF layout page.
The invention also discloses a device for generating the OFD layout page based on the XML template, which comprises the following steps: an obtaining module, configured to obtain an XML template, where the XML template includes a series of metadata; the reading module is used for sequentially reading the metadata; the conversion module is used for converting the metadata into an OFD file meeting the standard according to the type of the metadata; and the output module is used for outputting the OFD file.
As a preferred scheme, the system further comprises a generating module, wherein the generating module is used for acquiring original data, respectively converting the original data into metadata according to the type of the original data, and sequentially combining a plurality of metadata to generate the XML template.
As a preferred scheme, the conversion module comprises a character conversion module and an image conversion module; the character conversion module is used for typesetting the characters in the metadata, acquiring the position information of each character and outputting the position information in an OFD (office file format); and the picture conversion module is used for outputting the pictures in the metadata in an OFD form after calculating the scaling and the rotation coefficient.
Preferably, the OFD file system further comprises an embedding module, wherein the embedding module is used for adding the specified font to the OFD file.
Compared with the prior art, the invention has the beneficial effects that: the method comprises the steps of templating a layout page, making the layout page content of a fixed part into an OFD page template, supplementing variable content to an OFD layout page, separating layout design through the templating of the layout page, designing layout through a template designer, namely expressing the content of the fixed layout, and defining the position, size and other presentation effects of the variable content part, so that simplified application and execution efficiency are improved in batch generation.
Drawings
The disclosure of the present invention is illustrated with reference to the accompanying drawings. It is to be understood that the drawings are designed solely for the purposes of illustration and not as a definition of the limits of the invention. In the drawings, like reference numerals are used to refer to like parts. Wherein:
fig. 1 is a flowchart of a method for generating an OFD layout page based on an XML template in an embodiment of the present invention;
FIG. 2 is a flow chart of a method for generating an XML template according to an embodiment of the present invention;
fig. 3 is a structural diagram of an apparatus for generating an OFD format based on an XML template according to an embodiment of the present invention;
fig. 4 is a structural diagram of a conversion module in an embodiment of the present invention.
Detailed Description
It is easily understood that according to the technical solution of the present invention, a person skilled in the art can propose various alternative structures and implementation ways without changing the spirit of the present invention. Therefore, the following detailed description and the accompanying drawings are merely illustrative of the technical aspects of the present invention, and should not be construed as all of the present invention or as limitations or limitations on the technical aspects of the present invention.
An embodiment according to the present invention is shown in connection with fig. 1. A method for generating an OFD format page based on an XML template comprises the following steps:
s110: an XML template is obtained, the XML template including a series of metadata.
Specifically, each metadata includes the following information:
metadata names, each metadata name must be unique and readable character string.
Metadata values refer to data values defined by metadata.
The metadata type, which refers to a metadata value type, can be extended, such as text (i.e., character string), image, date, and the like.
Metadata positioning, which specifies the location and size (width, height) of metadata values within the layout page.
The metadata attribute is related to the metadata type, different types of attributes are set differently, for example, the metadata attribute of the text type has a font, a font size, a character color, a font style (bold, italic) and the like, and the data attribute of the image type can have a transparency or a rotation angle and the like.
As shown in fig. 2, before obtaining the XML template, the method further includes generating the XML template, and the specific steps are as follows:
and S210, acquiring original data.
And S220, respectively converting the original data into metadata according to the type of the original data. For the type of the original data being binary, the code conversion is needed to be performed, and the original data is converted into a data expression form conforming to the XML format standard, and the common code conversion is BASE-64, for example, the code conversion is needed for the data value of the image or the two-dimensional code type.
And S230, combining the plurality of metadata in sequence to generate the XML template.
In this embodiment, examples of the XML template metadata are as follows:
Figure BDA0002496131300000041
Figure BDA0002496131300000051
s120: the metadata is read in sequence, starting with the first piece of metadata of the XML template, one piece of metadata is read in sequence each time.
S130: and converting the metadata into an OFD file meeting the standard according to the type of the metadata, wherein the OFD file is required to be typeset, for example, the character type, then the position information of each character is acquired and output in an OFD form, and the image is output in the OFD form after the scaling and the rotation coefficient are calculated.
If the XML template contains data of a plurality of pages, processing of the next page is continued after one page is processed until the end.
S140: and outputting the OFD file.
According to the OFD standard, embedded fonts should be used for the archived OFD files to ensure that the OFD files are displayed identically on all platforms, so embedded fonts are used for files whose metadata type is text. The embedded font is to add character font data used in a designated font to the OFD file. The detailed processing procedure of the embedded font does not belong to the protection scope of the patent, and is not described herein.
It should be understood that the invention discloses a method for generating an OFD layout page based on an XML template, which helps an application person generate OFD files with the same layout display effect in batch. In batch generation, each piece of XML template metadata defines an OFD file, and the same generation process is executed, and the process is circulated until all the OFD files are generated. The XML template metadata may come from a database, from a network, or a combination of both or other data environments. The method can also be applied to format pages in PDF (Portable document Format) and other formats based on XML (extensive Makeup language) templates.
As shown in fig. 3 and fig. 4, the present invention also discloses a device for generating an OFD layout page based on an XML template, which includes:
an obtaining module 110, configured to obtain an XML template, where the XML template includes a series of metadata;
a reading module 120, configured to read the metadata in sequence;
the conversion module 130 is used for converting the metadata into an OFD file meeting the standard according to the type of the metadata, and the conversion module 130 comprises a character conversion module 1301 and an image conversion module 1302; the text conversion module 1301 is used for typesetting the characters in the metadata, acquiring the position information of each character and outputting the position information;
the picture conversion module 1302 is configured to calculate a scaling factor and a rotation factor of a picture in the metadata and then output the picture.
And an output module 140, configured to output the OFD file.
In this embodiment, the apparatus further includes a generating module 100, where the generating module 100 is configured to obtain the original data, respectively convert the original data into metadata according to the type of the original data, and sequentially combine the metadata to generate an XML template.
An embedding module 150 is also included, the embedding module 150 being configured to add the specified font to the OFD file.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The technical scope of the present invention is not limited to the above description, and those skilled in the art can make various changes and modifications to the above-described embodiments without departing from the technical spirit of the present invention, and such changes and modifications should fall within the protective scope of the present invention.

Claims (10)

1. A method for generating an OFD format page based on an XML template is characterized by comprising the following steps:
acquiring an XML template, wherein the XML template comprises a series of metadata;
sequentially reading the metadata;
converting the metadata into an OFD file meeting the standard according to the type of the metadata;
and outputting the OFD file.
2. The method for generating an OFD layout page based on the XML template according to claim 1, further comprising generating the XML template before the obtaining the XML template, the specific steps being:
acquiring original data;
respectively converting the original data into metadata according to the types of the original data;
and combining a plurality of metadata in sequence to generate an XML template.
3. The method for generating an OFD layout page based on an XML template according to claim 1, wherein each of the metadata includes one or more of the following information: metadata name, metadata value, metadata type, metadata location, and metadata attributes.
4. The method for generating an OFD layout page based on the XML template according to claim 3, wherein the converting the metadata into the standard-compliant OFD file according to the type of the metadata specifically comprises:
when the metadata is of a character type, typesetting the characters in the metadata, acquiring the position information of each character and then outputting the position information in an OFD (office format description) form;
and when the metadata is of a picture type, the pictures in the metadata are output in an OFD form after the scaling and the rotation coefficient are calculated.
5. The method for generating an OFD layout page based on the XML template of claim 1, further comprising embedding a font, adding a specified font to the OFD file.
6. The method for generating OFD layout pages based on XML templates according to claim 1, wherein the method is further applicable to generating PDF layout pages.
7. An apparatus for generating an OFD layout page based on an XML template, comprising:
an obtaining module, configured to obtain an XML template, where the XML template includes a series of metadata;
the reading module is used for sequentially reading the metadata;
the conversion module is used for converting the metadata into an OFD file meeting the standard according to the type of the metadata;
and the output module is used for outputting the OFD file.
8. The apparatus for generating an OFD layout page based on the XML template of claim 7, further comprising a generating module, wherein the generating module is configured to obtain original data, convert the original data into metadata according to types of the original data, and sequentially combine a plurality of metadata to generate the XML template.
9. The apparatus for generating an OFD layout page based on the XML template of claim 7, wherein the conversion module comprises a text conversion module and a picture conversion module;
the character conversion module is used for typesetting the characters in the metadata, acquiring the position information of each character and outputting the position information in an OFD (office file format);
and the picture conversion module is used for outputting the pictures in the metadata in an OFD form after calculating the scaling and the rotation coefficient.
10. The apparatus for generating an OFD layout page based on the XML template of claim 7, further comprising an embedding module, wherein the embedding module is configured to add a specified font to the OFD file.
CN202010418994.4A 2020-05-18 2020-05-18 Method and device for generating OFD format page based on XML template Pending CN111797595A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010418994.4A CN111797595A (en) 2020-05-18 2020-05-18 Method and device for generating OFD format page based on XML template

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010418994.4A CN111797595A (en) 2020-05-18 2020-05-18 Method and device for generating OFD format page based on XML template

Publications (1)

Publication Number Publication Date
CN111797595A true CN111797595A (en) 2020-10-20

Family

ID=72806116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010418994.4A Pending CN111797595A (en) 2020-05-18 2020-05-18 Method and device for generating OFD format page based on XML template

Country Status (1)

Country Link
CN (1) CN111797595A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113160356A (en) * 2021-03-22 2021-07-23 上海阳光睿玺信息科技有限公司 Python-based clothing picture template batch processing display system
CN113255317A (en) * 2021-05-31 2021-08-13 深圳高灯计算机科技有限公司 OFD format invoice analysis method, system and equipment based on cloud service
CN113688619A (en) * 2021-08-05 2021-11-23 深圳集智数字科技有限公司 PDF document generation method and device, electronic equipment and storage medium
CN114185855A (en) * 2022-02-15 2022-03-15 中博信息技术研究院有限公司 Simplified method and system for generating OFD file based on JSON
CN114970487A (en) * 2022-07-27 2022-08-30 中建电子商务有限责任公司 Method for generating OFD electronic contract based on rich text

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346322A (en) * 2013-08-08 2015-02-11 北大方正集团有限公司 Document format processing device and document format processing method
CN107688557A (en) * 2016-08-03 2018-02-13 北大方正集团有限公司 Composition method, composing system and terminal
CN108921627A (en) * 2018-06-07 2018-11-30 国信电子票据平台信息服务有限公司 A kind of method and system generating electronic invoice OFD layout files
CN109829139A (en) * 2019-01-30 2019-05-31 中国软件与技术服务股份有限公司 The method and apparatus that a kind of stream-oriented file of DOC/DOCX format is converted into the layout files of OFD format
CN109977088A (en) * 2019-03-30 2019-07-05 湖北畅云时讯软件技术有限公司 A kind of method that preset format file is converted to OFD format

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346322A (en) * 2013-08-08 2015-02-11 北大方正集团有限公司 Document format processing device and document format processing method
US20150046797A1 (en) * 2013-08-08 2015-02-12 Peking University Founder Group Co., Ltd. Document format processing apparatus and document format processing method
CN107688557A (en) * 2016-08-03 2018-02-13 北大方正集团有限公司 Composition method, composing system and terminal
CN108921627A (en) * 2018-06-07 2018-11-30 国信电子票据平台信息服务有限公司 A kind of method and system generating electronic invoice OFD layout files
CN109829139A (en) * 2019-01-30 2019-05-31 中国软件与技术服务股份有限公司 The method and apparatus that a kind of stream-oriented file of DOC/DOCX format is converted into the layout files of OFD format
CN109977088A (en) * 2019-03-30 2019-07-05 湖北畅云时讯软件技术有限公司 A kind of method that preset format file is converted to OFD format

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郭晓云;: "国家版式文档格式规范(OFD)标准", 兰台世界, no. 03, pages 33 - 36 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113160356A (en) * 2021-03-22 2021-07-23 上海阳光睿玺信息科技有限公司 Python-based clothing picture template batch processing display system
CN113160356B (en) * 2021-03-22 2024-02-02 上海阳光睿玺信息科技有限公司 Clothing picture template batch processing display system based on Python
CN113255317A (en) * 2021-05-31 2021-08-13 深圳高灯计算机科技有限公司 OFD format invoice analysis method, system and equipment based on cloud service
CN113255317B (en) * 2021-05-31 2021-11-30 深圳高灯计算机科技有限公司 OFD format invoice analysis method, system and equipment based on cloud service
CN113688619A (en) * 2021-08-05 2021-11-23 深圳集智数字科技有限公司 PDF document generation method and device, electronic equipment and storage medium
CN114185855A (en) * 2022-02-15 2022-03-15 中博信息技术研究院有限公司 Simplified method and system for generating OFD file based on JSON
CN114185855B (en) * 2022-02-15 2022-05-24 中博信息技术研究院有限公司 Simplified method and system for generating OFD file based on JSON
CN114970487A (en) * 2022-07-27 2022-08-30 中建电子商务有限责任公司 Method for generating OFD electronic contract based on rich text
CN114970487B (en) * 2022-07-27 2023-01-06 中建电子商务有限责任公司 Method for generating OFD electronic contract based on rich text

Similar Documents

Publication Publication Date Title
CN111797595A (en) Method and device for generating OFD format page based on XML template
US9110877B2 (en) Method and apparatus for utilizing an extensible markup language schema for managing specific types of content in an electronic document
US20150046797A1 (en) Document format processing apparatus and document format processing method
EP1126380A1 (en) Converting a formatted document into an XML-document
US20050235202A1 (en) Automatic graphical layout printing system utilizing parsing and merging of data
US20090282389A1 (en) Abstracting Test Cases From Application Program Interfaces
CN113609820B (en) Method, device and equipment for generating word file based on extensible markup language file
CN114118007B (en) Method for converting format data stream file into OFD file
CN110879937A (en) Method and device for generating webpage from document, computer equipment and storage medium
US20130318435A1 (en) Load-Time Memory Optimization
US20210019366A1 (en) Text Extraction Heuristics
CN112487763A (en) SVG-based OFD file online display method, server side and system
CN111881651A (en) Method for converting UOT streaming document into OFD format document
CN112699641A (en) Method for quickly converting batch copy of WORD content to DM based on S1000D standard
CN115757272A (en) Method and system for converting HTML file into OFD file
CN106776994B (en) Application method and system of engineering symbols in engineering report forms and web pages
CN114791988A (en) Browser-based PDF file analysis method, system and storage medium
CN113934955A (en) Method for generating display PPT file by browser, browser and storage medium
CN111143749A (en) Webpage display method, device, equipment and storage medium
CN103488619B (en) Method and device for processing document file
CN111768823B (en) SVG element-based medical expression editing method, device, equipment and medium
CN111913703B (en) Object editing method, device, electronic equipment and readable storage medium
CN111222310A (en) Method and system for inputting and displaying irregular form
Goldfarb Future directions in SGML/XML
CN116776828B (en) Text rendering method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination