CN114185855A - Simplified method and system for generating OFD file based on JSON - Google Patents

Simplified method and system for generating OFD file based on JSON Download PDF

Info

Publication number
CN114185855A
CN114185855A CN202210134990.2A CN202210134990A CN114185855A CN 114185855 A CN114185855 A CN 114185855A CN 202210134990 A CN202210134990 A CN 202210134990A CN 114185855 A CN114185855 A CN 114185855A
Authority
CN
China
Prior art keywords
template
file
ofd
json
data
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.)
Granted
Application number
CN202210134990.2A
Other languages
Chinese (zh)
Other versions
CN114185855B (en
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.)
Zhongbo Information Technology Research Institute Co ltd
Original Assignee
Zhongbo Information Technology Research Institute 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 Zhongbo Information Technology Research Institute Co ltd filed Critical Zhongbo Information Technology Research Institute Co ltd
Priority to CN202210134990.2A priority Critical patent/CN114185855B/en
Publication of CN114185855A publication Critical patent/CN114185855A/en
Application granted granted Critical
Publication of CN114185855B publication Critical patent/CN114185855B/en
Priority to LU503248A priority patent/LU503248B1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a simplified method and a simplified system for generating an OFD file based on JSON (Java Server object notation), belonging to the technical field of electronic documents, and comprising the steps of generating a template file in a JSON format in a template design module, storing the template file into a template library, uploading document JSON data uploaded by a user to a server by a data uploading module, and converting an object into an object in an XML format according to the object, the attribute and the data of the template file by an object conversion module; the file generation module combines the objects in the XML format into the OFD file, so that the technical problem of simplifying the file generation process according with the OFD standard is solved, the data volume of generating one OFD file is reduced, the readability of the data is improved, and the popularization efficiency of using the OFD file in the fields of electronic documents, archives, electronic bills, electronic contracts and the like can be effectively improved.

Description

Simplified method and system for generating OFD file based on JSON
Technical Field
The invention belongs to the technical field of electronic documents, and relates to a simplified method and a simplified system for generating an OFD (office file) based on JSON (Java Server pages).
Background
The OFD format document format integrates national high-quality industrial resources, is beneficial to forming competitive advantages for PDF and other related foreign standards finally, and is beneficial to promoting the benign development of format related technologies and industries in China.
Because documents such as electronic bills, electronic contracts, electronic files and the like which are commonly used in most industries have a certain format, the documents can be made into modules for recycling. However, since the OFD uses XML to describe the document, the standard description is complex, which is not beneficial to the production of the template, and forms a certain obstacle to the popularization of the OFD format document.
Disclosure of Invention
The invention aims to provide a method and a system for simplifying the OFD file generation based on JSON, which solve the technical problem of simplifying the file generation process according with the OFD standard.
In order to achieve the purpose, the invention adopts the following technical scheme:
a simplified method for generating an OFD file based on JSON comprises the following steps:
step 1: establishing a template design module, and generating a template file in a JSON format in the template design module, wherein the template file comprises an object, attributes and data of a document serving as a template;
step 2: storing the template files into a template library, wherein a plurality of template files are stored in the template library;
and step 3: the data uploading module receives document JSON data uploaded by a user and uploads the document JSON data to a server, the document JSON data is composed in a key-value form, the key is an id attribute of an object in a template file, and the value is a character string, an array or JSON;
one template file comprises a plurality of objects, the id attribute of each object corresponds to one key, and the id attributes of the plurality of objects can be the same;
and 4, step 4: the object conversion module converts the object into an object in an XML format according to the OFD standard according to the object, the attribute and the data of the template file;
and 5: the file generation module combines the objects in the XML format into an OFD file. Preferably, when step 2 is executed, the template file is provided with a unique template name, and the template file is identified by the template name.
Preferably, when step 4 is executed, the method specifically includes the following steps:
step 4-1: calling a template file in a template library through the template name, and obtaining all objects corresponding to the id attribute in the template file according to the key to obtain an object to be converted;
step 4-2: the processing is performed according to the following conditions:
step S4-2-1: if the value of the data of the object to be converted is a character string, directly assigning the character string to the value attribute of the object to be converted;
step S4-2-2: if the value of the data of the object to be converted is the character string array, copying the object to be converted into a plurality of object copies to be converted with the same length as the array, and respectively assigning each value of the array to the value attribute of each object copy to be converted in sequence;
step S4-2-3: if the value of the data of the object to be converted is in the JSON format, respectively and correspondingly replacing each attribute value of the object to be converted by each attribute value in the JSON;
step S4-2-4: and converting the object to be converted or the copy of the object to be converted into the object in the XML format according to the OFD standard.
Preferably, when step 5 is executed, the main content of the XML-formatted object is saved into the page of the OFD document, and the font, color and resource referred to by the XML-formatted object are saved into the public res.xml, document res.xml and Res directories of the OFD document, respectively.
A simplified system for generating OFD files based on JSON comprises a template design module, a template library, a data uploading module and a server, wherein the template design module, the template library, the data uploading module and the server are communicated with each other through the Internet; establishing an object conversion module and a file generation module in a server;
the template design module is used for providing a visual human-computer interaction interface for a user and generating a template file;
the template library is used for storing template files and establishing indexes according to template names of the template files;
the data uploading module is used for uploading data of the OFD file required to be generated by the user to the server;
the object conversion module is used for converting the object in the JSON format into an XML format;
the file generation module is used for assembling all the converted XML format objects into an OFD file.
Preferably, the template library is deployed in a database server.
The invention has the beneficial effects that:
the invention relates to a method and a system for simplifying the OFD file generation based on JSON, which solve the technical problem of simplifying the file generation process conforming to the OFD standard.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
Example 1:
as shown in fig. 1, a simplified method for generating an OFD file based on JSON includes the following steps:
step 1: and establishing a template design module, and generating a template file in a JSON format in the template design module, wherein the template file comprises an object, attributes and data of a document serving as a template.
In this embodiment, a user generates a template file in JSON format using a template design module, where the contents of the template file are:
{ name : "tpl1",
paper : {width : 210,height : 297},
defaults : {lineWidth : 0.2},
objects : [{type : "Text",id : "dept",
box : {x:100,y:7,width:20,height:6.35},
font: { name: "Song body", bold: true, size:6.61},
dX:6.5, dY:5.5, color: { rgb: "1568235" }, value: "title" },
{type:"Image",id:"3",
box:{x:168,y:3.5,width:15,height:15}},
{type:"Line",color:{rgb:"156 82 35"},
x1:68.5,y1:2,x2:141.5,y2:2},
{type:"Rectangle",color:{rgb:"0 0 0"},
fillColor:{rgb:"255 250 205"},lineWidth:0.15,
x:5,y:30,width:200,height:260},
{type:"Path",ctm:"0.45 0 0 0.45 0 0",
box:{x:168,y:97.8,width:5,height:5},
color:{alpha:200,rgb:"0 0 0"},
loop: {count: 5,dX: 6},lineWidth:"0.25",
value:"M 10.07 5.54 B 10.07 3.04 8.04 1 5.53 1 L 8.7 2.3"
}, {type:"Image",id:"2",
box:{x:58.5,y:135,width:70,height:50}},
{type:"Barcode",id:"cardNum",box:{x:2,y:1,width:30,height:10},
codeType:"CODE_128",moduleWidth: 2,resolution: 150}…]}。
step 2: storing the template files into a template library, wherein a plurality of template files are stored in the template library; the template file is provided with a unique template name, and the template file is identified by the template name, for example, the template name is "tpl 1" in this embodiment.
And step 3: the data uploading module receives document JSON data uploaded by a user and uploads the document JSON data to a server, the document JSON data are composed in a key-value form, the key is an id attribute of an object in a template file, and the value is a character string, an array or JSON.
A template file comprises a plurality of objects, the id attribute of each object corresponds to a key, and the id attributes of the objects can be the same.
In this embodiment, the content of the data uploaded by the user to generate the OFD file is:
{
pages : [ {template:"tpl1",
data:{
"depth": ABC department ",
"cardNum":"111111111",
"2":"data:image/jpg;base64,/9j/…/Z"…
}
} ],
docInfo:{
author: "author 1", title: "title x" },
customDatas:[ {name:"PQB_ID",value:"111"}, {
name:"AAA_ID",value:"22"} ],
attachments:[ {filename:"data.txt",
content, "attachment content …" } ",
}。
and 4, step 4: the object conversion module converts the object into the object in the XML format according to the OFD standard according to the object, the attribute and the data of the template file, and specifically comprises the following steps:
step 4-1: calling a template file in a template library through the template name, and obtaining all id attributes of objects in the template file according to keys to obtain an object to be converted; for example, in this embodiment, the content of the template file with the template name "tpl 1" is read from the template library to obtain a list of objects to be converted, the content under the data node of the data uploaded by the user is traversed, and the id in the template content is searched according to the key of each key value pair to obtain an object to be converted.
Step 4-2: the processing is performed according to the following conditions:
step S4-2-1: and if the value of the data of the object to be converted is the character string, directly assigning the character string to the value attribute of the object to be converted.
Step S4-2-2: if the value of the data of the object to be converted is the character string array, copying the object to be converted into a plurality of copies of the object to be converted with the same length as the array, and respectively assigning each value of the array to the value attribute of each copy of the object to be converted in sequence.
Step S4-2-3: and if the value of the data of the object to be converted is in the JSON format, respectively and correspondingly replacing each attribute value of the object to be converted by each attribute value in the JSON.
Step S4-2-4: converting the object to be converted or the copy of the object to be converted into the object in the XML format according to the OFD standard, wherein the conversion process specifically comprises the following steps:
step S4-2-4-1: the Page object is converted to the ofd: PageArea object of Doc _0\ Pages \ Page _ N \ content.
Step S4-2-4-2: convert Font, color attributes to ofd: Font, ofd: ColorSpace object for Doc _0\ public res.
Step S4-2-4-3: convert image attributes to ofd: MultiMedia objects for Doc _0\ DocumentRes.
Step S4-2-4-4: the objects in the objects array are converted into ofd: TextObject, ofd: PathObject and ofd: ImageObject objects of Doc _0\ Page _ N \ content.
Step S4-2-4-5: docInfo is converted to ofd: docInfo object in ofd.
Step S4-2-4-6: customDatas were converted to ofd: customDatas object in ofd.
Step S4-2-4-7: the objects in the attributes array are converted to ofd: attributes objects for Doc _0\ attributes.
And 5: the file generation module combines the XML-format objects into an OFD file, main contents of the XML-format objects are stored in pages of the OFD document, and fonts, colors and resources which are referred to by the XML-format objects are respectively stored in public Res.xml, DocumentRes.xml and Res directories of the OFD document.
Example 2:
the simplification system for generating an OFD file based on JSON described in embodiment 2 is a system used in cooperation with the simplification method for generating an OFD file based on JSON described in embodiment 1, and includes a template design module, a template library, a data upload module, and a server, where the template design module, the template library, the data upload module, and the server are in communication with each other via the internet; and establishing an object conversion module and a file generation module in the server.
The template design module is used for providing a visual human-computer interaction interface for a user and generating a template file.
The template library is used for storing template files and establishing indexes according to template names of the template files.
And the data uploading module is used for uploading the data of the OFD file required to be generated by the user to the server.
The object conversion module is used for converting the JSON format object into the XML format.
The file generation module is used for assembling all the converted XML format objects into an OFD file.
Preferably, the template library is deployed in a database server.
The invention relates to a method and a system for simplifying the OFD file generation based on JSON, which solve the technical problem of simplifying the file generation process conforming to the OFD standard.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (6)

1. A simplified method for generating an OFD file based on JSON is characterized in that: the method comprises the following steps:
step 1: establishing a template design module, and generating a template file in a JSON format in the template design module, wherein the template file comprises an object, attributes and data of a document serving as a template;
step 2: storing the template files into a template library, wherein a plurality of template files are stored in the template library;
and step 3: the data uploading module receives document JSON data uploaded by a user and uploads the document JSON data to a server, the document JSON data is composed in a key-value form, the key is an id attribute of an object in a template file, and the value is a character string, an array or JSON;
one template file comprises a plurality of objects, the id attribute of each object corresponds to one key, and the id attributes of the plurality of objects can be the same;
and 4, step 4: the object conversion module converts the object into an object in an XML format according to the OFD standard according to the object, the attribute and the data of the template file;
and 5: the file generation module combines the objects in the XML format into an OFD file.
2. The simplified method for generating OFD files based on JSON of claim 1, wherein: and when the step 2 is executed, the template file is provided with a unique template name, and the template file is identified through the template name.
3. The simplified method for generating OFD files based on JSON of claim 2, wherein: when step 4 is executed, the method specifically comprises the following steps:
step 4-1: calling a template file in a template library through the template name, and obtaining all objects corresponding to the id attribute in the template file according to the key to obtain an object to be converted;
step 4-2: the processing is performed according to the following conditions:
step S4-2-1: if the value of the data of the object to be converted is a character string, directly assigning the character string to the value attribute of the object to be converted;
step S4-2-2: if the value of the data of the object to be converted is the character string array, copying the object to be converted into a plurality of object copies to be converted with the same length as the array, and respectively assigning each value of the array to the value attribute of each object copy to be converted in sequence;
step S4-2-3: if the value of the data of the object to be converted is in the JSON format, respectively and correspondingly replacing each attribute value of the object to be converted by each attribute value in the JSON;
step S4-2-4: and converting the object to be converted or the copy of the object to be converted into the object in the XML format according to the OFD standard.
4. The simplified method for generating OFD files based on JSON of claim 1, wherein: when step 5 is executed, the main content of the XML-formatted object is saved into the page of the OFD document, and the font, color and resource referred to by the XML-formatted object are saved into the public res.xml, document res.xml and Res directories of the OFD document, respectively.
5. A simplified system for implementing the simplified method for generating an OFD file based on JSON of claim 1, characterized in that: the system comprises a template design module, a template library, a data uploading module and a server, wherein the template design module, the template library, the data uploading module and the server are communicated with each other through the Internet; establishing an object conversion module and a file generation module in a server;
the template design module is used for providing a visual human-computer interaction interface for a user and generating a template file;
the template library is used for storing template files and establishing indexes according to template names of the template files;
the data uploading module is used for uploading data of the OFD file required to be generated by the user to the server;
the object conversion module is used for converting the object in the JSON format into an XML format;
the file generation module is used for assembling all the converted XML format objects into an OFD file.
6. The simplified system of claim 5, wherein: the template library is deployed in a database server.
CN202210134990.2A 2022-02-15 2022-02-15 Simplified method and system for generating OFD file based on JSON Active CN114185855B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210134990.2A CN114185855B (en) 2022-02-15 2022-02-15 Simplified method and system for generating OFD file based on JSON
LU503248A LU503248B1 (en) 2022-02-15 2022-12-23 Simplified method and system for generating ofd file based on json

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210134990.2A CN114185855B (en) 2022-02-15 2022-02-15 Simplified method and system for generating OFD file based on JSON

Publications (2)

Publication Number Publication Date
CN114185855A true CN114185855A (en) 2022-03-15
CN114185855B CN114185855B (en) 2022-05-24

Family

ID=80545901

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210134990.2A Active CN114185855B (en) 2022-02-15 2022-02-15 Simplified method and system for generating OFD file based on JSON

Country Status (2)

Country Link
CN (1) CN114185855B (en)
LU (1) LU503248B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116822458A (en) * 2023-08-31 2023-09-29 安徽产业互联数据智能创新中心有限公司 Digital paper generation method, system and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109977088A (en) * 2019-03-30 2019-07-05 湖北畅云时讯软件技术有限公司 A kind of method that preset format file is converted to OFD format
CN110909523A (en) * 2019-12-02 2020-03-24 中国银行股份有限公司 Data processing method and device
CN111797595A (en) * 2020-05-18 2020-10-20 冠群信息技术(南京)有限公司 Method and device for generating OFD format page based on XML template
CN112883022A (en) * 2021-03-18 2021-06-01 武汉众邦银行股份有限公司 XML template-based object data cleaning and converting method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109977088A (en) * 2019-03-30 2019-07-05 湖北畅云时讯软件技术有限公司 A kind of method that preset format file is converted to OFD format
CN110909523A (en) * 2019-12-02 2020-03-24 中国银行股份有限公司 Data processing method and device
CN111797595A (en) * 2020-05-18 2020-10-20 冠群信息技术(南京)有限公司 Method and device for generating OFD format page based on XML template
CN112883022A (en) * 2021-03-18 2021-06-01 武汉众邦银行股份有限公司 XML template-based object data cleaning and converting method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116822458A (en) * 2023-08-31 2023-09-29 安徽产业互联数据智能创新中心有限公司 Digital paper generation method, system and equipment

Also Published As

Publication number Publication date
CN114185855B (en) 2022-05-24
LU503248B1 (en) 2023-06-26

Similar Documents

Publication Publication Date Title
EP2569703B1 (en) Executing transcription requests on files
CN102279847A (en) Method and device for internationalizing software system
CN114185855B (en) Simplified method and system for generating OFD file based on JSON
CN103092890A (en) System and method for automatic generation and sending of reports
CN101441713A (en) Optical character recognition method and apparatus of PDF document
CN103886046A (en) Automatic semanteme extraction method for Web data exchange
CN111753717A (en) Method, apparatus, device and medium for extracting structured information of text
CN111797595A (en) Method and device for generating OFD format page based on XML template
CN115630618A (en) Intelligent scene editing method, system, equipment and medium for PDF document
CN106815181B (en) Method and device for converting Indesign typesetted ind files into Office files
CN117454846B (en) Method for converting XSD file into JSON file
CN109471957B (en) Metadata conversion method and device based on uniform tags
Ide et al. Bridging the gaps: interoperability for GrAF, GATE, and UIMA
CN114238731A (en) Domestic CPU retrieval method, system, device and computer readable medium
CN110580330B (en) File processing method for filling electronic form
Růžička Automated processing of TEX-typeset articles for a digital library
JP2008257355A (en) Electronic device, method for creating web page, and program for creating web page
Da et al. Program design of JSON to structured data conversion
CN109508183B (en) REST code generation method and device in storage cluster
JP2004145736A (en) Character recognition device, character recognition data output method, program and recording medium
CN114492356A (en) Output method, computing device and storage medium of user-defined report document
JP3724728B2 (en) Structured document processing device
CN114239491A (en) Gas turbine interactive electronic technical manual intelligent data module acquisition and conversion method
Sojka et al. Accessibility Issues in Digital Mathematical Libraries
CN116306515A (en) Method for generating OFD document with index through HTML (hypertext markup language) form

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
GR01 Patent grant
GR01 Patent grant