Display end, storage end and export end conversion method suitable for table data
The method addresses the inefficiencies of separate table designs by using XML format conversions to handle tables of any shape or style, enhancing software efficiency and data management.
Patent Information
- Application Number
- CN202411244972.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2025-01-03
AI Technical Summary
Existing methods for processing table data in computer technology often require separate designs for each table form and style, leading to increased coding and modification costs when requirements change.
A method for converting table data between display, storage, and export ends using XML format with specific structures to facilitate efficient conversion and parsing, allowing for the handling of tables of any shape or style without specialized designs.
Enables lossless conversion of table data across different formats, improving software development and maintenance efficiency and facilitating viewing, editing, and exporting of historical data.
Smart Images

Figure CN119248968A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method for converting a display end, a storage end, and an export end suitable for table data. Background Art
[0002] Computer technology, as the name implies, is technology related to computers. With the rapid development of science and technology, computer technology has been widely used. The processing of table data is one of the most basic and important parts of computer technology. Existing methods often use the "one table, one policy" approach when processing the display, storage, and export of table data, that is, designing a corresponding method for a table of a certain form and style. When there are many forms and styles of tables and the requirements change frequently, it will undoubtedly greatly increase the coding cost and modification cost. Summary of the invention
[0003] In order to overcome the deficiencies of the prior art, the present invention provides a method for converting the display end, storage end and export end of table data. By using the table data in XML format with a specific structure as the back-end data, and generating and parsing the back-end table data in XML format with a specific method, the front-end table data of the software interface or the export-end table data in the external path can be converted into the back-end data, and the back-end data can be saved in the database for later use, and the back-end data can also be converted into the export-end or front-end table data, so as to be exported to the external path or displayed in the software interface. The present invention can display, store, export and other operations on table data of any different styles and sizes, without having to specially design storage, display and export methods for tables of different shapes and styles, greatly improving the software development efficiency and later modification and maintenance efficiency of tables involving multiple styles, and can greatly facilitate the viewing, editing and exporting of historical table data.
[0004] A method for converting display, storage and export ends of table data, characterized by the following steps:
[0005] S1. Read table data information from the software interface or external path;
[0006] S2, converting the read table data information into backend table data;
[0007] S3, store the backend table data in the database, or directly call the backend table data;
[0008] S4, parsing backend table data;
[0009] S5. Export the table data information obtained by parsing to an external path or display it through a software interface.
[0010] Specifically, the table is a table of any shape or style, including a table with merged cells of any size in any area, a table with hidden rows or columns in any rows or columns, and a table in which cells can be filled with any string content.
[0011] Specifically, the back-end table data refers to XML format data that uses a specific structure to record basic table information and cell detailed information, wherein the basic table information includes the table name, total number of rows, total number of columns, hidden row numbers, and hidden column numbers, which is recorded by a group of first- and second-level nodes; the cell detailed information includes the cell column number, cell content, number of merged rows, and number of merged columns. The cell detailed information is recorded by row, and each row is recorded by a group of first- and second-level nodes. The information between different cells in the same node is separated by special characters.
[0012] Specifically, the specific process of step S2 is: first, obtain the basic information of the table, establish a group of xml first- and second-level nodes, and store the basic information in the group of nodes, the name of the first-level node of this group is the table name, and the name of the second-level node is the table name, the total number of rows, the total number of columns, the hidden row number, and the hidden column number; then, starting from the first row of the table, obtain the column number, content, number of merged rows, and number of merged columns of each cell in the row from left to right, establish a group of first- and second-level nodes for each row of cells and store the detailed information of the cells in the row in the group of nodes, the name of the first-level node of this group is data, and the name of the second-level node of this group is the cell column number, cell content, number of merged rows, and number of merged columns, and then write the detailed information of the content of each cell in this row into its corresponding node in turn, and the information of different cells is separated by special characters, and this is done until the last row of the table, completing all table data information conversion and recording, and obtaining the back-end table data in xml format.
[0013] Specifically, the specific process of step S4 is: first, read the first and second level nodes of the first group of xml table data, obtain the table name and the total number of rows and columns, and generate an empty table with the same number of rows and columns; then, starting from the second group, read the first and second level nodes of other groups in the xml table in sequence, obtain the cell content and merging status of each column row by row, fill the cell information separated by special characters in each node into the cells of the corresponding column of the row from left to right according to its column number, and merge rows and columns according to the cell merging status, and parse the first and second level nodes of all groups one by one in this way until all the first and second level nodes in the back-end table data are parsed; finally, set the rows and columns where the hidden row numbers and hidden column numbers are located to be hidden, complete the back-end table data parsing, and obtain the table data information that can be exported or displayed in the software interface.
[0014] The beneficial effects of the present invention are: lossless conversion of table data of any shape and style between the front end, back end and export end can be realized, including software interface display, database storage, export to external path, etc. of table data of any shape and style, which greatly improves the software development efficiency and subsequent modification and maintenance efficiency of tables involving multiple styles, and can greatly facilitate the viewing, editing and export of historical table data. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a flow chart of a method for converting display end, storage end and export end of table data according to the present invention;
[0016] Figure 2 It is a flow chart of the back-end table data generating method of the present invention.
[0017] Figure 3 It is a flow chart of the back-end table data parsing method of the present invention. DETAILED DESCRIPTION
[0018] The present invention is further described below in conjunction with the accompanying drawings and embodiments. The present invention includes but is not limited to the following embodiments.
[0019] like Figure 1 As shown, the present invention provides a method for converting the display end, storage end and export end of table data, which is applicable to tables of any shape and style, including tables with merged cells of any size in any area, hidden rows or columns in any rows or columns, and cells that can be filled with any string content. The specific implementation process of the present invention is as follows:
[0020] S1. Read table data information from the software interface or external path, where the data read from the software interface is the front-end table data, and the data read from the external path is the export-end table data (Excel or Word containing only tables).
[0021] S2. Convert the read table data information into back-end table data using a back-end table data generation method. The back-end table data refers to XML format data that uses a specific structure to record basic table information and cell detailed information, wherein the basic table information includes the table name, total number of rows, total number of columns, hidden row number, hidden column number, and is recorded by a group of first and second level nodes; the cell detailed information includes the cell column number, cell content, number of merged rows, and number of merged columns. The cell detailed information is recorded in rows, and each row is recorded by a group of first and second level nodes. The information between different cells in the same node is separated by special characters.
[0022] like Figure 2 As shown, the specific process of the backend table data generation method is:
[0023] First, obtain the basic information of the front-end / export end table from the software interface / external path, establish a group of xml first- and second-level nodes, and store the basic information in the group of nodes. The name of the first-level node in this group is the table name (table), and the name of the second-level node is the table name, total number of rows, total number of columns, hidden row number, and hidden column number; then starting from the first row, obtain the basic information such as the column number, content, merged rows and columns of the cells of the front-end / export end table from left to right, establish a group of first- and second-level nodes for each row of cells and store the detailed information of the cells in this row. The name of the first-level node in this group is (data), and the name of the second-level node in this group is the cell column number, cell content, merged row number, and merged column number. Then, some detailed information of each cell in this row is written into its corresponding node in turn. The data of different cells are separated by special characters to maintain the corresponding relationship between the columns until the last row of data in the table is filled in in this way, and all table data information conversion and recording are completed to obtain the back-end table data in xml format.
[0024] S3. Store the backend table data in the database, or directly call the backend table data.
[0025] S4, using the back-end table data parsing method to parse the back-end table data. Figure 3 As shown, the specific process of the backend table data parsing method is:
[0026] First, read the first group of first and second level nodes of the backend table data in XML format, obtain the table name and the total number of rows and columns, and generate an empty table with the same number of rows and columns; then start from the second group of first and second level nodes, parse the first and second level nodes one by one, use special characters as delimiters to obtain the column number, content, and number of merged rows and columns of the cells in each row, fill the content into the cells with the corresponding column number in this row, and merge the rows and columns simultaneously, until all the first and second level nodes in the backend table data are parsed in this way, the table is filled and merged, and finally the rows and columns where the hidden row numbers and hidden column numbers are located are set to be hidden, so that the table can be correctly presented in the export file / front-end interface.
[0027] S5. Export the table data information obtained by parsing to an external path or display it through a software interface.
[0028] The present invention provides a method for converting the display end, storage end and export end of table data. With the back-end table data as the medium, the front-end / export end table data is first converted into the fixed-form XML format back-end table data through the back-end table data generation method. The back-end table data can be stored in the database or directly called, and finally the back-end table data is converted into the export end / front-end table data through the back-end table data parsing method. The software interface display, database storage, and export to an external path of table data of any form and style can be realized.
[0029] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solution of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] Example 1
[0031] See also Figure 1 When you want to convert the table in the front-end interface into a table in a file under an external path without loss, the process path is: "Front-end interface" -> "Front-end table data" -> "Back-end table data" -> "Export end table data" -> "External folder". The main steps are:
[0032] S1. See Figure 2 , taking the table control of the software interface as input, calling the backend table data generation method, obtaining the table data information on the control, and generating the backend table data in XML format;
[0033] S2. See Figure 3 , taking the backend table data in XML format as input, calling the backend table data parsing method, obtaining the table data information recorded in the backend table data, generating the export end table data (Excel or Word containing only the table), and exporting it to an external path.
[0034] Example 2
[0035] See also Figure 1 When you want to convert a table in a file under an external path into a table presented on the software interface without loss, the process path is: "external folder" -> "export end table data" -> "back-end table data" -> "front-end table data" -> "software interface". The main steps are:
[0036] S1. See Figure 2 , get the target file from the external path, such as Excel or Word containing only tables, use it as input, call the backend table data generation method, obtain the table data information on the input file, and generate the backend table data in XML format;
[0037] S2. See Figure 3 , taking the backend table data in XML format as input, calling the backend table data parsing method, obtaining the table data information recorded in the backend table data, generating the frontend table data suitable for the table control of the software interface, and presenting it in the table control.
[0038] Example 3
[0039] See also Figure 1 When you want to save the table of the front-end interface in the database without loss, the process path is: "Front-end interface" -> "Front-end table data" -> "Back-end table data" -> "Database". The main steps are:
[0040] S1. See Figure 2 , taking the table control of the software interface as input, calling the backend table data generation method, obtaining the table data information on the control, and generating the backend table data in XML format;
[0041] S2. Save the backend table data in XML format in the database in text format.
[0042] Example 4
[0043] See also Figure 1 When you want to save the table data in a file under an external path to the database, the process path is: "external folder" -> "export end table data" -> "back-end table data" -> "database". The main steps are:
[0044] S1. See Figure 2 , get the target file from the external path, such as Excel or Word containing only tables, use it as input, call the backend table data generation method, obtain the table data information on the input file, and generate the backend table data in XML format;
[0045] S2. Save the backend table data in XML format in the database in text format.
[0046] Example 5
[0047] See also Figure 1 When the table data saved in the database is to be presented on the front-end interface, the process path is: "Database" -> "Back-end table data" -> "Front-end table data" -> "Front-end interface". The main steps are:
[0048] S1. Extract the backend table data of the table to be presented from the database.
[0049] S2. See Figure 3 , taking the backend table data in XML format as input, calling the backend table data parsing method, obtaining the table data information recorded in the backend table data, generating the frontend table data suitable for the table control of the software interface, and presenting it in the table control.
[0050] Example 6
[0051] See also Figure 1When you want to export the table data saved in the database to an external path, the process path is: "Database" -> "Backend table data" -> "Export end table data" -> "External folder". The main steps are:
[0052] S1. Extract the backend table data of the table to be presented from the database.
[0053] S2. See Figure 3 , taking the backend table data in XML format as input, calling the backend table data parsing method, obtaining the table data information recorded in the backend table data, generating the export-end table data in the set format (Excel or Word containing only the table), and presenting it in the table control.
Claims
1. A method for converting display, storage and export ends of table data, characterized in that Here are the steps: S1. Read table data information from the software interface or external path; S2, converting the read table data information into backend table data; S3, store the backend table data in the database, or directly call the backend table data; S4, parsing backend table data; S5. Export the table data information obtained by parsing to an external path or display it through a software interface.
2. A method for converting display, storage and export ends of table data as claimed in claim 1, characterized in that: The table is a table of any shape and style, including a table with merged cells of any size in any area, a table with hidden rows or columns in any row or column, and a table in which cells can be filled with any string content.
3. A method for converting display, storage and export ends of table data as claimed in claim 1, characterized in that: The backend table data refers to XML format data that uses a specific structure to record basic table information and cell detailed information, wherein the basic table information includes the table name, total number of rows, total number of columns, hidden row numbers, and hidden column numbers, which are recorded by a group of first- and second-level nodes; the cell detailed information includes the cell column number, cell content, number of merged rows, and number of merged columns. The cell detailed information is recorded by row, and each row is recorded by a group of first- and second-level nodes. The information between different cells in the same node is separated by special characters.
4. A method for converting display, storage and export ends of table data as claimed in claim 1, characterized in that: The specific process of step S2 is as follows: first, obtain the basic information of the table, establish a group of xml first and second level nodes, and store the basic information in the group of nodes. The name of the first level node in this group is the table name, and the name of the second level node is the table name, the total number of rows, the total number of columns, the hidden row number, and the hidden column number; Then, starting from the first row of the table, get the column number, content, number of merged rows, and number of merged columns of each cell in the row from left to right, establish a group of first- and second-level nodes for each row of cells, and store the detailed information of the cells in the row into the group of nodes. The name of the first-level node in this group is data, and the name of the second-level node in this group is cell column number, cell content, number of merged rows, and number of merged columns. Then write the detailed information of the content of each cell in this row into its corresponding node in turn, and the information of different cells is separated by special characters. This goes on until the last row of the table, completes all table data information conversion and recording, and obtains the back-end table data in XML format.
5. A method for converting display, storage and export ends of table data as claimed in claim 1, characterized in that: The specific process of step S4 is: first, read the first and second level nodes of the first group of xml table data, obtain the table name and the total number of rows and columns, and generate an empty table with the same number of rows and columns; then, starting from the second group, read the first and second level nodes of other groups in the xml table in sequence, obtain the cell content and merging status of each column row by row, fill the cell information separated by special characters in each node into the cells of the corresponding column of the row from left to right according to its column number, and merge rows and columns according to the cell merging status, and parse the first and second level nodes of all groups one by one in this way until all the first and second level nodes in the back-end table data are parsed; finally, set the rows and columns where the hidden row numbers and hidden column numbers are located to be hidden, complete the back-end table data parsing, and obtain the table data information that can be exported or displayed in the software interface.
