Table generation method, electronic device and storage medium

By obtaining the table configuration list and analyzing the logical tree to determine cell properties, calculating the position coordinates to generate a table, the problem of low table generation efficiency in the existing technology is solved, and more efficient automatic table generation is achieved.

CN118095237BActive Publication Date: 2024-12-06FAW VOLKSWAGEN AUTOMOTIVE CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410271300.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-11
Publication Date
2024-12-06
Estimated Expiration
2044-03-11

AI Technical Summary

Technical Problem

In the prior art, the table generation efficiency is low, mainly relying on manual editing, resulting in inefficiency.

Method used

By obtaining the table configuration list, determining the table header logic tree, analyzing the logic tree to determine the row height and column width of the cell, calculating the relative position coordinates, generating tables, and using electronic devices and storage media to achieve automated table generation.

Benefits of technology

It improves the efficiency of table generation, is faster and more flexible than manual editing, and is suitable for scenarios where table formats are frequently changed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118095237B_ABST
    Figure CN118095237B_ABST
Patent Text Reader

Abstract

The present application provides a table generation method, an electronic device and a storage medium. The method includes: obtaining a table configuration list, the table configuration list carries the header configuration information of the table to be generated; determining the header logic tree of the table to be generated according to the header configuration information; determining the row height and column width of each cell in the header of the table to be generated by parsing the header logic tree; determining the relative position coordinates of each cell in the header of the table to be generated according to the header configuration information and the row height and column width of each cell in the header of the table to be generated; generating the table to be generated according to the relative position coordinates of each cell in the header of the table to be generated and the row height and column width of each cell in the header. Therefore, compared with the generation of tables by manual editing by relevant staff, the efficiency of generating tables can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a table generation method, an electronic device and a storage medium. Background Art

[0002] In daily work and life, we often face the need to generate tables. For example, the upper-level supplier needs to provide the lower-level supplier with a performance statistical table every month, and the department needs to provide a statistical table of business completion every quarter. Therefore, in practical applications, it is usually necessary to generate tables.

[0003] Currently, tables are mainly generated by relevant staff through manual editing, but this method is inefficient. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a table generation method, an electronic device and a storage medium, so as to solve the problem of low table generation efficiency in the prior art.

[0005] A first aspect of an embodiment of the present application provides a table generation method, the method comprising:

[0006] Obtain a table configuration list, wherein the table configuration list carries table header configuration information of the table to be generated;

[0007] Determine a table header logic tree of the table to be generated according to the table header configuration information;

[0008] Determine the row height and column width of each cell in the header of the table to be generated by parsing the header logic tree;

[0009] Determine the relative position coordinates of each cell in the header of the table to be generated according to the header configuration information and the row height and column width of each cell in the header of the table to be generated;

[0010] The table to be generated is generated according to the relative position coordinates of each cell in the table header of the table to be generated, and the row height and column width of each cell in the table header.

[0011] Preferably, determining the header logic tree of the table to be generated according to the header configuration information specifically includes:

[0012] Generate a virtual node and use the virtual node as a root node;

[0013] According to the table header configuration information, each cell in the table header is acquired layer by layer to generate a node corresponding to the cell, which is used to generate the table header logic tree.

[0014] Preferably, determining the row height and column width of each cell in the header of the table to be generated by parsing the header logic tree specifically includes:

[0015] The table header logic tree is parsed by a preset algorithm to determine the row height and column width of each cell in the table header of the table to be generated.

[0016] Preferably, the header logic tree specifically includes a row header logic tree; and,

[0017] Parsing the table header logic tree by a preset algorithm to determine the row height and column width of each cell in the table header of the table to be generated specifically includes:

[0018] Determine the total number of layers of the header logic tree excluding the root node;

[0019] For each node in the header logic tree, determine whether the node is a leaf node;

[0020] In the case where the node is a leaf node, the row height of the cell corresponding to the node is determined to be 1; and the column width of the cell corresponding to the node is determined to be the total number of layers minus the number of layers to which the node belongs plus 1; or,

[0021] When the node is not a leaf node, the row height of the cell corresponding to the node is determined as the sum of the row heights of the cells corresponding to each child node of the node; and the column width of the cell corresponding to the node is determined as the maximum column width in the cells corresponding to each node in the layer to which the node belongs, minus the column width occupied by other nodes in the layer.

[0022] Preferably, the table header logic tree specifically includes a column header logic tree; and,

[0023] Parsing the table header logic tree by a preset algorithm to determine the row height and column width of each cell in the table header of the table to be generated specifically includes:

[0024] Determine the total number of layers of the header logic tree excluding the root node;

[0025] For each node in the header logic tree, determine whether the node is a leaf node;

[0026] In the case where the node is a leaf node, the column width of the cell corresponding to the node is determined to be 1; and the row height of the cell corresponding to the node is determined to be the total number of layers minus the number of layers to which the node belongs plus 1; or,

[0027] When the node is not a leaf node, the column width of the cell corresponding to the node is determined as the sum of the column widths of the cells corresponding to each child node of the node; and the row height of the cell corresponding to the node is determined as the maximum row height in the cells corresponding to each node in the layer to which the node belongs, minus the row height occupied by other nodes in the layer.

[0028] Preferably, generating the table to be generated according to the relative position coordinates of each cell in the header of the table to be generated, and the row height and column width of each cell in the header, specifically includes:

[0029] For each cell in the table header, respectively, generate a json data object of the cell using the relative position coordinates of the cell and the row height and column width of the cell, so as to obtain a json data object of each cell in the table header;

[0030] The JSON data object of each cell in the table header is parsed using parsing software to generate the table to be generated.

[0031] Preferably, the method further comprises: storing the json data object of each cell in the table header in a database.

[0032] Preferably, obtaining a table configuration list specifically includes:

[0033] A table configuration list sent by a client is obtained, wherein an information input page is set on the client so that a user can input relevant information on the information input page to generate the table configuration list.

[0034] A second aspect of an embodiment of the present application provides an electronic device, including:

[0035] Memory for storing computer programs;

[0036] A processor is used to execute any one of the methods described in the method embodiments of the present application.

[0037] A third aspect of an embodiment of the present application provides a storage medium, including: a program, which, when executed on an electronic device, enables the electronic device to execute any one of the methods in the method embodiments of the present application.

[0038] The table generation method provided by the embodiment of the present application includes obtaining a table configuration list, which carries the table header configuration information of the table to be generated, and then determining the table header logic tree of the table to be generated according to the table header configuration information, and then determining the row height and column width of each cell in the table header of the table to be generated by parsing the table header logic tree, and then determining the relative position coordinates of each cell in the table header of the table to be generated according to the table header configuration information and the row height and column width of each cell in the table header of the table to be generated, and then generating the table to be generated according to the relative position coordinates of each cell in the table header of the table to be generated and the row height and column width of each cell in the table header. Therefore, compared with the table generated by the relevant staff through manual editing, the efficiency of generating the table can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application.

[0041] Figure 2 A schematic diagram of a specific flow chart of a table generation method provided in an embodiment of the present application;

[0042] Figure 3-1 A schematic diagram of the specific structure of a row header logic tree provided in an embodiment of the present application;

[0043] Figure 3-2 A schematic diagram of the specific structure of a list header logic tree provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of the specific structure of a table generating device provided in accordance with another embodiment of the present application. DETAILED DESCRIPTION

[0045] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. In the description of the present application, terms such as "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance or sequence.

[0046] As mentioned above, in daily work and life, we often face the need to generate tables. For example, the upper-level supplier needs to provide the lower-level supplier with a performance statistical table every month, and the department needs to provide a statistical table of business completion every quarter. Therefore, in practical applications, it is usually necessary to generate tables. At present, the tables are mainly generated by relevant staff through manual editing, but this method is inefficient in generating tables.

[0047] In view of this, the embodiments of the present application provide a table generation method, device, electronic device and storage medium, which can be used to solve the technical problem. Figure 1 FIG. 1 is a schematic diagram of a specific structure of an electronic device provided in this embodiment. The electronic device 1 includes: at least one processor 11 and a memory 12. Figure 1 A processor is used as an example. The processor 11 and the memory 12 may be connected via a bus 10, and the memory 12 stores instructions that can be executed by the processor 11, and the instructions are executed by the processor 11, so that the electronic device 1 can execute all or part of the process of the method in the embodiment of the present application.

[0048] The electronic device 1 may be a client electronic device, such as a user's mobile phone, computer, etc. The electronic device 1 may also be a server electronic device, such as a server node, etc.

[0049] In one embodiment, the electronic device 1 serves as a client electronic device (hereinafter referred to as a client) and can directly execute the method provided in the embodiment of the present application to generate a table.

[0050] In one embodiment, the electronic device 1 acts as a server-side electronic device (hereinafter referred to as a server). At this time, the server can connect to multiple clients, and then obtain the table configuration list sent by the client, and then execute the method provided in the embodiment of the present application to generate a table. Of course, after generating the table, the server can also send the table to the client.

[0051] like Figure 2 The figure is a schematic diagram of a specific flow chart of the table generation method provided in the embodiment of the present application. The method can be performed by Figure 1 The method is performed by the electronic device 1 shown in the figure. Here, the method is described by taking the electronic device 1 as a server to perform the method. In this case, the method includes the following steps:

[0052] Step S21: Obtain a table configuration list, which carries the table header configuration information of the table to be generated.

[0053] Here, the table to be generated may be referred to as a table to be generated, and the header of the table to be generated is crucial. For example, for a commonly used Excel table, the key to generating the Excel table required by the user is to generate the header of the Excel table.

[0054] In practical applications, the header of a table can usually also include a column header and a row header, where the column header is the header of each column cell, and the row header is the table of each row cell. For example, as shown in Table 1, X1, X11, X12, X2 and X3 are the headers of each column cell, respectively, and therefore are column headers; Y1, Y11, Y12 and Y2 are the headers of each row cell, respectively, and therefore are row headers.

[0055] Table 1

[0056]

[0057] Of course, for a specific table, there may be only column headers, only row headers, or both column headers and row headers.

[0058] Based on this, for the header configuration information in step S21, when the table to be generated has only a row header, the header configuration information is specifically the row header configuration information, and then the row header can be configured according to the row header configuration information to generate the table to be generated. At this time, there may be no column header configuration information or the column header configuration information is empty; when the table to be generated has only a column header, the header configuration information is specifically the column header configuration information, and then the column header can be configured according to the column header configuration information to generate the table to be generated. At this time, there may be no row header configuration information or the row header configuration information is empty; of course, when the table to be generated has both a row header and a column header, the header configuration information includes the row header configuration information and the column header configuration information.

[0059] As for the specific implementation method of the above-mentioned step S21, in actual application, one implementation method may be to obtain the form configuration list input by the user. For example, an information input page may be set up on the server, and the user may directly fill in the relevant information on the page to generate and input the form configuration list; another implementation method may be to obtain the form configuration list sent by the client. For example, the information input page may be set up on the client, so that the user can enter the relevant information on the information input page of the client to generate the form configuration list, and then send the form configuration list to the server through the client, so that the server can obtain the form configuration list.

[0060] In addition, it is mentioned above that the table configuration list carries the header configuration information of the table to be generated. In actual applications, in addition to carrying the header configuration information, the table configuration list can usually carry other information. For example, Table 2 shows a table configuration list in actual applications.

[0061] Table 2

[0062] Course Code Advanced Subjects Row or Column List of columns corresponding to the row Course Name Sort code X1 List X1 1 X2 List X2 2 X21 X2 List X21 3 X211 X21 List X211 4 X212 X21 List X212 5 X22 X2 List X22 6 Y1 OK X211, X212, X22 Y1 7 Y11 Y1 OK X211, X212, X22 Y11 8 Y111 Y11 OK X211, X212, X22 Y111 9 Y112 Y11 OK X211, X212, X22 Y112 10 Y12 Y1 OK X211, X212, X22 Y12 11 Y2 OK X211, X212, X22 Y2 12 Y3 OK X211, X212, X22 Y3 13 Y31 Y3 OK X211, X212, X22 Y31 14 Y32 Y3 OK X211, X212, X22 Y32 15

[0063] In the table configuration list shown in Table 2, the fields corresponding to the header configuration information are "Account Number", "Superior Subject", "Row or Column" and "List of Columns Corresponding to Rows". At this time, the row header and column header of the table to be generated can be configured according to the field values ​​of these fields. Among them, the field value of the "Account Number" field is the account number of each cell in the header of the table to be generated; the field value of the "Superior Subject" field is the superior subject of the account corresponding to each cell in the header of the table to be generated; the field value of the "Row or Column" field is the row cell or column cell in the header of the table to be generated, so that the row header and column header can be distinguished; the field value of the "List of Columns Corresponding to Rows" field is the column cell corresponding to the row cell in the header of the table to be generated.

[0064] Of course, the header configuration information also includes row header configuration information and column header configuration information. For example, sort codes 1-6 are row header configuration information, and the row header of the table to be generated can be configured according to the row header configuration information. Sorting codes 7-15 are column header configuration information, and the column header of the table to be generated can be configured according to the column header configuration information.

[0065] In addition, in addition to the header configuration information, the table configuration list also carries other information. For example, the field word of the "Account Name" field records the account name of each cell in the header; the field word of the "Sort Code" field records the sort code of each cell in the header.

[0066] Step S22: Determine the header logic tree of the table to be generated according to the header configuration information.

[0067] As mentioned above, the header logic tree of the table to be generated can be determined according to the header configuration information. Specifically, a virtual node can be generated first, and the virtual node can be used as the root node. Then, according to the header configuration information, each cell in the header can be obtained layer by layer to generate a node corresponding to the cell, and finally generate a header logic tree.

[0068] Of course, the header configuration information mentioned above includes row header configuration information and column header configuration information. In actual applications, the row header configuration information can be used to generate a row header logic tree for the table to be generated, and the column header configuration information can also be used to generate a column header logic tree for the table to be generated.

[0069] For example, for the row header configuration information, a virtual node can be generated first, and the virtual node can be used as the root node. Then, according to the row header configuration information, each cell in the row header is obtained layer by layer to generate a node corresponding to the cell, and finally a row header logic tree is generated.

[0070] Similarly, for the list header configuration information, a virtual node can be generated first, and the virtual node can be used as the root node. Then, according to the list header configuration information, each cell in the list header is obtained layer by layer to generate a node corresponding to the cell, and finally a list header logic tree is generated.

[0071] For example, according to the header configuration information of the table configuration list shown in Table 2 above, it is possible to generate Figure 3-1 The row header logic tree shown in Figure 3-2 and the column header logic tree shown in Figure 3-2.

[0072] Among them, in the row header logic tree shown in 3-1, the root node (i.e. Figure 3-1 3-2, the root node (that is, Figure 3-2 Root2) in is a virtual node, and nodes X1, X2, X21, X22, X211 and X212 correspond to the cells in the list header respectively.

[0073] Step S23: Determine the row height and column width of each cell in the header of the table to be generated by parsing the header logic tree.

[0074] After determining the header logic tree of the table to be generated through the above-mentioned step S22, in this step S23, the header logic tree is further parsed to determine the row height and column width of each cell in the header of the table to be generated. For example, the header logic tree can be parsed by a preset algorithm to determine the row height and column width of each cell in the header of the table to be generated, wherein the preset algorithm can be a BFS traversal algorithm (Breadth First Search) or other traversal algorithms.

[0075] For example, the preset algorithm shown below can be used to parse the table header logic tree. At this time, the column header logic tree and the row header logic tree can be parsed by the preset algorithm respectively to determine the row height and column width of each cell in the table header to be generated:

[0076] Therefore, the table header logic tree can also be specifically a row table header logic tree; at this time, the total number of layers of the table header logic tree excluding the root node can also be determined first, for example, Figure 3-1 In the row header logic tree shown, it is determined that the total number of layers after excluding the root node is also 3; after obtaining the total number of layers, each node in the header logic tree is further determined to determine whether the node is a leaf node.

[0077] When the node is a leaf node, the row height of the cell corresponding to the node is determined to be 1; and the column width of the cell corresponding to the node is determined to be the total number of layers minus the number of layers to which the node belongs plus 1.

[0078] For example, when the node is a leaf node, the column width and row height of the cell corresponding to the node can be determined by the following formula: rs=1, where rs is the row height; cs=maxHeight-the number of layers to which the node belongs+1, where cs is the column width, and maxHeight is the total number of layers excluding the root node.

[0079] Of course, when the node is not a leaf node, the row height of the cell corresponding to the node is determined as the sum of the column widths of the cells corresponding to each child node of the node; and the row height of the cell corresponding to the node is determined as the maximum column width in the cells corresponding to each node in the layer to which the node belongs (that is, the column width of the cell with the largest column width among these cells), minus the column width occupied by other nodes in the layer.

[0080] As mentioned above, the table header logic tree can be specifically a column header logic tree; the total number of layers of the table header logic tree excluding the root node can be determined first (the total number of layers after excluding the root node will be referred to as the total number of layers later). For example, as mentioned in the above step S22, the root node of the column header logic tree is a virtual node and does not correspond to a cell in the table header. Therefore, the layer of the root node can be excluded to determine the total number of layers of the table header logic tree excluding the root node. For example, Figure 3-2 In the table header logic tree shown, it is determined that the total number of layers after excluding the root node is 3; after obtaining the total number of layers, each node in the table header logic tree is further determined to determine whether the node is a leaf node, wherein the leaf node specifically refers to a node without a child node. In practical applications, the total number of layers can be determined by traversing the table header logic tree.

[0081] When the node is a leaf node, the column width of the cell corresponding to the node is determined to be 1, wherein the column width of 1 specifically refers to 1 unit width, and subsequent other values ​​of the column width (such as n, etc., where n can be a specific value) also refer to the column width being n unit widths. Of course, the specific width corresponding to the 1 unit width can be set according to actual needs; and the row height of the cell corresponding to the node is determined to be the total number of layers minus the number of layers to which the node belongs plus 1. Similarly, for the row height of the cell, the value 1 refers to 1 unit height, and other values ​​of the row height (such as m, etc., where m can be a specific value) also refer to the row height being m unit heights. The specific height corresponding to the 1 unit height can also be set according to actual needs.

[0082] For example, when the node is a leaf node, the column width and row height of the cell corresponding to the node can be determined by the following formula: cs=1, where cs is the column width; rs=maxHeight-the number of layers to which the node belongs+1, where rs is the row height, and maxHeight is the total number of layers excluding the root node.

[0083] Of course, when the node is not a leaf node, the column width of the cell corresponding to the node is determined as the sum of the column widths of the cells corresponding to each child node of the node; and the row height of the cell corresponding to the node is determined as the maximum row height of the cells corresponding to each node in the layer to which the node belongs (that is, the row height of the cell with the largest row height among these cells), minus the row height occupied by other nodes in the layer.

[0084] For the first cell in the header, the column width can be the maxHeight of the row header logical tree, that is, the total number of layers excluding the root node.

[0085] Step S24: Determine the relative position coordinates of each cell in the header of the table to be generated according to the header configuration information and the row height and column width of each cell in the header of the table to be generated.

[0086] As mentioned above, the header configuration information may include column header configuration information and row header configuration information, which are used to configure the column header and row header of the table to be generated, respectively, and then the superior-subordinate relationship between each cell can be determined according to the header configuration information. For example, in the header configuration information shown in Table 2 above, the superior-subordinate relationship between each cell can be determined according to the field value of the "superior subject" field, and then according to the superior-subordinate relationship between each cell, and the row height and column width of each cell in the header of the table to be generated, the relative position coordinates of each cell in the header can be determined. For example, the position coordinates of the first cell can be determined first, wherein the first cell can be the first cell in the upper left corner of the header, at which time the position coordinates of the first cell can be determined as (0, 0), or the coordinate point of the upper left corner of the first cell can be used as the position coordinates of the first cell, and then according to the superior-subordinate relationship between each cell, and the row height and column width of each cell in the header, the position coordinates of other cells in the header can be further determined, thereby determining the relative position coordinates of each cell in the header.

[0087] Specifically, for example, the header configuration information shown in the above Table 2, as well as the row height and column width of each cell in the header determined by the above steps, can be combined, and the basic attributes and subordinate relationships of each cell can be indicated, and each acquired data can be converted into a corresponding data structure. For example, the data structure of each cell can be obtained as shown in Table 3 first, and then the data structure shown in Table 3 can be further processed to obtain the data structure shown in Table 4.

[0088] Table 3

[0089]

[0090] Table 4

[0091]

[0092] For example, in actual applications, for each cell, a terminal (such as a back-end device) can generate a data structure as shown in Table 3 for the cell, and then send the data structure to another terminal (such as a front-end device), and then the other terminal generates a data structure as shown in Table 4; or a terminal device can generate a data structure as shown in Table 3 for each cell, and then the terminal device generates a data structure as shown in Table 4 based on the data structure.

[0093] The specific method for calculating the relative position coordinates of each cell is as follows. For example, you can declare variables currentX and currentY first, and then use each cell in each header as the current cell in turn, and use currentX to record the position coordinates of the row of the current cell (called the current row), and use currentY to record the position coordinates of the column of the current cell (called the current column). Since the row and column processing methods are the same, only currentX is used as an example for explanation.

[0094] First, we can loop through the data array of currentX. Since the elements in the data array (i.e., currentX of each cell) are arranged in order, the elements of the n+1th layer will not appear before the elements of the nth layer. Each traversed element is recorded as item, where the value of the top-level element can be empty; then execute the subsequent process, namely:

[0095]

[0096] In this way, the relative position coordinates of each cell in the header can be obtained.

[0097] Step S25: Generate the table to be generated according to the relative position coordinates of each cell in the header of the table to be generated, as well as the row height and column width of each cell.

[0098] After the relative position coordinates of each cell in the header of the table to be generated and the sum of the row height and column width of each cell are obtained through the above steps, the table to be generated can be directly generated using the relative position coordinates of each cell and the row height and column width of each cell. For example, the relative position coordinates of each cell and the row height and column width of each cell can be directly input into relevant parsing software for parsing, thereby generating the table to be generated.

[0099] It should be further explained that in actual applications, servers are usually arranged in a distributed manner. In a distributed server, each node will process different types of tasks, so that the complete task can be performed through the cooperation between the nodes, thereby improving the processing efficiency of the task. Therefore, the specific implementation method of step S25 can be specifically as follows: the first step is to generate the json data object of each cell in the header respectively using the relative position coordinates of the cell and the row height and column width of the cell, so that the json data object of each cell can be obtained. On the one hand, the json data object is convenient for storage in the database, and on the other hand, it is more convenient for parsing by the parsing software; the second step is to use the parsing software to parse the json data objects of each cell, so as to generate the header of the table to be generated, and thus generate the table to be generated.

[0100] Table 5

[0101]

[0102] At this time, for example, one or more nodes in the distributed server can be used to process the first step to obtain the json data object of each cell for easy storage and parsing; then other nodes of the distributed server are used to process the second step to generate the table to be generated.

[0103] For example, the above-mentioned data structure of the json data object is shown in Table 4. At this time, according to the data structure, the json data object of the cell can be generated by using the relative position coordinates of the cell and the row height and column width of the cell.

[0104] For example, the table header configuration information in the table configuration list shown in Table 2 above, using the method provided in the embodiment of the present application, the table generated according to the table header configuration information (that is, the table to be generated that is finally generated) is a table as shown in Table 5.

[0105] At this point, combined with the data structure of the json data object shown in Table 4 and the table shown in Table 5, it is easy to understand that according to the data structure, the json data object of cell X1 is generated using the relative position coordinates of cell X1 and the row height and column width of cell X1 as shown in Table 4.

[0106] Similarly, the json data objects of other cells in Table 4 can be obtained in the same way, and then the json data objects of the cells are parsed using parsing software to generate the table shown in Table 5, that is, the table to be generated.

[0107] The table generation method provided by the embodiment of the present application includes obtaining a table configuration list, which carries the table header configuration information of the table to be generated, and then determining the table header logic tree of the table to be generated and the relative position coordinates of each cell in the table header of the table to be generated according to the table header configuration information, and then determining the row height and column width of each cell in the table header of the table to be generated by parsing the table header logic tree, and then generating the table to be generated according to the relative position coordinates of each cell in the table header of the table to be generated and the row height and column width of each cell. Therefore, compared with the table generated by the relevant staff through manual editing, the efficiency of generating the table can be improved.

[0108] Of course, the method provided in the embodiment of the present application, in addition to being able to improve the efficiency of generating tables, is compared to the existing method of generating tables through manual editing. Since this method ultimately generates the table to be generated through a table configuration list, it is possible to more flexibly configure the structure of the generated table in scenarios where the table format needs to be changed frequently.

[0109] Based on the same inventive concept as the table generation method provided in the embodiment of the present application, the embodiment of the present application also provides a table generation device. If there is any unclear point, please refer to the corresponding content of the method embodiment. Figure 4 FIG. 4 is a schematic diagram of a specific structure of the device 40, which includes a configuration list acquisition unit 401, a determination unit 402, a parsing unit 403 and a table generation unit 404, wherein:

[0110] A configuration list acquisition unit 401 is used to acquire a table configuration list, wherein the table configuration list carries table header configuration information of a table to be generated;

[0111] A logic tree determining unit 402, configured to determine a header logic tree of the table to be generated according to the header configuration information;

[0112] The parsing unit 403 is used to determine the row height and column width of each cell in the header of the table to be generated by parsing the header logic tree;

[0113] A position coordinate determining unit 404, configured to determine the relative position coordinates of each cell in the header of the table to be generated according to the header configuration information and the row height and column width of each cell in the header of the table to be generated;

[0114] The table generating unit 405 is used to generate the table to be generated according to the relative position coordinates of each cell in the table header of the table to be generated, and the row height and column width of each cell.

[0115] The device 40 provided in the embodiment of the present application is adopted. Since the device 40 adopts the same inventive concept as the method provided in the embodiment of the present application, on the premise that the method can solve the technical problem, the device 40 can also solve the technical problem, which will not be repeated here.

[0116] The embodiment of the present invention further provides a storage medium, including: a program, which, when running on an electronic device, enables the electronic device to execute all or part of the process of the method in the above embodiment. The storage medium may be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD). The storage medium may also include a combination of the above types of memories.

[0117] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A table generation method, characterized in that: The method comprises: Obtain a table configuration list, wherein the table configuration list carries table header configuration information of the table to be generated; Determine a table header logic tree of the table to be generated according to the table header configuration information; Determine the row height and column width of each cell in the header of the table to be generated by parsing the header logic tree; Determine the relative position coordinates of each cell in the header of the table to be generated according to the header configuration information and the row height and column width of each cell in the header of the table to be generated; Generate the table to be generated according to the relative position coordinates of each cell in the table header of the table to be generated, and the row height and column width of each cell in the table header; The process of parsing the table header logic tree to determine the row height and column width of each cell in the table header of the table to be generated specifically includes: Parsing the table header logic tree by a preset algorithm to determine the row height and column width of each cell in the table header of the table to be generated; The table header logic tree specifically includes a row table header logic tree; and Parsing the table header logic tree by a preset algorithm to determine the row height and column width of each cell in the table header of the table to be generated specifically includes: Determine the total number of layers of the header logic tree excluding the root node; For each node in the header logic tree, determine whether the node is a leaf node; In the case where the node is a leaf node, the row height of the cell corresponding to the node is determined to be 1; and the column width of the cell corresponding to the node is determined to be the total number of layers minus the number of layers to which the node belongs plus 1; or, When the node is not a leaf node, the row height of the cell corresponding to the node is determined as the sum of the row heights of the cells corresponding to each child node of the node; and the column width of the cell corresponding to the node is determined as the maximum column width in the cells corresponding to each node in the layer to which the node belongs, minus the column width occupied by other nodes in the layer.

2. The method according to claim 1, characterized in that Determining the header logic tree of the table to be generated according to the header configuration information specifically includes: Generate a virtual node and use the virtual node as a root node; According to the table header configuration information, each cell in the table header is acquired layer by layer to generate a node corresponding to the cell, which is used to generate the table header logic tree.

3. The method according to claim 1, characterized in that The table header logic tree specifically includes a column header logic tree; and, Parsing the table header logic tree by a preset algorithm to determine the row height and column width of each cell in the table header of the table to be generated specifically includes: Determine the total number of layers of the header logic tree excluding the root node; For each node in the header logic tree, determine whether the node is a leaf node; In the case where the node is a leaf node, the column width of the cell corresponding to the node is determined to be 1; and the row height of the cell corresponding to the node is determined to be the total number of layers minus the number of layers to which the node belongs plus 1; or, When the node is not a leaf node, the column width of the cell corresponding to the node is determined as the sum of the column widths of the cells corresponding to each child node of the node; and the row height of the cell corresponding to the node is determined as the maximum row height in the cells corresponding to each node in the layer to which the node belongs, minus the row height occupied by other nodes in the layer.

4. The method according to claim 1, characterized in that: Generating the table to be generated according to the relative position coordinates of each cell in the header of the table to be generated, and the row height and column width of each cell in the header, specifically includes: For each cell in the table header, respectively, generate a json data object of the cell using the relative position coordinates of the cell and the row height and column width of the cell, so as to obtain a json data object of each cell in the table header; The JSON data object of each cell in the table header is parsed using parsing software to generate the table to be generated.

5. The method according to claim 4, characterized in that The method further includes: storing the JSON data object of each cell in the table header in a database.

6. The method according to claim 1, characterized in that Get the table configuration list, including: A table configuration list sent by a client is obtained, wherein an information input page is set on the client so that a user can input relevant information on the information input page to generate the table configuration list.

7. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the method according to any one of claims 1 to 6.

8. A storage medium, characterized in that: The invention comprises: a program, which, when running on an electronic device, enables the electronic device to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • PDF document recognition method

    CN104063364A

  • Report generating method and device

    CN106294301A

  • Method and system for outputting table document in paging mode through tree data

    CN115438638A

  • Table information acquisition method and device, computer equipment and storage medium

    CN117217172A

  • Multiple Related Event Handling Based on XML Encoded Event Handling Definitions

    US20100235368A1