Table adjustment method, device, electronic device and storage medium
By monitoring the column width and row height in the table and automatically adjusting the column width and row height of the table, the problems of low table adjustment efficiency and messy structure in the existing technology are solved, and neat and orderly data display and improved reading effect are achieved.
Patent Information
- Application Number
- CN202111242647.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-25
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-10-25
AI Technical Summary
The existing table adjustment method is inefficient and the structure after adjustment is disordered, so the data content cannot be displayed evenly.
By monitoring the column width and cell row height of any column in the table, determine the target column width and row height based on the row height of each cell in the column, the column width and magnification of the column, and automatically adjust the column width and row height. to achieve adaptive adjustment.
Improve the efficiency of table adjustment, make the table structure neat and orderly, display the data content of each cell balancedly, and improve the reading effect.
Smart Images

Figure CN114004203B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of page display, and in particular to a table adjustment method, device, electronic device and storage medium. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] When displaying data content in a table, it is usually displayed according to a preset fixed row height, fixed column width, or fixed row height and column width of the cell. If the amount of data displayed in a cell is too large, it is necessary to manually adjust the column borders and / or row borders of the table to adjust the column width and / or row height of the table so that the data content contained in the cell can be fully displayed. However, this table adjustment method is inefficient, and the table structure after adjustment is disordered, and the data content in all cells in the table cannot be displayed evenly. Summary of the invention
[0004] In response to the above technical problems, the present disclosure provides a table adjustment method, device, electronic device and storage medium to improve the efficiency of table adjustment and make the overall structure of the table neat and orderly so that the data content in each cell in the table can be displayed evenly.
[0005] In one aspect, an embodiment of the present disclosure provides a table adjustment method, comprising:
[0006] In response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the adjustment condition, determining a first target column width of the column based on the row height of each cell in the column, the column width and the first magnification;
[0007] Determining a first target row height corresponding to each cell in the column according to the area of the data contained in each cell in the column and the first target column width;
[0008] Determine a second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column;
[0009] The column width of the column is adjusted to the first target column width, and the row height of each cell in the column is adjusted to the second target row height corresponding to each cell.
[0010] In a possible implementation manner, it is determined that the column width of any column of the table and the row height of each cell in the column meet the adjustment condition in the following manner:
[0011] If the row height of any cell in the column is greater than the column width of the column at the second magnification, determining that the column width and the row height of the cells in the column meet the adjustment condition; or
[0012] If the dispersion of the row heights of the cells in the column is greater than or equal to a preset threshold, it is determined that the column width of the column and the row heights of the cells in the column meet an adjustment condition.
[0013] In a possible implementation, determining a first target column width of the column based on the row height of each cell in the column, the column width of the column, and the first magnification specifically includes:
[0014] Determine a second target column width corresponding to each cell in the column according to the row height of each cell in the column and the first magnification, and determine a third target column width corresponding to each cell in the column according to the row height of each cell in the column and the second magnification, wherein the second magnification is greater than the first magnification;
[0015] In response to the maximum third target column width being less than or equal to the minimum second target column width, determining a target column width interval according to the maximum third target column width and the minimum second target column width;
[0016] In response to the maximum third target column width being greater than the minimum second target column width, determining the target column width interval according to any two of the third target column widths and the minimum second target column width;
[0017] Any value in the target column width range is determined as the first target column width of the column.
[0018] In a possible implementation, determining a first target column width of the column based on the row height of each cell in the column, the column width of the column, and the first magnification specifically includes:
[0019] respectively setting the first target column width parameter corresponding to each cell in the column;
[0020] Determine a row height target function corresponding to each cell in the column according to a first target column width parameter corresponding to each cell in the column and the first magnification;
[0021] Calculate the first target column width parameter value corresponding to each cell in the column according to the area of the data contained in each cell in the column and the row height target function corresponding to each cell;
[0022] The first target column width of the column is determined according to each of the first target column width parameter values.
[0023] In a possible implementation, determining a row height target function corresponding to each cell in the column according to a target column width parameter corresponding to each cell in the column and the first magnification specifically includes:
[0024] The following formula is determined as the row height target function corresponding to each cell in the column:
[0025] h i =a1*x i
[0026] Among them, h i represents the row height objective function corresponding to the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column;
[0027] a1 represents the first magnification;
[0028] x i Indicates the first target column width parameter corresponding to the i-th cell in the column.
[0029] In a possible implementation, according to the area of the data contained in each cell in the column and the corresponding row height target function, calculating the first target column width parameter value corresponding to each cell in the column specifically includes:
[0030] The first target column width parameter value corresponding to each cell in the column is calculated by the following formula:
[0031]
[0032] Among them, x i Represents the first target column width parameter corresponding to the i-th cell in the column;
[0033] s i Represents the area of the data contained in the i-th cell in the column.
[0034] In a possible implementation, determining a first target column width of the column based on the row height of each cell in the column, the column width of the column, and the first magnification specifically includes:
[0035] Setting a second target column width parameter for each cell in the column;
[0036] According to the area of data contained in each cell in the column, the second target column width parameter and the first magnification, setting a column width target function corresponding to the column;
[0037] A first target column width of the column is obtained by calculation according to the column width target function.
[0038] In a possible implementation, setting a column width objective function corresponding to the column according to the area of data contained in each cell in the column, the target column width parameter, and the first magnification specifically includes:
[0039] Set the following formula as the column width objective function corresponding to the column in question:
[0040]
[0041] Wherein, f(x) represents the column width objective function corresponding to the column;
[0042] s i represents the area of data contained in the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column;
[0043] x represents the second target column width parameter of each cell in the column;
[0044] a1 represents the first magnification.
[0045] In a possible implementation, determining the second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column specifically includes:
[0046] For each cell in the column, if it is determined that the first target row height corresponding to the cell is greater than or equal to the row height of the cell, the first target row height corresponding to the cell is determined as the second target row height corresponding to the cell;
[0047] If it is determined that the first target row height corresponding to the cell is smaller than the row height of the cell, the row height of the cell is determined as the second target row height corresponding to the cell.
[0048] In one aspect, an embodiment of the present disclosure provides a table adjustment device, comprising:
[0049] A first determination unit, configured to determine a first target column width of any column in the table based on the row height of each cell in the column, the column width, and a first magnification in response to monitoring that the column width and the row height of the cells in the column satisfy an adjustment condition;
[0050] A second determining unit, configured to determine a first target row height corresponding to each cell in the column according to an area of data contained in each cell in the column and the first target column width;
[0051] A third determining unit, configured to determine a second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column;
[0052] The adjusting unit is used to adjust the column width of the column to the first target column width, and adjust the row height of each cell in the column to the second target row height corresponding to each cell.
[0053] In a possible implementation, the first determination unit is specifically used to determine whether the column width of any column of the table and the row height of each cell in the column meet the adjustment condition in the following manner: if the row height of any cell in the column is greater than the column width of the column at the second magnification, then it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition; or if the discreteness of the row height of each cell in the column is greater than or equal to a preset threshold, then it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition.
[0054] In a possible implementation, the first determination unit is specifically used to determine the second target column width corresponding to each cell in the column according to the row height of each cell in the column and the first magnification, and to determine the third target column width corresponding to each cell in the column according to the row height of each cell in the column and the second magnification, wherein the second magnification is greater than the first magnification; in response to the maximum third target column width being less than or equal to the minimum second target column width, determining a target column width interval according to the maximum third target column width and the minimum second target column width; in response to the maximum third target column width being greater than the minimum second target column width, determining the target column width interval according to any two of the third target column widths and the minimum second target column width; and determining any value in the target column width interval as the first target column width of the column.
[0055] In a possible implementation, the first determination unit is specifically used to set a first target column width parameter corresponding to each cell in the column; determine a row height target function corresponding to each cell in the column according to the first target column width parameter corresponding to each cell in the column and the first magnification; calculate the first target column width parameter value corresponding to each cell in the column according to the area of the data contained in each cell in the column and the row height target function corresponding to each cell in the column; and determine the first target column width of the column according to each of the first target column width parameter values.
[0056] In a possible implementation manner, the first determining unit is specifically configured to determine the following formula as the row height target function corresponding to each cell in the column:
[0057] h i =a1*xi
[0058] Among them, h i represents the row height objective function corresponding to the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column;
[0059] a1 represents the first magnification;
[0060] x i Indicates the first target column width parameter corresponding to the i-th cell in the column.
[0061] In a possible implementation manner, the first determining unit is specifically configured to calculate the first target column width parameter value corresponding to each cell in the column by using the following formula:
[0062]
[0063] Among them, x i Represents the first target column width parameter corresponding to the i-th cell in the column;
[0064] s i Represents the area of the data contained in the i-th cell in the column.
[0065] In a possible implementation, the first determination unit is specifically used to set a second target column width parameter for each cell in the column; set a column width target function corresponding to the column according to the area of data contained in each cell in the column, the second target column width parameter and the first magnification; and calculate the first target column width of the column according to the column width target function.
[0066] In a possible implementation manner, the first determining unit is specifically configured to set the following formula as the column width objective function corresponding to the column:
[0067]
[0068] Wherein, f(x) represents the column width objective function corresponding to the column;
[0069] s i represents the area of data contained in the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column;
[0070] x represents the second target column width parameter of each cell in the column;
[0071] a1 represents the first magnification.
[0072] In a possible implementation, the third determination unit is specifically used to, for each cell in the column, if it is determined that the first target row height corresponding to the cell is greater than or equal to the row height of the cell, then determine the first target row height corresponding to the cell as the second target row height corresponding to the cell; if it is determined that the first target row height corresponding to the cell is less than the row height of the cell, then determine the row height of the cell as the second target row height corresponding to the cell.
[0073] On the one hand, an embodiment of the present disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the table adjustment method described in the present disclosure is implemented when the processor executes the computer program.
[0074] On the one hand, an embodiment of the present disclosure provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps in the table adjustment method described in the present disclosure are implemented.
[0075] The beneficial effects of the embodiments of the present disclosure are as follows:
[0076] The table adjustment method, device, electronic device and storage medium provided by the embodiments of the present disclosure, in response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the preset conditions, determine the first target column width of the column according to the row height of each cell in the column, the column width of the column and the first magnification, determine the first target row height (i.e., ideal target row height) corresponding to each cell in the column according to the area of data in each cell in the column and the first target column width, and then determine the final target row height to be adjusted corresponding to each cell in the column: the second target row height according to the first target row height of each cell in the column and the row height of each cell in the column, adjust the column width of the column to the first target column width, and adjust the row height of each cell in the column to the second target row height corresponding to each cell in the column, thereby realizing automatic adaptive adjustment of the row height and column width. In the embodiments of the present disclosure, automatic adaptive adjustment of the row height and column width is realized at the same time, thereby improving the table adjustment efficiency, making the overall structure of the table neat and orderly, and making the data content in each cell in the table achieve a balanced display effect, thereby improving the reading effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0078] Figure 1 A schematic diagram of an application scenario of the table adjustment method provided in an embodiment of the present disclosure;
[0079] Figure 2 A schematic diagram of an implementation flow of a table adjustment method provided in an embodiment of the present disclosure;
[0080] Figure 3 A schematic diagram of an implementation flow of determining a first target column width of any column that meets an adjustment condition provided by an embodiment of the present disclosure;
[0081] Figure 4 A schematic diagram of another implementation flow of determining a first target column width of any column that meets an adjustment condition provided by an embodiment of the present disclosure;
[0082] Figure 5 A schematic diagram of another implementation flow of determining a first target column width of any column that meets an adjustment condition provided by an embodiment of the present disclosure;
[0083] Figure 6 A schematic diagram of the structure of a table adjustment device provided in an embodiment of the present disclosure;
[0084] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0085] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0086] The embodiments of the present disclosure may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0087] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0088] For ease of understanding, the technical terms involved in the embodiments of the present disclosure are explained as follows:
[0089] 1. Cell row height: the height from the top edge to the bottom edge of a cell in a table.
[0090] 2. Cell column width: the width from the left edge to the right edge of a cell in a table.
[0091] 3. Row height: The height of a row in a table. All cells in the same row have the same row height.
[0092] 4. Column width: The width of a column in a table. All cells in the same column have the same column width.
[0093] 5. Embedded images: Images embedded in cells use a cell as a container and are limited to display within the cell.
[0094] 6. Golden rectangle: The ratio of the length to width of the golden rectangle is the golden ratio.
[0095] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure. SUMMARY OF THE INVENTION
[0097] The inventors have found that when displaying data content in a table, in the related art, it is usually displayed according to a fixed row height, a fixed column width, or a fixed row height and column width of a pre-set cell. If the amount of data content displayed in a cell is too large, for example, when the text data content in the cell is too long, or when the area of the embedded picture inserted in the cell is too large, it is necessary to manually adjust the column borders and / or row borders of the table to adjust the column width and / or row height of the table. For example, the column width can be adjusted by double-clicking the column border of the table while the row height is fixed, or the row height can be adjusted by double-clicking the row border of the table while the column width is fixed, or the row height and column width can be manually adjusted separately, so that the data content contained in the cell can be fully displayed. However, this table adjustment method has low adjustment efficiency, and the table structure after adjustment is messy and disordered, and the data content in all cells in the table cannot be displayed evenly.
[0098] In order to solve the above problems, the present disclosure proposes a table adjustment method, device, electronic device and storage medium. In response to monitoring that the column width of any column in a table and the row height of the cells in the column meet a preset condition, the first target column width of the column is determined according to the row height of each cell in the column, the column width of the column and the first magnification. According to the area of data in each cell in the column and the first target column width, the first target row height (i.e., the ideal target row height) corresponding to each cell in the column is determined. Then, according to the first target row height of each cell in the column and the row height of each cell in the column, the final target row height to be adjusted corresponding to each cell in the column is determined: the second target row height. The column width of the column is adjusted to the first target column width, and the row height of each cell in the column is adjusted to the second target row height corresponding to each cell in the column. Thus, automatic adaptive adjustment of the row height and column width is achieved. In the embodiment of the present disclosure, automatic adaptive adjustment of the row height and column width is achieved at the same time, which improves the table adjustment efficiency, makes the overall structure of the table neat and orderly, and enables the data content in each cell in the table to achieve a balanced display effect, thereby improving the reading effect.
[0099] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
[0100] Application Scenario Overview
[0101] refer to Figure 1 , which is a schematic diagram of an application scenario of the table adjustment method provided in an embodiment of the present disclosure. The application scenario may include a terminal device 101 and a server 102, and the terminal device 101 and the server 102 are connected via a communication network. The server 102 may monitor a table being operated by a user through the terminal device 101 or a completed table input by a user into the terminal device 101. In response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the adjustment conditions, the server 102 adjusts the column width of each column that meets the adjustment conditions and the row height of each cell in the column, so that the overall structure of the table is neat and orderly, and the data content in each cell in the table can be displayed evenly. In another application scenario, the table adjustment method provided by the embodiment of the present disclosure can also be directly applied to the terminal device 101. The terminal device 101 can monitor the table in the user's operation or the table input by the user that has been operated. In response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the adjustment conditions, the terminal device 101 adjusts the column width of each column that meets the adjustment conditions and the row height of each cell in the column. The embodiment of the present disclosure is not limited to this.
[0102] Among them, the communication network can be a local area network, a wide area network, a mobile Internet, etc., the terminal device 101 can be but not limited to: a smart phone, a tablet computer, a laptop computer, a desktop computer and other devices, the server 102 can be an independent physical server, or it can be a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, cloud storage, etc., and the embodiments of the present disclosure are not limited to this.
[0103] Exemplary Methods
[0104] The following describes the table adjustment method according to the exemplary embodiment of the present disclosure in combination with the above application scenarios. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this regard. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0105] The present disclosure provides a table adjustment method which can be applied to Figure 1 The server 102 shown may also be used in Figure 1 The terminal device 101 shown in the figure, the present disclosure embodiment is only described by taking the application to the terminal device 101 as an example, such as Figure 2 As shown, it is a schematic diagram of the implementation process of the table adjustment method provided in the embodiment of the present disclosure, which may specifically include the following steps:
[0106] S21. In response to monitoring that the column width of any column in the table and the row height of the cells in the column meet an adjustment condition, determine a first target column width of the column based on the row height of each cell in the column, the column width and the first magnification.
[0107] In specific implementation, the user can create a table on the terminal device and operate the table, such as entering data content in each cell. The type of data content in the cell may include but is not limited to the following types: text data, inserted embedded pictures, or mixed data of text data and embedded pictures. When inserting text data in a cell, the text data can be automatically wrapped, line breaks can be entered, font size can be set, copy, cut, paste and other operations can be performed. The user can also upload the completed table to the terminal device, and the terminal device can monitor the table being operated or the completed table. In response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the adjustment conditions, the terminal device determines the target column width of the column according to the row height of each cell in the column, the column width of the column and the first magnification, which is recorded as the first target column width, which is the target column width that the column ultimately needs to adjust.
[0108] During implementation, in order to make the row height and column width of cells in the table show a visually balanced effect, the inventors of the present disclosure may design adjustment rules for row height and column width according to the visual law of the golden ratio, wherein the first magnification represents the ratio of the row height of the cell to the column width. For example, assuming that the row height of the cell in the table is h, the column width is x, and the first magnification is a1, the relationship between the row height, column width and the first magnification of the cell can be expressed as: h=a1x. For example, a1 can adopt the golden ratio. The embodiments of the present disclosure are not limited to this. During implementation, it can be set according to needs. The value of a1 can make the table display balanced and meet the comfortable reading effect. For example, when a1 is set to the golden ratio, that is, the ratio of the row height h to the column width x is the golden ratio, which meets the golden ratio rule. The generated cell is a golden rectangle, which can achieve a relatively balanced display effect and improve reading comfort.
[0109] Specifically, the following method can be used to determine whether the column width of any column of the table and the row height of each cell in the column meet the adjustment condition:
[0110] In a possible implementation, if the row height of any cell in the column is greater than the column width of the column at the second magnification, it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition.
[0111] In specific implementation, if the terminal device detects that the row height of any cell in the table is greater than the column width of the column where the cell is located at the second magnification, it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition, and the width of the column and the row height of each cell in the column need to be adjusted. For example, when the second magnification a2 is set to 1, if the terminal device detects that the row height of any cell is greater than the column width of the column where the cell is located, it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition.
[0112] In a possible implementation, if the dispersion of the row heights of the cells in the column is greater than or equal to a preset threshold, it is determined that the column width of the column and the row heights of the cells in the column meet the adjustment condition.
[0113] In specific implementation, for a column in a table, the terminal device can also compare the discreteness of the row height of each cell in the column with a preset threshold to determine whether the column width and the row height of the cells it contains meet the adjustment conditions.
[0114] Specifically, in the embodiments of the present disclosure, the variance or standard deviation of the row heights of each cell in a column can be determined as the discreteness of the row heights of each cell in a column, but is not limited to, wherein the preset threshold can be set according to the empirical value, and the embodiments of the present disclosure are not limited to this. For example, the preset threshold can be set to 0.36. If the discreteness of the row heights of each cell in a column is less than the preset threshold, it is considered that the data content of each cell in the column is displayed relatively balanced, and there is no need to adjust the column width of the column and the row height of the cells contained therein. If the discreteness of the row heights of each cell in a column is greater than or equal to the preset threshold, it is considered that the data content of each cell in the column is displayed unbalanced, then it is determined that the column width of the column and the row height of the cells contained therein meet the adjustment conditions, and the column width of the column and the row height of the cells contained therein need to be adjusted.
[0115] S22. Determine a first target row height corresponding to each cell in the column according to the area of the data contained in each cell in the column and the first target column width.
[0116] In specific implementation, for any column of cells that meet the adjustment conditions, the terminal device can determine the first target row height corresponding to each cell in the column according to the area of the data contained in each cell in the column and the determined first target column width of the column, wherein the determined first target row height corresponding to each cell is the ideal row height of each cell, that is, if displayed according to the first target column width and the first target row height corresponding to each cell in the column, the column can achieve a relatively ideal balanced display effect. When the data in the cell is text data, the area of the text data can be obtained according to the character size (i.e., font size) and the number of characters. If the data in the cell is an embedded picture, the area of the picture can be used as the area of the data contained in the cell. If the data in the cell is mixed data of text data and embedded pictures, the sum of the area of the text data and the area of the picture can be used as the area of the mixed data.
[0117] S23. Determine a second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column.
[0118] In the specific implementation, considering that the area of the data content contained in some cells in other columns of the table is larger than the area of the data content contained in the cells of the corresponding row in the column, in order to achieve a balanced display effect for these cells in other columns, it is necessary to adjust the final adjusted target row height (which can be recorded as the second target row height) of each cell in the column based on the first target row height of each cell and the row height of each cell, that is, the current row height of each cell before adjustment. Specifically, the terminal device determines the second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column. For each cell in the column, if it is determined that the first target row height corresponding to the cell is greater than or equal to the row height of the cell, the first target row height corresponding to the cell is determined as the second target row height corresponding to the cell. If it is determined that the first target row height corresponding to the cell is less than the row height of the cell, the row height of the cell is determined as the second target row height corresponding to the cell.
[0119] S24. Adjust the column width of the column to the first target column width, and adjust the row height of each cell in the column to the corresponding second target row height.
[0120] During specific implementation, the terminal device adjusts the column width of the column to the first target column width, and adjusts the row heights of each cell in the column to their corresponding second target row heights.
[0121] The table adjustment method provided by the embodiment of the present disclosure is that in response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the preset conditions, the terminal device (or server) determines the first target column width of the column according to the row height of each cell in the column, the column width of the column and the first magnification, determines the first target row height corresponding to each cell in the column according to the area of data in each cell in the column and the first target column width, and then, according to the first target row height of each cell in the column and the row height of each cell in the column, determines the final target row height to be adjusted corresponding to each cell in the column: the second target row height, adjusts the column width of the column to the first target column width, and adjusts the row height of each cell in the column to the second target row height corresponding to each cell in the column, thereby realizing automatic adaptive adjustment of the row height and column width. In the embodiment of the present disclosure, automatic adaptive adjustment of the row height and column width is realized at the same time, which improves the table adjustment efficiency, makes the overall structure of the table neat and orderly, and enables the data content in each cell in the table to achieve a balanced display effect, thereby improving the reading effect.
[0122] As a possible implementation method, the following Figure 3 The process shown in the figure executes the step of determining the first target column width of any column that meets the adjustment condition in step S21, which specifically includes the following steps:
[0123] S31. Determine the second target column width corresponding to each cell in the column according to the row height of each cell in the column and the first magnification, and determine the third target column width corresponding to each cell in the column according to the row height of each cell in the column and the second magnification.
[0124] During the implementation process, in order to make the row height and column width of the cells in the table show a visual balance effect, the adjustment rules of the row height and column width can be designed to satisfy the following relationship: the row height can be required to be between the column width of the first magnification and the column width of the second magnification, wherein the second magnification is the same as the first magnification, both representing the ratio of the row height of the cell to the column width. For example, assuming that the row height of the cell in the table is h, the column width is x, and the second magnification is a2, then the relationship between the row height, column width and the second magnification of the cell can be expressed as: h=a2x, wherein the second magnification is greater than the first magnification. According to the visual law of the golden ratio (i.e., the golden section ratio), a1 can be set to the golden section ratio, and a2 can be set to 1. The embodiments of the present disclosure are not limited to this.
[0125] In the specific implementation, considering that the data content in different cells in a column has different areas and different row heights, the column width is x, and the row height of each cell in the column can be set between a1x and a2x. Assuming that the column to be adjusted contains n rows, this column contains n cells, and assuming that the row heights of each cell are h1 to h2x, respectively. n , the terminal device will calculate the row heights h1 to h2 of each cell 1 to n in the column. n and the first magnification a1, determine the second target column widths x1 to x2 corresponding to each cell 1 to n in the column n , specifically: According to the row heights h1 to h2 of cells 1 to n in the column n and the second magnification a2 to determine the third target column widths x1 to x2 corresponding to each cell 1 to n in the column. n , specifically:
[0126] S32. In response to the maximum third target column width being less than or equal to the minimum second target column width, the target column width range is determined based on the maximum third target column width and the minimum second target column width; in response to the maximum third target column width being greater than the minimum second target column width, the target column width range is determined based on any two third target column widths and the minimum second target column width.
[0127] In specific implementation, the maximum acceptable column width can meet the following conditions: between and in between, ..., and in That is to say, the target column width range that column width x needs to meet is: That is: between the maximum third target column width and the minimum second target column width.
[0128] During implementation, if the maximum third target column width is less than or equal to the minimum second target column width, the maximum third target column width is determined as the lower limit of the target column width interval, and the minimum second target column width is determined as the upper limit of the target column width interval to obtain the target column width interval, that is: As the lower limit of the interval, the maximum value of The minimum value in is used as the upper limit of the interval to obtain the target column width interval.
[0129] If the maximum third target column width is greater than the minimum second target column width, that is When there is no value in , the target column width range can be determined based on any two third target column widths and the minimum second target column width. Specifically, the current maximum third target column width and the minimum third target column width can be removed, that is, The maximum and minimum values in the target column width are calculated continuously until the maximum value in the third target column width currently remaining is less than or equal to the minimum value in the second target column width, so that there is a value in the obtained target column width range.
[0130] S33. Determine any value in the target column width range as the first target column width of the column.
[0131] In specific implementation, the terminal device may determine any value falling within the target column width interval as the first target column width of the column. It should be noted that when the maximum third target column width is equal to the minimum second target column width, the maximum third target column width (or the second target column width) is determined as the first target column width of the column.
[0132] It should be noted that cells with no data content, that is, cells with a data area of 0, can be ignored during calculation. After the first target column width is calculated, the row height of this cell can be directly displayed as the first target column width of the first magnification.
[0133] An example is given below to illustrate that, with a1 being 0.618 and a2 being 1, the row height of each cell in the column to be adjusted can be set between 0.618x and x, but the embodiments of the present disclosure are not limited thereto. Assume that a column to be adjusted contains n cells, and it is known that the row heights of each cell are h1 to h2. n , then the second target column width corresponding to each cell 1 to n in the column is: The third target column width corresponding to each cell 1 to n in the column is: x1 = h1, x2 = h2, ..., x n =h n , then the target column width range that column width x needs to meet is: If h1, h2, ..., h n The maximum value in is less than or equal to The minimum value among them, then h1, h2, ..., h n As the lower limit of the interval, the maximum value of The minimum value in is used as the upper limit of the interval to obtain the target column width interval; if h1, h2, ..., h n The maximum value in is greater than The minimum value among them, then remove h1, h2, ..., h n The maximum and minimum values in, for example, h1, h2, ..., h n If the maximum and minimum values in are h1 and h2 respectively, then remove h1 and h2 and calculate Get the target column width range. If h3, h4, ..., h n The maximum value in is less than or equal to The minimum value among them, then h3, h4, ..., h n As the lower limit of the interval, the maximum value of The minimum value in is used as the upper limit of the interval to obtain the target column width interval. If h3, h4, ..., h n The maximum value in is still greater than The minimum value among them, then continue to remove h3, h4, ..., h n The maximum and minimum values in the target column width range are calculated, and the target column width range is calculated until there is a value in the target column width range.
[0134] As a possible implementation, in order to make the visual display effect of the row height and column width of the cells in the table more balanced, the following can also be used: Figure 4 The process shown in the figure executes the step of determining the first target column width of any column that meets the adjustment condition in step S21, which specifically includes the following steps:
[0135] S41. Set first target column width parameters corresponding to each cell in the column respectively.
[0136] In specific implementation, in order to make the visual display effect of the row height and column width of the cells in the table more balanced, the adjustment rules of the row height and column width can be designed to satisfy the following relationship: the row height of all cells in any column can be made to be close to the column width of the first magnification on average. For example, the visual display effect of the row height and column width of the cells in the table can be made to be closer to the visual law of the golden ratio. The first magnification a1 can adopt the golden ratio, but the embodiments of the present disclosure are not limited thereto. During implementation, the terminal device can set the first target column width parameter corresponding to each cell in the column: x i ,i=1,2,……,n,x iRepresents the first target column width parameter corresponding to the i-th cell in the column, and n represents the number of cells in the column.
[0137] S42. Determine a row height target function corresponding to each cell in the column according to the first target column width parameter and the first magnification corresponding to each cell in the column.
[0138] In specific implementation, the following formula can be determined as the row height target function corresponding to each cell in the column:
[0139] h i =a1*x i
[0140] Among them, h i represents the row height objective function corresponding to the i-th cell in the column, i = 1, 2, ..., n, n represents the number of cells in the column;
[0141] a1 represents the first magnification;
[0142] x i Indicates the first target column width parameter corresponding to the i-th cell in the column.
[0143] S43. Calculate the first target column width parameter value corresponding to each cell in the column according to the area of the data contained in each cell in the column and the corresponding row height target function.
[0144] In specific implementation, the first target column width parameter value corresponding to each cell in the column can be calculated by the following formula:
[0145]
[0146] Among them, x i Indicates the first target column width parameter corresponding to the i-th cell in the column;
[0147] s i Represents the area of the data contained in the i-th cell in the column;
[0148] a1 represents the first magnification.
[0149] S44. Determine a first target column width of the column according to each first target column width parameter value.
[0150] In specific implementation, {x i The median of Determine the first target column width for the column. You can also set {x i}, the first target column width parameter values corresponding to each cell in the column are arranged in order of size, and the median The first target column width parameter value of the preset number on the left side of the median and the first target column width parameter value of the preset number on the right side of the median are taken as the first target column width of the column, which is not limited in the embodiment of the present disclosure. Among them, the preset number can be set according to actual needs, for example, it can be set to 1, which is not limited in the embodiment of the present disclosure.
[0151] It should be noted that cells with no data content, that is, cells with a data area of 0, can be ignored during calculation. After calculating the first target column width, the row height of this cell can be directly displayed as the first target column width of the first magnification, that is, the row height of this cell is: a1x.
[0152] In order to make the visual display effect of the row height and column width of the cells in the table closer to the visual rule of the golden ratio, the first magnification a1 is still set to 0.618 as an example. Assume that a column to be adjusted contains n cells, and it is known that the row heights of cells 1 to n are h1 to h2 respectively. n , the areas of the data contained in cells 1 to n are s1 to s n To make the average row height of cells 1 to n in the column close to 0.618x, set the first target column width parameters corresponding to cells 1 to n in the column: x1~x n , set the row height objective functions corresponding to cells 1 to n to be: h1 = 0.618x1, h2 = 0.618x2, ..., h n =0.618x n , and further, according to h1=0.618x1, we can know Then the first target column width parameter corresponding to cell 1 can be calculated Similarly, according to h2=0.618x2, the first target column width parameter corresponding to cell 2 can be calculated according to h n =0.618x n , the first target column width parameter corresponding to cell n can be calculated Furthermore, the first target column width parameter set {x1, x2, ..., x n} is determined as the first target column width of the column, that is, the set The median of the values is determined as the first target column width for the column.
[0153] As a possible implementation, in order to make the visual display effect of the row height and column width of the cells in the table more balanced, the following can also be used: Figure 5The process shown in the figure executes the step of determining the first target column width of any column that meets the adjustment condition in step S21, which specifically includes the following steps:
[0154] S51. Set a second target column width parameter for each cell in the column.
[0155] During specific implementation, in order to make the visual display effects of the row height and column width of the cells in the table more balanced, the adjustment rules of the row height and column width can be designed to satisfy the following relationship: the row height of all cells in any column can be infinitely close to the column width of the first magnification, that is, the visual display effects of the row height and column width of the cells in the column can be infinitely close to the set ratio. For example, the visual display effects of the row height and column width of all cells in any column can be infinitely close to the golden ratio, and the first magnification a1 can adopt the golden section ratio, but the embodiments of the present disclosure are not limited to this. During implementation, the terminal device sets a target column width parameter for each cell in any column to be adjusted: x, which can be recorded as the second target column width parameter.
[0156] S52. According to the area of the data contained in each cell in the column, the second target column width parameter and the first magnification, a column width target function corresponding to the column is set.
[0157] In specific implementation, the following formula can be set as the column width objective function corresponding to the column:
[0158]
[0159] Among them, f(x) represents the column width objective function corresponding to the column;
[0160] s i Represents the area of the data contained in the i-th cell in the column, i = 1, 2, ..., n, n represents the number of cells in the column;
[0161] x represents the second target column width parameter of each cell in the column;
[0162] a1 represents the first magnification.
[0163] In the specific implementation process, the column to be adjusted contains n cells, the second target column width parameter is x, and the areas of the data contained in cells 1 to n in the column are s1 to s2 respectively. n , in order to make the row heights of cells 1 to n in the column approach the column width of the first multiple, we have: because It can be deduced Furthermore, it can be concluded that Furthermore, it can be concluded that: That is: the column width objective function corresponding to the column
[0164] S53. Obtain a first target column width of the column according to the column width target function calculation.
[0165] During specific implementation, the terminal device calculates the optimal solution of the column width objective function, and determines the optimal solution of the column width objective function as the first target column width of the column.
[0166] Specifically, the optimal solution of the column width objective function can be calculated in the following way:
[0167]
[0168] Right now:
[0169] make but It can be expressed as: That is:
[0170] Furthermore, The derivative is:
[0171] f'(x)=(-2Bx -3 +2na1 2 x)x -1 =0;
[0172] Further deduction can be obtained 2Bx -4 =2na1 2 , then we can calculate This is the column width objective function The optimal solution of .
[0173] It should be noted that cells with no data content, that is, cells with a data area of 0, can be ignored during calculation. After calculating the first target column width, the row height of this cell can be directly displayed as the first target column width of the first magnification, that is, the row height of this cell is: a1x.
[0174] In order to make the visual display effect of the row height and column width of the cells in the table approach the golden ratio infinitely, the first magnification a1 is still set to 0.618 as an example. Assume that a column to be adjusted contains n cells, and it is known that the row heights of cells 1 to n are h1 to h2 respectively. n , the areas of the data contained in cells 1 to n are s1 to s n , set the second target column width parameter x for each cell 1 to n, so that the row heights of cells 1 to n in the column are close to 0.618x, then: because It can be deduced Furthermore, it can be concluded that Furthermore, it can be concluded that: That is: the column width objective function corresponding to the column Furthermore, calculate The optimal solution of is:
[0175] In the present disclosure, since the relationship between the area and the row height and column width is taken into consideration, while ensuring that the data in each cell in the table can be displayed evenly, the data in each cell can also be displayed completely, further improving the reading effect.
[0176] It should be noted that, in the various examples listed above in the embodiments of the present application, the values of a1 and a2 (0.618 and 1) are only used to illustrate and explain the present disclosure, and are not used to limit the present disclosure. The settings of a1 and a2 need to be able to make the table display balanced and provide a comfortable reading effect, and the embodiments of the present disclosure are not limited to this.
[0177] In the disclosed embodiment, based on the display rule that the visual display effects of row height and column width tend to the golden ratio, automatic adaptive adjustment of the row height and column width of the table is achieved. While improving the adjustment efficiency, the overall structure of the table is made neat and orderly, and the data content in each cell in the table can be displayed in a balanced and complete manner, which can enable users to have a better reading experience when using and reading the table.
[0178] Exemplary Devices
[0179] Based on the same inventive concept, the embodiment of the present disclosure also provides a table adjustment device. Since the principle of solving the problem by the above table adjustment device is similar to that of the table adjustment method, the implementation of the above device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0180] like Figure 6 FIG. 6 is a schematic diagram of the structure of a table adjustment device 60 provided in an embodiment of the present disclosure. In one embodiment, the table adjustment device 60 includes: a first determination unit 601 , a second determination unit 602 , a third determination unit 603 and an adjustment unit 604 .
[0181] A first determining unit 601 is configured to determine a first target column width of any column in a table based on the row height of each cell in the column, the column width, and a first magnification in response to monitoring that the column width and the row height of the cells in the column satisfy an adjustment condition;
[0182] A second determining unit 602 is used to determine a first target row height corresponding to each cell in the column according to the area of the data contained in each cell in the column and the first target column width;
[0183] A third determining unit 603, configured to determine a second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column;
[0184] The adjusting unit 604 is configured to adjust the column width of the column to the first target column width, and adjust the row height of each cell in the column to the corresponding second target row height.
[0185] In a possible implementation, the first determination unit 601 is specifically used to determine whether the column width of any column of the table and the row height of each cell in the column meet the adjustment condition in the following manner: if the row height of any cell in the column is greater than the column width of the column at the second magnification, then it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition; or if the discreteness of the row height of each cell in the column is greater than or equal to a preset threshold, then it is determined that the column width of the column and the row height of the cells in the column meet the adjustment condition.
[0186] In a possible implementation, the first determination unit 601 is specifically used to determine the second target column width corresponding to each cell in the column according to the row height of each cell in the column and the first magnification, and to determine the third target column width corresponding to each cell in the column according to the row height of each cell in the column and the second magnification, wherein the second magnification is greater than the first magnification; in response to the maximum third target column width being less than or equal to the minimum second target column width, determining a target column width interval according to the maximum third target column width and the minimum second target column width; in response to the maximum third target column width being greater than the minimum second target column width, determining the target column width interval according to any two of the third target column widths and the minimum second target column width; and determining any value in the target column width interval as the first target column width of the column.
[0187] In a possible implementation, the first determination unit 601 is specifically used to set a first target column width parameter corresponding to each cell in the column; determine a row height target function corresponding to each cell in the column according to the first target column width parameter corresponding to each cell in the column and the first magnification; calculate the first target column width parameter value corresponding to each cell in the column according to the area of the data contained in each cell in the column and the row height target function corresponding to each cell in the column; and determine the first target column width of the column according to each of the first target column width parameter values.
[0188] In a possible implementation manner, the first determining unit 601 is specifically configured to determine the following formula as the row height target function corresponding to each cell in the column:
[0189] h i =a1*x i
[0190] Among them, h i represents the row height objective function corresponding to the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column;
[0191] a1 represents the first magnification;
[0192] x i Indicates the first target column width parameter corresponding to the i-th cell in the column.
[0193] In a possible implementation manner, the first determining unit 601 is specifically configured to calculate the first target column width parameter value corresponding to each cell in the column by using the following formula:
[0194]
[0195] Among them, x i Represents the first target column width parameter corresponding to the i-th cell in the column;
[0196] s i Represents the area of the data contained in the i-th cell in the column.
[0197] In a possible implementation, the first determination unit 601 is specifically used to set a second target column width parameter for each cell in the column; set a column width target function corresponding to the column according to the area of data contained in each cell in the column, the second target column width parameter and the first magnification; and calculate the first target column width of the column according to the column width target function.
[0198] In a possible implementation manner, the first determining unit 601 is specifically configured to set the following formula as the column width objective function corresponding to the column:
[0199]
[0200] Wherein, f(x) represents the column width objective function corresponding to the column;
[0201] s i represents the area of data contained in the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column;
[0202] x represents the second target column width parameter of each cell in the column;
[0203] a1 represents the first magnification.
[0204] In a possible implementation, the third determination unit 603 is specifically used to, for each cell in the column, determine the first target row height corresponding to the cell as the second target row height corresponding to the cell if it is determined that the first target row height corresponding to the cell is greater than or equal to the row height of the cell; if it is determined that the first target row height corresponding to the cell is less than the row height of the cell, determine the row height of the cell as the second target row height corresponding to the cell.
[0205] Based on the same inventive concept as the above table adjustment method, the embodiment of the present disclosure also provides an electronic device 70. Figure 7 As shown, the electronic device 70 may include a processor 701 and a memory 702 .
[0206] The processor 701 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0207] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 702 in the disclosed embodiment can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0208] It should be noted that although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.
[0209] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0210] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A table adjustment method, characterized in that: include: In response to monitoring that the column width of any column in the table and the row height of the cells in the column meet the adjustment condition, determining the first target column width of the column based on the row height of each cell in the column and the first magnification, or determining the first target column width of the column based on the target column width parameter set for each cell in the column and the first magnification; Determining a first target row height corresponding to each cell in the column according to the area of the data contained in each cell in the column and the first target column width; Determine a second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column; The column width of the column is adjusted to the first target column width, and the row height of each cell in the column is adjusted to the second target row height corresponding to each cell.
2. The method according to claim 1, characterized in that: Determine whether the column width of any column of the table and the row height of each cell in the column meet the adjustment condition in the following manner: If the row height of any cell in the column is greater than the column width of the column at the second magnification, determining that the column width and the row height of the cells in the column meet an adjustment condition; or If the dispersion of the row heights of the cells in the column is greater than or equal to a preset threshold, it is determined that the column width of the column and the row heights of the cells in the column meet an adjustment condition.
3. The method according to claim 1, characterized in that Determining a first target column width of the column based on the row height of each cell in the column and the first magnification specifically includes: Determine a second target column width corresponding to each cell in the column according to the row height of each cell in the column and the first magnification, and determine a third target column width corresponding to each cell in the column according to the row height of each cell in the column and the second magnification, wherein the second magnification is greater than the first magnification; In response to the maximum third target column width being less than or equal to the minimum second target column width, determining a target column width interval according to the maximum third target column width and the minimum second target column width; In response to the maximum third target column width being greater than the minimum second target column width, determining the target column width interval according to any two of the third target column widths and the minimum second target column width; Any value in the target column width range is determined as the first target column width of the column.
4. The method according to claim 1, characterized in that: Determining a first target column width of the column based on a target column width parameter set for each cell in the column and the first magnification specifically includes: respectively setting the first target column width parameter corresponding to each cell in the column; Determine a row height target function corresponding to each cell in the column according to a first target column width parameter corresponding to each cell in the column and the first magnification; Calculate the first target column width parameter value corresponding to each cell in the column according to the area of the data contained in each cell in the column and the row height target function corresponding to each cell; The first target column width of the column is determined according to each of the first target column width parameter values.
5. The method according to claim 4, characterized in that Determining a row height target function corresponding to each cell in the column according to the target column width parameter corresponding to each cell in the column and the first magnification specifically includes: The following formula is determined as the row height target function corresponding to each cell in the column: h i =a1*x i Among them, h i represents the row height objective function corresponding to the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column; a1 represents the first magnification; x i Indicates the first target column width parameter corresponding to the i-th cell in the column.
6. The method according to claim 5, characterized in that According to the area of the data contained in each cell in the column and the corresponding row height target function, the first target column width parameter value corresponding to each cell is calculated, specifically including: The first target column width parameter value corresponding to each cell in the column is calculated by the following formula: Among them, x i Represents the first target column width parameter corresponding to the i-th cell in the column; s i Represents the area of the data contained in the i-th cell in the column.
7. The method according to claim 1, characterized in that Determining a first target column width of the column based on a target column width parameter set for each cell in the column and the first magnification specifically includes: Setting a second target column width parameter for each cell in the column; According to the area of data contained in each cell in the column, the second target column width parameter and the first magnification, setting a column width target function corresponding to the column; A first target column width of the column is obtained by calculation according to the column width target function.
8. The method according to claim 7, characterized in that According to the area of data contained in each cell in the column, the target column width parameter and the first magnification, setting a column width target function corresponding to the column specifically includes: Set the following formula as the column width objective function corresponding to the column in question: Wherein, f(x) represents the column width objective function corresponding to the column; s i represents the area of data contained in the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column; x represents the second target column width parameter of each cell in the column; a1 represents the first magnification.
9. The method according to claim 1, characterized in that: Determining, according to the first target row height corresponding to each cell in the column and the row height of each cell in the column, the second target row height corresponding to each cell in the column specifically includes: For each cell in the column, if it is determined that the first target row height corresponding to the cell is greater than or equal to the row height of the cell, the first target row height corresponding to the cell is determined as the second target row height corresponding to the cell; If it is determined that the first target row height corresponding to the cell is smaller than the row height of the cell, the row height of the cell is determined as the second target row height corresponding to the cell.
10. A table adjustment device, characterized in that: include: A first determination unit, configured to determine, in response to monitoring that a column width of any column in a table and a row height of cells in the column satisfy an adjustment condition, a first target column width of the column based on the row height of each cell in the column and a first magnification, or to determine the first target column width of the column based on a target column width parameter set for each cell in the column and the first magnification; A second determining unit, configured to determine a first target row height corresponding to each cell in the column according to an area of data contained in each cell in the column and the first target column width; A third determining unit, configured to determine a second target row height corresponding to each cell in the column according to the first target row height corresponding to each cell in the column and the row height of each cell in the column; The adjusting unit is used to adjust the column width of the column to the first target column width, and adjust the row height of each cell in the column to the second target row height corresponding to each cell.
11. The device according to claim 10, characterized in that The first determination unit is specifically used to determine whether the column width of any column of the table and the row height of each cell in the column meet the adjustment condition in the following manner: if the row height of any cell in the column is greater than the column width of the column at the second magnification, then determine that the column width of the column and the row height of the cells in the column meet the adjustment condition; Alternatively, if the dispersion of the row heights of the cells in the column is greater than or equal to a preset threshold, it is determined that the column width of the column and the row heights of the cells in the column meet the adjustment condition.
12. The device according to claim 10, characterized in that The first determination unit is specifically used to determine the second target column width corresponding to each cell in the column according to the row height of each cell in the column and the first magnification, and to determine the third target column width corresponding to each cell in the column according to the row height of each cell in the column and the second magnification, wherein the second magnification is greater than the first magnification; in response to the maximum third target column width being less than or equal to the minimum second target column width, determining a target column width interval according to the maximum third target column width and the minimum second target column width; in response to the maximum third target column width being greater than the minimum second target column width, determining the target column width interval according to any two of the third target column widths and the minimum second target column width; and determining any value in the target column width interval as the first target column width of the column.
13. The device according to claim 10, characterized in that The first determination unit is specifically configured to set first target column width parameters corresponding to each cell in the column respectively; and determine a row height target function corresponding to each cell in the column according to the first target column width parameters corresponding to each cell in the column and the first magnification; Calculate the first target column width parameter value corresponding to each cell in the column according to the area of the data contained in each cell in the column and the row height target function corresponding to each cell; The first target column width of the column is determined according to each of the first target column width parameter values.
14. The device according to claim 13, characterized in that The first determining unit is specifically configured to determine the following formula as the row height target function corresponding to each cell in the column: h i =a1*x i Among them, h i represents the row height objective function corresponding to the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column; a1 represents the first magnification; x i Indicates the first target column width parameter corresponding to the i-th cell in the column.
15. The device according to claim 14, characterized in that The first determination unit is specifically configured to calculate the first target column width parameter value corresponding to each cell in the column by using the following formula: Among them, x i Represents the first target column width parameter corresponding to the i-th cell in the column; s i Represents the area of the data contained in the i-th cell in the column.
16. The device according to claim 10, characterized in that The first determination unit is specifically used to set a second target column width parameter for each cell in the column; set a column width target function corresponding to the column according to the area of data contained in each cell in the column, the second target column width parameter and the first magnification; and calculate the first target column width of the column according to the column width target function.
17. The device according to claim 16, characterized in that The first determining unit is specifically configured to set the following formula as the column width objective function corresponding to the column: Wherein, f(x) represents the column width objective function corresponding to the column; s i represents the area of data contained in the i-th cell in the column, i=1, 2, ..., n, and n represents the number of cells in the column; x represents the second target column width parameter of each cell in the column; a1 represents the first magnification.
18. The device according to claim 10, characterized in that The third determining unit is specifically configured to, for each cell in the column, determine the first target row height corresponding to the cell as the second target row height corresponding to the cell if it is determined that the first target row height corresponding to the cell is greater than or equal to the row height of the cell; If it is determined that the first target row height corresponding to the cell is smaller than the row height of the cell, the row height of the cell is determined as the second target row height corresponding to the cell.
19. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the table adjustment method according to any one of claims 1 to 9 are implemented.
20. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the steps of the table adjustment method according to any one of claims 1 to 9 are implemented.
