CN116050370A - Template data processing method, system and related equipment - Google Patents
Template data processing method, system and related equipment Download PDFInfo
- Publication number
- CN116050370A CN116050370A CN202211736138.9A CN202211736138A CN116050370A CN 116050370 A CN116050370 A CN 116050370A CN 202211736138 A CN202211736138 A CN 202211736138A CN 116050370 A CN116050370 A CN 116050370A
- Authority
- CN
- China
- Prior art keywords
- template
- html
- information
- initial
- target
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/186—Templates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/151—Transformation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
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)
- Document Processing Apparatus (AREA)
Abstract
The application discloses a template data processing method, a system and related equipment, wherein the method comprises the following steps: converting the HTML intermediate template into a JSON format template; searching for to-be-printed section information corresponding to target field information in to-be-printed data, and arranging the to-be-printed section information in a JSON format template according to target style information to generate output data in an HTML format; and printing and outputting the data. The function of the HTML intermediate template can be regarded as that the initial template is stored and applied according to the HTML format, so that the data to be printed can be subjected to subsequent processing, the field information to be printed can be adaptively and rapidly distributed according with the target style information on the basis of the operable HTML intermediate template, the required HTML format output data can be conveniently and efficiently obtained, and the expansibility and the practicability of the template to be printed are improved. In addition, the template has high stability and compatibility by means of the standardization and stability of the HTML format, and is convenient and flexible to apply.
Description
Technical Field
The embodiment of the application relates to the technical field of Internet, in particular to a template data processing method, a template data processing system and related equipment.
Background
In daily applications, it is often necessary to store a set of templates, so that specific print data can be quickly added on the basis of the templates to form a desired printed document.
Typically, the designed external template (or called the initial template) is transferred into JSON structured data or files to be combined with specific data to be printed to generate HTML printed files. However, in the existing scheme, once the external template is stored, the JSON data structure is fixed, so that the JSON data structure is difficult to be widely applied to various data to be printed, and the expansibility is poor. In this regard, it is necessary to provide an effective solution.
Disclosure of Invention
The embodiment of the application provides a template data processing method, a template data processing system and related equipment, which are used for solving the technical problem of poor expansibility of the existing template.
A first aspect of an embodiment of the present application provides a template data processing method, including:
converting an HTML intermediate template into a JSON format template, wherein the HTML intermediate template is generated through initial template editing, and the JSON format template comprises target field information defined by the HTML intermediate template and target style information corresponding to the target field information;
searching for to-be-printed section information corresponding to the target field information in to-be-printed data, and arranging the to-be-printed section information in the JSON format template according to the target style information to generate output data in an HTML format;
and printing the output data.
The method according to the first aspect of the present application may be implemented in a specific implementation using the content according to the second aspect of the present application.
A second aspect of an embodiment of the present application provides a template data processing system, including:
the processing unit is used for converting the HTML intermediate template into a JSON format template, wherein the HTML intermediate template is generated through initial template editing, and the JSON format template comprises target field information defined by the HTML intermediate template and target style information corresponding to the target field information;
the processing unit is further used for searching for to-be-printed section information corresponding to the target field information in the to-be-printed data, and arranging the to-be-printed section information in the JSON format template according to the target style information so as to generate output data in an HTML format;
and the printing unit is used for printing the output data.
A third aspect of the embodiments of the present application provides an electronic device, including:
a central processing unit, a memory and an input/output interface;
the memory is a short-term memory or a persistent memory;
the central processor is configured to communicate with the memory and to execute instruction operations in the memory to perform the method described in the first aspect of the embodiments of the present application or any particular implementation of the first aspect.
A fourth aspect of the embodiments provides a computer readable storage medium comprising instructions which, when run on a computer, cause the computer to perform a method as described in the first aspect of the embodiments or any specific implementation of the first aspect of the embodiments.
A fifth aspect of the embodiments of the present application provides a computer program product comprising instructions or a computer program which, when run on a computer, causes the computer to perform the method as described in the first aspect of the embodiments of the present application or any specific implementation of the first aspect.
From the above technical solutions, the embodiments of the present application have at least the following advantages:
the function of the HTML intermediate template can be regarded as that the initial template is stored and applied according to the HTML format, so that the data to be printed can be subjected to subsequent processing, the field information to be printed can be adaptively and rapidly distributed according with the target style information on the basis of the operable HTML intermediate template, the required HTML format output data can be conveniently and efficiently obtained, and the expansibility and the practicability of the template to be printed are improved. In addition, the template of the embodiment of the application has high stability and compatibility by means of the standardization and stability of the HTML format, and is convenient and flexible to apply.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings may be obtained according to these drawings for a person having ordinary skill in the art.
FIG. 1 is a system architecture diagram of an embodiment of the present application;
FIG. 2 is a schematic flow chart of a template data processing method according to an embodiment of the present application;
FIG. 3 is another flow chart of a template data processing method according to an embodiment of the present application;
FIG. 4 is another flow chart of a template data processing method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a template data processing system according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the present application will be described in further detail with reference to the accompanying drawings, and the described embodiments should not be construed as limiting the present application, and all other embodiments obtained by those skilled in the art without making any inventive effort are within the scope of the present application.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the following description, reference is made to "one embodiment" or "one specific example" and the like, which describe a subset of all possible embodiments, but it is to be understood that "one embodiment" or "one specific example" may be the same subset or a different subset of all possible embodiments and may be combined with each other without conflict. In the following description, the term plurality refers to at least two. Some value as referred to herein reaches a threshold value (if any), and in some specific examples may include the former being greater than the latter.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
For ease of understanding and description, terms and expressions which are referred to in the embodiments of the present application will be described before further detailed description of the present application, and are applicable to the following explanations.
And (3) a template: from the data structure level, a template is a set of structural data for defining the information type and its layout, which may exist in HTML or JSON format, so the template may be referred to as HTML data or JSON data in the embodiments of the present application.
JSON: the JS object numbered musical notation (JSON, javaScriptObjectNotation) is a lightweight data exchange format which adopts a text format completely independent of programming language to store and express that the data JSON is self-descriptive, has a hierarchical structure and is easy for people to read and write, and is easy for machines to analyze and generate the JSON, and can exist as an object or character string, wherein the former is used for reading data in the JSON, and the latter is used for transmitting the JSON data through a network;
HTML: the hypertext markup language (HTML, hyperTextMarkupLanguage) is a markup language. "Hypertext" means that text, graphics, animation, sound, tables, links, etc. may be included in a page, while markup language is a series of tags that tell the Web server the style and structure of a document, each HTML tag may bear, in use, different attribute terms for describing the content of the tag description to show different effects.
CSS: cascading style sheets (CSS, cascadingStyleSheet) are a computer language used to beautify pages to add styles (fonts, colors, etc.) to structured documents (e.g., HTML documents or XML applications). The content, such as the field name on the template, sets the font size, and the font size information is then represented on the css style.
DOM: document object model (DOM, documentObjectModel), the DOM model represents a document with a logical tree, each branch of the tree ending in a node, each node containing object information. The DOM approach allows the tree to be manipulated in a specific manner by which the structure, style, or content of the HTML document can be changed.
The method provided by the embodiment of the application can be applied to an application environment as shown in fig. 1, wherein the server 101 can communicate with the terminal 102 and the printing device 103 through a network. The terminal 102 may acquire an initial template input by a user, such as a sales document template, and send the initial template to the server 101, and the server 101 may perform operations such as generation of an HTML intermediate template, modification of attribute information, and format conversion based on the obtained initial template; in addition, the server 101 may also combine JSON format template data processed by the HTML intermediate template with data to be printed (dynamic data such as trade names and number sold in the day) input by the terminal 102, and specifically, may be processed by a rendering component disposed on the server 101 side to obtain output data on which target attribute information is rendered; the server 101 may then generate a target image or PDF format document from the output data and print out a paper version of the target image or PDF document, such as a today's commodity sales slip printed out of the paper version, via the printing device 103. Of course, the target image or PDF format document may be transmitted to the terminal 102 by the server 101, and the printing device 103 is triggered by the terminal 102 to print out. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, which may be smartwatches, smartbracelets, headsets, etc. The server 101 may be implemented as a stand-alone server or as a server cluster composed of a plurality of servers. It should be noted that, the method provided in the embodiment of the present application may be implemented by the terminal device and the server together as described above, or may be implemented all at the server side, or may also be implemented all at the terminal device side, which may be specifically determined according to an actual application scenario, and is not limited herein.
The method of the present application will be described in further detail below.
Referring to fig. 2, a first aspect of the present application provides a specific embodiment of a template data processing method, which includes the following operation steps:
21. the HTML intermediate templates are converted to JSON format templates.
The HTML intermediate template is generated through initial template editing, and the JSON format template comprises target field information defined by the HTML intermediate template and target style information corresponding to the target field information.
For example, the sales document template (which may be similar to a receipt) as the initial template may define field information of a preset binding field name, such as a document head of "sales document", a commodity name, a sales volume count, a total price amounts, and the like, and style information may be text format information such as fonts, font sizes, colors, and numerical types (such as types of integer or decimal digits, and the like) of the binding fields and dynamic specific values thereof (such as "vitamin milk", "100 bottles", "1000 yuan"), and the like, and the information may be edited (such as format conversion or modification) and stored as an HTML intermediate template. It should be mentioned that the dynamic specific value is different from the binding field carried by the template (which may be regarded as the template field), and the dynamic specific value comes from the specific data to be printed, is dynamically real-time and is not fixed in advance like the template field, and may be different according to different actual situations such as time, transaction objects, etc.
22. Searching for to-be-printed section information corresponding to target field information in to-be-printed data, and arranging the to-be-printed section information in a JSON format template according to target style information to generate output data in an HTML format.
After learning the target field information and the target style information stated by the JSON format template, the information of the section to be printed corresponding to the target field information can be traversed and found from the data to be printed, for example, a dynamic specific value "vitamin milk" corresponding to the name is found, the information of the section to be printed corresponding to the found information is arranged on the JSON format template according to the target style information (for example, according to the text format preset by the template), so as to generate output data (which can be called HTML of the HTML to be printed). Here, step 22 may be considered as receiving and comprehensively processing the target attribute information (including the target field information and the target style information) of the template and the data to be printed, so that the data to be printed can render the effect declared in accordance with the target attribute information.
23. And printing and outputting the data.
After the output data corresponding to the required HTML format is arranged or rendered, the output data can be printed, so that the paper sales document filled with the dynamic transaction information can be obtained.
In summary, the function of the HTML intermediate template can be regarded as that the initial template is stored and applied according to the HTML format, so that the data to be printed can be processed in the subsequent steps, the field information to be printed can be adaptively and rapidly arranged according with the target style information on the basis of the operable HTML intermediate template, the required HTML format output data can be conveniently and efficiently obtained, and the expansibility and the practicability of the template to be printed are improved. In addition, the template of the embodiment of the application has high stability and compatibility by means of the standardization and stability of the HTML format, and is convenient and flexible to apply.
On the basis of the above illustration, some specific possible implementation examples will be provided below, and in practical applications, implementation contents between these examples may be implemented by combination as required according to the corresponding functional principles and application logic.
Referring to fig. 3 to 4, the first aspect of the present application provides another embodiment of a template data processing method, which includes the following steps:
31. the HTML intermediate templates are converted to JSON format templates.
In some specific examples, the specific implementation of step 31 may include: converting the HTML intermediate template into a Document Object Model (DOM), namely, expressing the document object model into an operable tree structure form; and extracting and converting the target field information and the target style information bound to the DOM node to obtain the JSON format template.
The generated HTML intermediate template may be stored in a server, specifically, in a file form, or in a database (the database may be regarded as a character server) in the form of a character string, and when template information adjustment is required, the generated HTML intermediate template is returned by the server to perform attribute information modification operation. The requirement for adjusting the template information can be that the application program needs to modify the version of the JSON data structure along with the time, for example, the service field information is increased or reduced, and the initial template needs to be modified timely from the root point to be practically, effectively and conveniently multiplexed. Thus, as a possible embodiment (one), in the case where the template information needs to be modified, the specific generation process of the HTML intermediate template in step 31 may include the following operations:
binding initial field information defined by an initial template and initial style information corresponding to the initial field information to DOM nodes of the HTML initial template; based on the template adjustment requirement, modifying the initial field information and/or the initial style information bound by the DOM node to correspondingly obtain target field information and/or target style information; an HTML intermediate template (which may be referred to as an HTML final template) is generated based on the target field information and the target style information. For example, the style information may include cascading style CSS information, for example, at least one of a font, a font size, a color, and a word spacing of contents such as a field name on a template.
Therefore, the requirement of modifying the attribute information from the initial template to the JSON format template and converting the format is completed by means of the operational DOM, and the situation that JSON data is fixed as the traditional method and is difficult to extend and throw into a new scene can be avoided. In the step 31, the process of generating the HTML intermediate template by editing the initial template may be regarded as storing the initial template as the HTML intermediate template, and in this process, key information (i.e. attribute information of the template) including field information and style information is bound as tag attribute to DOM tree nodes of the HTML initial template, so that an HTML intermediate template having complete information can be obtained when storing the template. Thus, with particular reference to embodiment (one), the result of step 31 is to convert the modified HTML intermediate template into a JSON-format template, which may be referred to as JSON data.
In some specific examples, the field information may include field identifiers filled in the template, such as field names name, time, price, or numbers 1, 2, and 3 corresponding to the field names, respectively; therefore, in the above-mentioned specific generation process of the HTML intermediate template, i.e., in the embodiment (one), the process of "modifying the initial field information and/or the initial style information of the DOM node binding based on the template adjustment requirement" may specifically be: at least one modification operation of changing, deleting and adding the initial field identification; and/or, modifying at least one style of the font size (font size), the color and the font for the style information corresponding to the initial field identifier.
Of course, as another possible embodiment (two), there may be no need to modify the template information and the corresponding operation as above, in other words, after the initial attribute information (including the initial field information and the initial style information) of the initial template is bound to the DOM node of the HTML initial template, the HTML intermediate template in the generating step 31 may be edited.
32. Searching for to-be-printed section information corresponding to target field information in to-be-printed data, and arranging the to-be-printed section information in a JSON format template according to target style information to generate output data in an HTML format.
In some specific examples, step 32 may be performed specifically using a rendering component, i.e., the section information to be printed and the target attribute information are processed by the rendering component to generate output data in HTML format, for example:
transmitting the target field information and the target style information to a rendering component; the control rendering component searches the to-be-printed section information corresponding to the target field information in the to-be-printed data; the control rendering component arranges the section information to be printed on the JSON format template according to the target style information (such as target CSS information) so as to generate output data (which can be called as HTML to be printed). Here, the rendering component can receive and combine the target attribute information and the data to be printed, so that the data to be printed can render the effect which accords with the statement of the target attribute information; rendering components include, but are not limited to, components that are custom within the system.
Taking CSS style information as an example, please refer to fig. 4, the rendering component receives JSON data in step 31, that is, a JSON format template, specifically, may receive target attribute information such as target field information and target CSS style information of the JSON data, which also receives data to be printed; the type of the rendering component can be determined according to the file type of the initial template (the file type of the HTML intermediate template is the same as that of the initial template), if the initial template needs to display text contents such as commodity names and the like, the initial template belongs to the text type, and then the rendering component of the text type can be correspondingly used. The rendering component may be regarded as essentially an HTML operating program.
The processing of template-side data (i.e., binding or fixed data) by a rendering component is described first, with exemplary: an initial template of a text type containing a binding field "i am a print template" or "name" as target field information, wherein the binding field can be bound to DOM nodes of the HTML initial template in step 31; therefore, a text type rendering component may be used to receive the binding field value and the target CSS style information (i.e., target attribute information) embodied in the template, and then, the received template side data may be converted by the rendering component from JSON data into the following HTML data:
data-value= "i am a print template", data-binding= "name"
The converted HTML data can be regarded as extraction of template side data (specifically, key information such as target attribute information) and HTML presentation or character string type recording, and the HTML data can be used for correspondingly combining to-be-printed section information in to-be-printed data, namely, dynamic specific values, so as to generate output data in an HTML format (namely, generate to-be-printed HTML).
Regarding the processing of the data on the side to be printed (i.e., dynamic real-time data) by the rendering component, an example is: when a shop selling vitamin milk prints a today's sales document (a sales document template can be used), the information of the section to be printed can be data to be dynamically acquired such as' name of vitamin milk, today's sales quantity, total sales amount and sales time', and the data to be dynamically acquired (which can be called as dynamic concrete value) can be correspondingly acquired from the data to be printed through the HTML data processed by the rendering component. For example, when text content such as a commodity name (i.e. binding a certain attribute) is required to be displayed in the template, the rendering component for the template is a text type, and the rendering component of the text type can be defined as an HTML string program as follows: < divdata-type= "text" data-binding= "name" >/div >, wherein data-binding= "name" indicates that attribute information required to be displayed or bound in a template is a field name (in other words, the field name is a target field defined by the template), meanwhile, a dynamic specific value of the field name is a value of a key being name in data to be printed, and accordingly, a rendering component needs to find out the dynamic specific value "vitamin milk" of the text type and the key being name in the data to be printed (i.e. find out information of a section to be printed), so that finally, by means of the rendering component, output data in the following HTML format (i.e. HTML to be printed) can be rendered:
< div > vitamin milk div >
Similarly, the rendering component performs semantic processing on the name of the commodity (name), and the rendering component may render other information of the section to be printed, which needs to be dynamically displayed on the template, for example, 100 bottles (sold in number today), 1000 yuan (sold total amount), and the like. Similarly, the font size, font style, color, etc. of the text content such as "vitamin milk" in the finally printed sales document can be rendered and presented by the rendering component with reference to the corresponding target style information.
33. And configuring a preview program of the HTML intermediate template, and running the preview program to preview the initial template.
In some specific examples, a preview program can be configured on the HTML intermediate template, so that the effect of directly restoring and previewing the initial template can be achieved by opening the HTML intermediate template by running the preview program, and the operation is simple and easy to implement, rather than the conventional scheme, as the template is directly stored as JSON data, and JSON only represents one stored data (without layout and style), so that the preview of the initial template needs to be restored to the initial template again, so that the preview can be achieved; it should be noted that, here, the initial template before or after the field information and/or style information is modified may be previewed, so the order of execution between the step 33 and the step 31 or 32 may not be limited.
34. And printing and outputting the data.
In some specific examples, the specific implementation of step 33 may include: a target image or PDF format document is generated from the output data in HTML format (which may be referred to as HTML to be printed), and the printing device is triggered to print the target image or PDF format document.
Steps 31, 32, 34 are similar to the operation of steps 21 to 23, respectively, and detailed description thereof will be omitted.
In summary, when the template requirement is changed, if the service field in the template is required to be increased or reduced and the field style is required to be modified, the target attribute information can be conveniently obtained only by modifying the field information and/or the style information related to the service on the HTML middle template (in particular on the DOM node), so that the subsequent dynamic analysis and conversion of JSON data meeting the current requirement are convenient, the flexibility is high, the old template compatibility problem caused by JSON format fixation is not required to be considered as in the prior scheme, and the complex problem that JSON solidification is required to be compatible and updated in the prior scheme is effectively solved. In addition, the template has high expansibility and stability by means of the standardization of the HTML format, and the effect of directly opening the HTML intermediate template through the browser to view the template is supported.
Referring to FIG. 5, a second aspect of the present application provides a specific example of a template data processing system, the system comprising:
the processing unit 501 is configured to convert an HTML intermediate template into a JSON format template, where the HTML intermediate template is generated by editing an initial template, and the JSON format template includes target field information defined by the HTML intermediate template and target style information corresponding to the target field information;
the processing unit 501 is further configured to search for information of a section to be printed corresponding to the target field information in the data to be printed, and arrange the information of the section to be printed in a JSON format template according to the target style information, so as to generate output data in HTML format;
a printing unit 502 for printing out data.
Optionally, the processing unit 501 is specifically configured to:
converting the HTML intermediate template into a Document Object Model (DOM);
and extracting and converting the target field information and the target style information bound to the DOM node to obtain the JSON format template.
Optionally, the processing unit 501 is specifically configured to:
binding initial field information defined by an initial template and initial style information corresponding to the initial field information to DOM nodes of the HTML initial template;
based on the template adjustment requirement, modifying the initial field information and/or the initial style information bound by the DOM node to correspondingly obtain target field information and/or target style information;
and generating an HTML intermediate template according to the target field information and the target style information.
Optionally, the field information includes a field identifier filled in the template; the processing unit 501 is specifically configured to:
at least one modification operation of changing, deleting and adding the initial field identification; and/or the number of the groups of groups,
and modifying at least one style of the font size, the color and the font according to the initial style information corresponding to the initial field identifier.
Optionally, the printing unit 502 is specifically configured to:
and generating a target image or a PDF format document according to the output data in the HTML format, and triggering the printing device to print the target image or the PDF format document.
Optionally, the processing unit 501 is further configured to:
and configuring a preview program of the HTML intermediate template, and running the preview program to preview the initial template.
Alternatively, the style information includes cascading style CSS information.
In this embodiment, the operations performed by each unit of the template data processing system are similar to those described in the foregoing first aspect or any one of the specific method embodiments of the first aspect, and are not described herein in detail. Of course, the specific implementation of the operations of the first aspect of the present application may also be implemented with reference to the related description of the second aspect.
Referring to fig. 6, an electronic device 600 of an embodiment of the present application may include one or more Central Processing Units (CPUs) 601 and a memory 605, where the memory 605 stores one or more application programs or data.
Wherein the memory 605 may be volatile storage or persistent storage. The program stored in the memory 605 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Still further, the central processor 601 may be arranged to communicate with the memory 605 to execute a series of instruction operations in the memory 605 on the electronic device 600.
The electronic device 600 may also include one or more power supplies 602, one or more wired or wireless network interfaces 603, one or more input/output interfaces 604, and/or one or more operating systems, such as WindowsServerTM, macOSXTM, unixTM, linuxTM, freeBSDTM, etc.
The cpu 601 may perform the operations performed by the foregoing first aspect or any specific method embodiment of the first aspect, which are not described herein.
A computer readable storage medium is provided comprising instructions which, when run on a computer, cause the computer to perform a method as described in the first aspect or any specific implementation of the first aspect.
A computer program product comprising instructions or a computer program is provided which, when run on a computer, causes the computer to perform the method as described above in the first aspect or any one of the specific implementations of the first aspect.
It should be understood that, in various embodiments of the present application, the sequence number of each step does not mean that the execution sequence of each step should be determined by the function and the internal logic, and should not limit the implementation process of the embodiments of the present application.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system and apparatus described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the elements is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple elements or components may be combined or integrated into another system or apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all or part of the technical solution contributing to the prior art, or in the form of a software product, which is stored in a storage medium (computer program product) and includes several instructions for causing a computer device (which may be a personal computer, a service server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM, randomaccess memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Claims (10)
1. A template data processing method, comprising:
converting an HTML intermediate template into a JSON format template, wherein the HTML intermediate template is generated through initial template editing, and the JSON format template comprises target field information defined by the HTML intermediate template and target style information corresponding to the target field information;
searching for to-be-printed section information corresponding to the target field information in to-be-printed data, and arranging the to-be-printed section information in the JSON format template according to the target style information to generate output data in an HTML format;
and printing the output data.
2. The template data processing method according to claim 1, wherein the converting the HTML intermediate template into the JSON format template includes:
converting the HTML intermediate template into a Document Object Model (DOM);
and extracting and converting the target field information and the target style information bound to the DOM node to obtain the JSON format template.
3. The template data processing method according to claim 1, wherein the generating process of the HTML intermediate template includes:
binding initial field information defined by the initial template and initial style information corresponding to the initial field information to DOM nodes of the HTML initial template;
modifying the initial field information and/or the initial style information bound by the DOM node based on a template adjustment requirement to correspondingly obtain the target field information and/or the target style information;
and generating the HTML intermediate template according to the target field information and the target style information.
4. A template data processing method according to claim 3, wherein the field information includes field identifications filled in templates; the modifying the initial field information and/or the initial style information bound by the DOM node includes:
at least one modification operation of changing, deleting and adding the initial field identification; and/or the number of the groups of groups,
and modifying at least one style of the font size, the color and the font according to the initial style information corresponding to the initial field identifier.
5. The template data processing method according to claim 1, wherein the printing the output data includes:
and generating a target image or a PDF format document according to the output data in the HTML format, and triggering the printing equipment to print the target image or the PDF format document.
6. The template data processing method according to claim 1, wherein before printing the output data, the method further comprises:
and configuring a preview program of the HTML middle template, and running the preview program to preview the initial template.
7. The template data processing method according to claim 1, wherein the style information includes cascading style CSS information.
8. A template data processing system, comprising:
the processing unit is used for converting the HTML intermediate template into a JSON format template, wherein the HTML intermediate template is generated through initial template editing, and the JSON format template comprises target field information defined by the HTML intermediate template and target style information corresponding to the target field information;
the processing unit is further used for searching for to-be-printed section information corresponding to the target field information in the to-be-printed data, and arranging the to-be-printed section information in the JSON format template according to the target style information so as to generate output data in an HTML format;
and the printing unit is used for printing the output data.
9. An electronic device, comprising:
a central processing unit, a memory and an input/output interface;
the memory is a short-term memory or a persistent memory;
the central processor is configured to communicate with the memory and to execute instruction operations in the memory to perform the method of any of claims 1 to 7.
10. A computer readable storage medium comprising instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211736138.9A CN116050370A (en) | 2022-12-30 | 2022-12-30 | Template data processing method, system and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211736138.9A CN116050370A (en) | 2022-12-30 | 2022-12-30 | Template data processing method, system and related equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116050370A true CN116050370A (en) | 2023-05-02 |
Family
ID=86133163
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211736138.9A Pending CN116050370A (en) | 2022-12-30 | 2022-12-30 | Template data processing method, system and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116050370A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117709320A (en) * | 2023-11-28 | 2024-03-15 | 深圳市科脉技术股份有限公司 | Document generation method, device, computer equipment and storage medium |
-
2022
- 2022-12-30 CN CN202211736138.9A patent/CN116050370A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117709320A (en) * | 2023-11-28 | 2024-03-15 | 深圳市科脉技术股份有限公司 | Document generation method, device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109408783B (en) | Electronic document online editing method and system | |
CN100440222C (en) | System and method for text legibility enhancement | |
CN101271463B (en) | Structure processing method and system of layout file | |
US20140033010A1 (en) | Method and system for dynamic assembly of form fragments | |
US20040221233A1 (en) | Systems and methods for report design and generation | |
US20020147748A1 (en) | Extensible stylesheet designs using meta-tag information | |
US20030120686A1 (en) | Extensible stylesheet designs using meta-tag and/or associated meta-tag information | |
US20180260389A1 (en) | Electronic document segmentation and relation discovery between elements for natural language processing | |
US8381099B2 (en) | Flows for variable-data printing | |
CN111797595A (en) | Method and device for generating OFD format page based on XML template | |
US7735009B2 (en) | Conversion of plain text to XML | |
CN110851136A (en) | Data acquisition method and device, electronic equipment and storage medium | |
CN116050370A (en) | Template data processing method, system and related equipment | |
CN114691712A (en) | Method and device for generating bill and storage medium | |
JP2019040260A (en) | Information processing apparatus and program | |
Bagley et al. | Creating reusable well-structured PDF as a sequence of component object graphic (COG) elements | |
CN112433995A (en) | File format conversion method, system, computer equipment and storage medium | |
KR102126342B1 (en) | Electronic document braille translation system and a method therefor | |
JP2002215519A (en) | Method and system for web page generation, web page generating program, and recording medium | |
CN113139145B (en) | Page generation method and device, electronic equipment and readable storage medium | |
JP2002288153A (en) | Application-independent data forming method, information processing program, and layout information processing system | |
Goldfarb | Future directions in SGML/XML | |
US8904280B2 (en) | Recursive flows in variable-data printing document templates | |
JP2007219579A (en) | Document converter and program | |
CN111143719A (en) | Online publication method, device and equipment of thesis and computer-readable 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 |