Data conversion method and device

Through the method of parsing and generating PDFs, the server resource consumption problem when batch generation of PDFs by HTML format reports is solved, and fast and efficient data conversion and generation is realized, and system efficiency is improved.

CN114239490BActive Publication Date: 2024-12-27INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111518734.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-13
Publication Date
2024-12-27
Estimated Expiration
2041-12-13

AI Technical Summary

Technical Problem

In business systems, reports in HTML format consume more application server resources when batch generation of PDFs, resulting in inefficiency. The existing technology has failed to effectively solve this problem.

Method used

By reading the target data and storing it into a cached encrypted object, parsing the data to obtain the table header and table data, creating a configuration class for conversion format generation format data, and using the class library to generate conversion data based on the table header, table data and format data. And write data to the PDF output stream through the itext library to quickly generate PDFs.

Benefits of technology

It realizes fast and efficient batch generation of PDFs for HTML-format reports, avoids excessive consumption of server resources and improves system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114239490B_ABST
    Figure CN114239490B_ABST
Patent Text Reader

Abstract

The present application discloses a data conversion method and system. Involving the field of financial technology, the method comprises: reading target data in a target format, and storing the read target data in a cached encrypted object; parsing the target data in the encrypted object to obtain the header data and table data of the target data; creating a configuration class of the conversion format, and generating format data of the conversion format according to the configuration class; generating conversion data of the conversion format according to the class library, header data, table data, and format data. Through the present application, the problem of low efficiency is solved in the business system in the related technology, that for reports in HTML format, when batch generating PDF format, more application server resources will be consumed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of financial technology, and specifically, to a data conversion method and device. Background Art

[0002] In various business systems, the report download function is widely used. The diversity of business has led to the diversity of report formats, such as xls, csv, HTML, PDF, etc. According to the different speeds of report generation, it is processed into two modes: real-time download and asynchronous download. For reports in PDF format, it is often processed by custom servlets to obtain background data and encapsulate it into a data stream, and then the response content type is set to PDF to achieve the download and viewing of reports in this format. However, this method has limitations and is only suitable for PDF downloads of single reports. When batch reports need to be downloaded as PDFs, this method will consume more application server resources. Sometimes, due to the long execution of a single task, the server will be overloaded, blocking the task queue and unable to release resources, thus affecting the entire business system.

[0003] Regarding the business system in the related technology, for reports in HTML format, when batch generating PDF format, it will consume more application server resources and there is a problem of low efficiency. At present, no effective solution has been proposed. Summary of the invention

[0004] The main purpose of the present application is to provide a data conversion method and device to solve the problem of low efficiency in the business system of the related art that, for reports in HTML format, when batch generating PDF format, more application server resources will be consumed.

[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a data conversion method is provided, including: reading target data in a target format, and storing the read target data in a cached encryption object; parsing the target data in the encryption object to obtain header data and table data of the target data; creating a configuration class of a conversion format, and generating format data of the conversion format according to the configuration class; generating conversion data of the conversion format according to a class library, the header data, the table data, and the format data.

[0006] Optionally, after creating a configuration class for the conversion format and generating format data for the conversion format according to the configuration class, the method further comprises: storing the header data, the table data, and the format data in a table object of the target data.

[0007] Optionally, generating conversion data of the conversion format based on the class library, the header data, the table data, and the format data includes: calling a file class through the class library to add data content of the table object; adding the file class to the output stream of the conversion format through the writing class of the conversion format to generate the conversion data.

[0008] Optionally, adding the data content of the table object by calling the file class through the class library includes: generating a preset format object according to the header data of the table object and the format data; and filling the table data in the table object into the preset format object.

[0009] Optionally, filling the table data in the table object into the preset format object includes: paging the preset format object; for the non-first page of the preset format object, obtaining the fixed header of the first page according to a first requirement, and copying it to the non-first page, wherein the first requirement is used to indicate the header format of the non-first page.

[0010] Optionally, generating a preset format object based on the header data of the table object and the format data includes: creating the preset format object; inputting the header data into the preset format object; obtaining the format data of the preset format object according to a second requirement; and generating a table including the header in the preset format object based on the format data and the header data.

[0011] Optionally, filling the table data in the table object into the preset format object includes: acquiring a table format of a table to be edited; and writing the table data corresponding to the table into the table according to the table format.

[0012] Optionally, after generating conversion data of the conversion format according to the class library, the header data, the table data, and the format data, the method further includes: compressing and packaging a preset number of generated conversion data to generate a conversion data packet, wherein the name of the conversion data packet includes a compressed package name and a serial number.

[0013] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a data conversion device is provided, including: a reading module, used to read target data in a target format, and store the read target data in a cached encryption object; a parsing module, used to parse the target data in the encryption object to obtain header data and table data of the target data; a creation module, used to create a configuration class of a conversion format, and generate format data of the conversion format according to the configuration class; a conversion module, used to generate conversion data of the conversion format according to a class library, the header data, the table data, and the format data.

[0014] In order to achieve the above objective, according to another aspect of the present application, a processor is provided, wherein the processor is used to run a program, wherein the program executes any one of the data conversion methods described above when running.

[0015] In order to achieve the above-mentioned purpose, according to another aspect of the present application, an electronic device is provided, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the data conversion methods described above.

[0016] Through this application, the following steps are adopted: read the target data in the target format, and store the read target data in the cached encrypted object; parse the target data in the encrypted object to obtain the header data and table data of the target data; create a configuration class of the conversion format, and generate the format data of the conversion format according to the configuration class; generate the conversion data of the conversion format according to the class library, the header data, the table data, and the format data, so as to parse the data of the target format HTML, and automatically and quickly generate the conversion format PDF according to the parsed data, which solves the problem that in the business system of the related technology, when the report in HTML format is generated in batches in PDF format, more application server resources will be consumed, and there is a problem of low efficiency. Thus, the effect of quickly and efficiently generating the conversion format PDF according to the target format HTML batches is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 is a flow chart of a data conversion method provided according to an embodiment of the present application;

[0019] Figure 2 is a schematic diagram of an operation window of a data conversion tool according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of a data conversion device provided according to an embodiment of the present application;

[0021] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] The present invention is described below in conjunction with preferred implementation steps. Figure 1 is a flow chart of a data conversion method provided according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:

[0026] Step S101, reading target data in a target format, and storing the read target data in a cached encryption object;

[0027] Step S102, parsing the target data in the encrypted object to obtain the header data and table data of the target data;

[0028] Step S103, creating a configuration class for the conversion format, and generating format data for the conversion format according to the configuration class;

[0029] Step S104, generating conversion data of a conversion format according to the class library, the header data, the table data, and the format data.

[0030] Through the above steps, the target data in the target format is read, and the read target data is stored in the cached encrypted object; the target data in the encrypted object is parsed to obtain the header data and table data of the target data; a configuration class of the conversion format is created, and the format data of the conversion format is generated according to the configuration class; the conversion data of the conversion format is generated according to the class library, the header data, the table data, and the format data, which solves the problem that in the business system of the related technology, when the report in HTML format is generated in batches in PDF format, more application server resources will be consumed, and there is a problem of low efficiency. Thus, the effect of quickly and efficiently generating the conversion format PDF according to the target format HTML batches is achieved.

[0031] The execution subject of the above steps can be a conversion tool, which can be an application program implemented by a program, and its corresponding hardware device can be set on a calculator, controller, server, etc. with computing power.

[0032] The step of reading the target data in the target format and storing the read target data in the cached encryption object can be performed by a buffered reading class to read the target data in the target format and store the read target data in the cached encryption object. The buffered reading class can be a buffered reading BufferedReader class. The target format can be a hypertext markup language HTML format, and the target data can be HTML data. The encryption object can be an encrypted file FileAndEnc object.

[0033] The above-mentioned step of parsing the target data in the encrypted object to obtain the header data and table data of the target data can be performed by parsing the target data in the encrypted object through a parsing library to obtain the header data and table data of the target data. The above-mentioned parsing library can be a hypertext markup language HTML parsing HTMLparser library, that is, a target format parsing library. The HTMLparser library is used to parse the hypertext markup language HTML data in the encrypted file FileAndEnc object to obtain the header data and table data respectively.

[0034] The above configuration class for creating the conversion format is used to generate the format data of the conversion format according to the configuration class. The format data of the generated portable document format PDF can be set by creating a new PDFConfiguration portable document format configuration class. As shown in Figure 2, the format data of PDF includes PDF page size, fixed header settings, page number settings, table alignment, table column width settings, text alignment, font settings, text line break settings, etc.

[0035] The above class library can be an itext library. According to the class library, header data, table data, and format data, conversion data of the conversion format is generated. The Document file class in the itext library can be used to add the content of the Table object. Finally, the PdfWriter class is used to write all the content added to the Document class into the output stream associated with the PDF file, and finally a PDF report is generated.

[0036] This solves the problem in the business system of the related art that when batch-generating reports in HTML format into PDF format, more application server resources are consumed, resulting in low efficiency. This achieves the effect of quickly and efficiently batch-generating converted PDF format according to the target format HTML.

[0037] Optionally, after creating a configuration class for the conversion format and generating format data for the conversion format according to the configuration class, the method further includes: storing the header data, the table data, and the format data in a table object of the target data.

[0038] The table object can be a table object, which stores header data, table data, and format data in the table object, and then adds the content of the table object, including header data and table data, through the file class of the class library, and generates PDF data according to the PDF format data. The header data, table data, and format data are stored in the table object of the target data. When the configuration class for generating PDF needs to obtain the data, it is directly obtained from the table object. On the one hand, it avoids the problem of obtaining header data, table data, and format data from different locations, which is prone to errors. Another invention also improves the efficiency of data acquisition.

[0039] Optionally, generating conversion data of a conversion format based on the class library, header data, table data, and format data includes: calling a file class through the class library to add data content of a table object; adding the file class to an output stream of the conversion format through a writing class of the conversion format to generate conversion data.

[0040] The above-mentioned file class can be the document configuration class in the itext text class library. The above-mentioned writing class can be the PDFwriterPDF writing class. The Document configuration file class in the itext text class library is used to add the content of the Table table object, and finally the PdfWriter class is used to write all the content added to the Document class into the output stream associated with the PDF file, and finally a PDF report is generated. The configuration class of the above-mentioned class library can directly obtain the header data, table data and format data required for data conversion from the above-mentioned table object, and then write the above-mentioned header data and table data into the data stream of the conversion format according to the format corresponding to the format data through the writing class to generate conversion data, thereby automatically generating corresponding conversion data according to the data stored in the table object, without the need for human intervention, thereby improving accuracy and conversion efficiency.

[0041] Optionally, adding data content of a table object by calling a file class through a class library includes: generating a preset format object according to header data and format data of the table object; and filling the table data in the table object into the preset format object.

[0042] As shown in Table 1, when PDF is generated, by parsing the table function parserTableToPdf(), the data of the table object can be output to the PDF object to obtain the above-mentioned preset format object, including PDF fixed header settings and repeated header settings for tables exceeding one page. Then fill the table data into the cells in the preset format object. Thus, according to the conversion format and the header data, blank conversion data with a table is generated, and then the table data is filled into the conversion data, and the data content of the target format is filled into the conversion data, so as to generate the conversion data quickly and effectively.

[0043] Optionally, filling the table data in the table object into the preset format object includes: paging the preset format object; for the non-first page of the preset format object, obtaining the fixed header of the first page according to the first requirement, and copying it to the non-first page, wherein the first requirement is used to indicate the header format of the non-first page.

[0044] The paging of preset format objects can be set according to the format data of the conversion data, such as the page size, and the content area of ​​each page can be determined. After the area is filled, the paging is automatically performed. The above-mentioned first requirement can be the user's requirement on whether a fixed header is displayed on the non-home page. After obtaining the fixed header, it is determined whether to display the fixed header according to the first requirement. In this way, the header format of the non-home page can be quickly and automatically generated according to the requirement on whether the header needs to be displayed on the non-home page. While automatically and quickly generating the conversion data, data conversion and conversion data generation are performed according to the header requirements to meet the user's different format requirements for the conversion data.

[0045] Optionally, generating a preset format object based on the header data and format data of the table object includes: creating a preset format object; inputting the header data into the preset format object; obtaining the format data of the preset format object according to a second requirement; and generating a table including a header in the preset format object based on the format data and the header data.

[0046] The second requirement may be whether to include a header, or whether to display the header in a preset format object. As shown in Table 1, an empty PDFptable table (including a header) can be obtained by using the getEmptyPdfPTable() function to obtain an empty table, so as to obtain the format data of a PDF object (preset format object) including a header. An empty PDFptable table (excluding a header) can be obtained by using the getEmptyPdfPTableNoHeader() function to obtain a non-header empty table, so as to obtain the format data of a PDF object (preset format object) not including a header. Data conversion and conversion data generation are performed according to the header requirements of the table in PDF to meet the different format requirements of users for the table of converted data.

[0047] Optionally, filling the table data in the table object into the preset format object includes: obtaining the table format of the table to be edited; and writing the table data corresponding to the table into the table according to the table format.

[0048] As shown in Table 1, by getting the cell function getPdfCell() method, you can get PDFCell, which is the format of the PDF cell, including text alignment, font settings (font size, bold, underline, superscript, subscript, etc.), text line break settings, and PDF page number replacement. When writing to a cell with a fixed format, write data according to its format. According to the format of the specific cell of the PDF table, write the cell data in the corresponding format, adjust the format of the cell data as required, or retain the cell format in the HTML table, so as to more completely restore the format of the table before conversion, and ensure the integrity of the table data content during the data conversion process as much as possible, or set the cell format according to the requirements to meet the user's requirements for setting the cell format.

[0049] Optionally, after generating conversion data of a conversion format according to the class library, header data, table data, and format data, the method further includes: compressing and packaging a preset number of generated conversion data to generate a conversion data packet, wherein the name of the conversion data packet includes a compressed package name and a serial number.

[0050] Since the number of HTML data is large and the data volume is small, the number of PDFs generated in batches is large and difficult to store. The generated preset number of conversion data is compressed and packaged to generate conversion data packets. For example, a large PDF named with zip package name_serial number will be generated for every 5000 PDFs. The generated PDFs are packaged for easy storage and subsequent search.

[0051] The data conversion method provided by the embodiment of the present application reads the target data in the target format and stores the read target data in the cached encrypted object; parses the target data in the encrypted object to obtain the header data and table data of the target data; creates a configuration class of the conversion format, and generates the format data of the conversion format according to the configuration class; generates the conversion data of the conversion format according to the class library, the header data, the table data, and the format data, which solves the problem that in the business system of the related technology, when the report in HTML format is generated in batches in PDF format, more application server resources will be consumed, and there is a problem of low efficiency. Thus, the effect of quickly and efficiently generating the conversion format PDF in batches according to the target format HTML is achieved.

[0052] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0053] It should be noted that this embodiment also provides an optional implementation, which is described in detail below.

[0054] This embodiment provides a method for batch conversion of HTML to PDF, and supports modification of report PDF style, data paging, and merging of PDF files. It is encapsulated into an executable small tool, so that business personnel can batch convert downloaded HTML reports to PDF format locally for reporting relevant data. The use of this tool does not consume the resources of the application server, and the download of batch HTML reports will basically not affect the performance of the server.

[0055] The main technical implementation of the method of this embodiment is divided into two parts, namely HTML parsing and PDF generation.

[0056] HTML parsing:

[0057] 1) Use the BufferedReader class (buffered reading class) to read all HTML data and the corresponding encoding format and store them in the FileAndEnc object;

[0058] 2) Use the HTMLparser library to parse the HTML data in the FileAndEnc object, obtain the header data and table data respectively, and store them in the Table object. In addition to the report data, the Table object also stores the report format data;

[0059] PDF Generation:

[0060] 3) Create a new PDFConfiguration class to set the format of the generated PDF;

[0061] 4) Import the itext library and use the Document class to add the contents of the Table object. Finally, use the PdfWriter class to write all the contents added to the Document to the output stream associated with the PDF file, and finally generate a PDF report.

[0062] The function list and method description are shown in Table 1. Table 1 is a function list:

[0063] Table 1 Function List

[0064]

[0065] The style of the converted PDF report can be modified through the PDFConfiguration method. The currently configurable styles are shown in Table 2, which is a list of PDF styles.

[0066] Table 2 PDF style list

[0067]

[0068]

[0069] Figure 2 is a schematic diagram of an operation window of a data conversion tool according to an embodiment of the present application, such as Figure 2 As shown, the method flow of this embodiment is as follows:

[0070] 1. The user selects the zip package and the output PDF directory on the tool page, clicks the Generate button, and the tool first generates HTML, HTML.tmp, HTML.succ, HTML.fail directories and HTML.txt text in the PDF output path.

[0071] 2. Unzip the zip package to the HTML.tmp directory, and parse the files with the *.HTML suffix in the directory to generate PDF files. The successfully parsed HTML files are moved to the HTML.succ directory, and the failed ones are moved to the HTML.fail directory. The relevant logs are recorded in the HTML.txt text.

[0072] 3. Finally, a large PDF named with the zip package name_serial number will be generated for every 5000 PDFs.

[0073] This implementation implements a method for converting HTML to PDF, which can convert batch HTML reports into PDF format and support paging of report data and merging of PDF files. It is encapsulated into an executable gadget for easy operation by business personnel. Business personnel can first download batch reports in HTML format, and then use the gadget to convert them into PDF format to view the reports and submit files, which alleviates the consumption of application server performance caused by real-time download of batch report data and improves the robustness and task processing efficiency of the entire system.

[0074] The embodiment of the present application also provides a data conversion device. It should be noted that the data conversion device of the embodiment of the present application can be used to execute the data conversion method provided by the embodiment of the present application. The data conversion device provided by the embodiment of the present application is introduced below.

[0075] Figure 3 Schematic diagram of a data conversion device according to an embodiment of the present application. Figure 3 As shown, the device includes: a reading module 30, a parsing module 32, a creating module 34 and a converting module 36. The device is described in detail below.

[0076] A reading module 30 is used to read the target data in the target format and store the read target data in the cached encryption object; a parsing module 32 is connected to the above-mentioned reading module 30, and is used to parse the target data in the encryption object to obtain the header data and table data of the target data; a creation module 34 is connected to the above-mentioned parsing module 32, and is used to create a configuration class of the conversion format, and generate format data of the conversion format according to the configuration class; a conversion module 36 is connected to the above-mentioned creation module 34, and is used to generate conversion data of the conversion format according to the class library, header data, table data, and format data.

[0077] Through the above device, the reading module 30 reads the target data in the target format and stores the read target data in the cached encrypted object; the parsing module 32 parses the target data in the encrypted object to obtain the header data and table data of the target data; the creation module 34 creates a configuration class of the conversion format and generates the format data of the conversion format according to the configuration class; the conversion module 36 generates the conversion data of the conversion format according to the class library, the header data, the table data, and the format data, which solves the problem that in the business system of the related technology, when the report in HTML format is generated in batches in PDF format, more application server resources will be consumed and there is a low efficiency. Thus, the effect of quickly and efficiently generating the conversion format PDF according to the target format HTML batches is achieved.

[0078] Optionally, the device further includes: a storage module, used to store the header data, table data, and format data in a table object of the target data.

[0079] Optionally, the conversion module includes: an adding unit, used to add data content of the table object by calling the file class through the class library; a generating unit, used to add the file class to the output stream of the conversion format through the writing class of the conversion format to generate conversion data.

[0080] Optionally, the adding unit includes: a generating subunit, used to generate a preset format object according to the header data and format data of the table object; and a filling subunit, used to fill the table data in the table object into the preset format object.

[0081] Optionally, the filling sub-unit includes: a paging secondary sub-unit, used to paging the preset format object; a copying secondary sub-unit, used to obtain the fixed header of the first page of the preset format object according to the first requirement, and copy it to the non-first page, wherein the first requirement is used to indicate the header format of the non-first page.

[0082] Optionally, generating a sub-unit includes: creating a secondary sub-unit to create a preset format object; inputting a secondary sub-unit to input header data into the preset format object; obtaining a secondary sub-unit to obtain format data of the preset format object according to a second requirement; generating a secondary sub-unit to generate a table containing a header in the preset format object based on the format data and the header data.

[0083] Optionally, the filling subunit includes: an editing secondary subunit, used to obtain the table format of the table to be edited; and a writing secondary subunit, used to write table data corresponding to the table into the table according to the table format.

[0084] Optionally, the device further includes: a packaging module, configured to compress and package the generated preset amount of conversion data to generate a conversion data packet, wherein the name of the conversion data packet includes a compressed packet name and a serial number.

[0085] The data conversion device provided by the embodiment of the present application reads the target data in the target format through the reading module 30, and stores the read target data in the cached encrypted object; the parsing module 32 parses the target data in the encrypted object to obtain the header data and table data of the target data; the creation module 34 creates a configuration class of the conversion format, and generates the format data of the conversion format according to the configuration class; the conversion module 36 generates the conversion data of the conversion format according to the class library, the header data, the table data, and the format data, which solves the problem that in the business system of the related technology, when the report in HTML format is generated in batches in PDF format, more application server resources will be consumed, and there is a problem of low efficiency. Thus, the effect of quickly and efficiently generating the conversion format PDF in batches according to the target format HTML is achieved.

[0086] The data conversion device includes a processor and a memory. The reading module 30, parsing module 32, creation module 34 and conversion module 36 are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.

[0087] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to quickly and efficiently generate batches of converted PDFs based on the target format HTML.

[0088] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0089] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the data conversion method is implemented.

[0090] An embodiment of the present invention provides a processor, which is used to run a program, wherein the data conversion method is executed when the program is running.

[0091] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application, such as Figure 4As shown, an embodiment of the present invention provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: reading target data in a target format, and storing the read target data in a cached encryption object; parsing the target data in the encryption object to obtain header data and table data of the target data; creating a configuration class for a conversion format, and generating format data for the conversion format according to the configuration class; generating conversion data for the conversion format according to a class library, header data, table data, and format data.

[0092] Optionally, after creating a configuration class for the conversion format and generating format data for the conversion format according to the configuration class, the method further includes: storing the header data, the table data, and the format data in a table object of the target data.

[0093] Optionally, generating conversion data of a conversion format based on the class library, header data, table data, and format data includes: calling a file class through the class library to add data content of a table object; adding the file class to an output stream of the conversion format through a writing class of the conversion format to generate conversion data.

[0094] Optionally, adding data content of a table object by calling a file class through a class library includes: generating a preset format object according to header data and format data of the table object; and filling the table data in the table object into the preset format object.

[0095] Optionally, filling the table data in the table object into the preset format object includes: paging the preset format object; for the non-first page of the preset format object, obtaining the fixed header of the first page according to the first requirement, and copying it to the non-first page, wherein the first requirement is used to indicate the header format of the non-first page.

[0096] Optionally, generating a preset format object based on the header data and format data of the table object includes: creating a preset format object; inputting the header data into the preset format object; obtaining the format data of the preset format object according to a second requirement; and generating a table including a header in the preset format object based on the format data and the header data.

[0097] Optionally, filling the table data in the table object into the preset format object includes: obtaining the table format of the table to be edited; and writing the table data corresponding to the table into the table according to the table format.

[0098] Optionally, after generating conversion data of a conversion format according to the class library, header data, table data, and format data, the method further includes: compressing and packaging a preset number of generated conversion data to generate a conversion data packet, wherein the name of the conversion data packet includes a compressed package name and a serial number.

[0099] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0100] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: reading target data in a target format and storing the read target data in a cached encrypted object; parsing the target data in the encrypted object to obtain header data and table data of the target data; creating a configuration class for a conversion format, and generating format data for the conversion format based on the configuration class; generating conversion data for the conversion format based on a class library, header data, table data, and format data.

[0101] Optionally, after creating a configuration class for the conversion format and generating format data for the conversion format according to the configuration class, the method further includes: storing the header data, the table data, and the format data in a table object of the target data.

[0102] Optionally, generating conversion data of a conversion format based on the class library, header data, table data, and format data includes: calling a file class through the class library to add data content of a table object; adding the file class to an output stream of the conversion format through a writing class of the conversion format to generate conversion data.

[0103] Optionally, adding data content of a table object by calling a file class through a class library includes: generating a preset format object according to header data and format data of the table object; and filling the table data in the table object into the preset format object.

[0104] Optionally, filling the table data in the table object into the preset format object includes: paging the preset format object; for the non-first page of the preset format object, obtaining the fixed header of the first page according to the first requirement, and copying it to the non-first page, wherein the first requirement is used to indicate the header format of the non-first page.

[0105] Optionally, generating a preset format object based on the header data and format data of the table object includes: creating a preset format object; inputting the header data into the preset format object; obtaining the format data of the preset format object according to a second requirement; and generating a table including a header in the preset format object based on the format data and the header data.

[0106] Optionally, filling the table data in the table object into the preset format object includes: obtaining the table format of the table to be edited; and writing the table data corresponding to the table into the table according to the table format.

[0107] Optionally, after generating conversion data of a conversion format according to the class library, header data, table data, and format data, the method further includes: compressing and packaging a preset number of generated conversion data to generate a conversion data packet, wherein the name of the conversion data packet includes a compressed package name and a serial number.

[0108] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0109] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0110] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0112] In a typical configuration, a computing device includes a business system of one or more processors, a CPU, input / output interfaces, a network interface, and memory.

[0113] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0114] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0115] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0116] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0117] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A data conversion method, characterized in that: include: Reading target data in a target format, and storing the read target data in a cached encrypted object, wherein the target data in the target format is data in a hypertext markup language HTML format; Parsing the target data in the encrypted object to obtain header data and table data of the target data; creating a configuration class for a conversion format, and generating format data of the conversion format according to the configuration class; generating conversion data of the conversion format according to a class library, the header data, the table data, and the format data; The step of generating the format data of the conversion format according to the configuration class includes: generating the format data of the portable document format PDF by creating a new PDFConfiguration portable document format configuration class; Wherein, the data conversion method further comprises: creating a configuration class of a conversion format, and after generating format data of the conversion format according to the configuration class, storing the header data, the table data, and the format data in a table object of the target data; wherein, generating the conversion data of the conversion format according to the class library, the header data, the table data, and the format data comprises: adding data content of the table object by calling a file class through the class library; adding the file class to the output stream of the conversion format through the writing class of the conversion format to generate the conversion data; Among them, adding the data content of the table object by calling the file class through the class library includes: generating a preset format object according to the header data of the table object and the format data; and filling the table data in the table object into the preset format object.

2. The method according to claim 1, characterized in that: Filling the table data in the table object into the preset format object comprises: Paging the preset format object; For the non-home page of the preset format object, a fixed header of the home page is obtained according to a first requirement and copied to the non-home page, wherein the first requirement is used to indicate a header format of the non-home page.

3. The method according to claim 1, characterized in that Generating a preset format object according to the header data of the table object and the format data comprises: Creating the preset format object; Inputting the header data into the preset format object; Acquire format data of a preset format object according to a second requirement; A table including the header is generated in the preset format object according to the format data and the header data.

4. The method according to claim 3, characterized in that Filling the table data in the table object into the preset format object comprises: Get the table format of the table to be edited; The table data corresponding to the table is written into the table according to the table format.

5. The method according to any one of claims 1 to 4, characterized in that After generating conversion data of the conversion format according to the class library, the header data, the table data, and the format data, the method further includes: The generated preset amount of conversion data is compressed and packaged to generate a conversion data packet, wherein the name of the conversion data packet includes a compression package name and a sequence number.

6. A data conversion device, characterized in that: include: A reading module, used for reading target data in a target format and storing the read target data in a cached encrypted object, wherein the target data in the target format is data in a hypertext markup language HTML format; A parsing module, used for parsing the target data in the encrypted object to obtain header data and table data of the target data; A creation module is used to create a configuration class for a conversion format, and generate format data of the conversion format according to the configuration class; A conversion module, used for generating conversion data of the conversion format according to the class library, the table header data, the table data, and the format data; Wherein, the creation module is also used to generate format data of the portable document format PDF by creating a new PDFConfiguration portable document format configuration class; Among them, the data conversion device also includes: a storage module, which is used to create a configuration class of the conversion format and generate the format data of the conversion format according to the configuration class, and then store the header data, the table data, and the format data in the table object of the target data; the conversion module includes: an adding unit, which is used to add the data content of the table object by calling the file class through the class library; a generating unit, which is used to add the file class to the output stream of the conversion format through the writing class of the conversion format to generate the conversion data; the adding unit includes: a generating subunit, which is used to generate a preset format object according to the header data and the format data of the table object; and a filling subunit, which is used to fill the table data in the table object into the preset format object.

7. A processor, characterized in that: The processor is used to run a program, wherein the program executes the data conversion method according to any one of claims 1 to 5 when running.

8. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the data conversion method described in any one of claims 1 to 5.