Table column width determination method and system, medium and computer program product

By dynamically adjusting the column width of each column of the table, the problem of poor data display effect caused by fixed column width in the existing technology is solved, and the table display effect and coordination that adapts to changes in data content are achieved.

CN119337847APending Publication Date: 2025-01-21KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411485402.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In the prior art, the column widths of each column in the table are set in advance and fixed, which does not adapt to changes in the data content, resulting in poor data display effect or a large number of blank areas appearing, affecting the coordination of the table.

Method used

By determining the initial column width of each column in the table, and using these initial column wide to display the display, calculate the maximum display row of each column, adjust the width The absolute value is less than the threshold, and the target column width is dynamically determined.

Benefits of technology

After the data content in the form is realized, the width of the column is dynamically adjusted to ensure that the data display is good, reduce the blank area, and improve the coordination and screen effect of the form.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119337847A_ABST
    Figure CN119337847A_ABST
Patent Text Reader

Abstract

The invention provides a table column width determination method, a table column width determination system, a readable storage medium and a computer program product. The table column width determination method comprises the following steps: determining the initial column width of each column in a table; the maximum display line number of each column under the condition that line feed display is carried out according to the initial column width of each column is determined, and the maximum display line number of each column is the display line number of the data content with the maximum width in each column; the absolute value of the difference value of the maximum display line number between every two columns is calculated; and taking the initial column width of each column as the target column width of each column under the condition that the absolute values of the difference values are smaller than the first difference value threshold value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a table column width determination method, a table column width determination system, a readable storage medium, and a computer program product. Background Art

[0002] Tables are used by people from all walks of life to display and manage data. In related technologies, the width of each column in the table needs to be set in advance before filling in the data content. However, if the column width is set too small in advance, the data content in the cell may not be fully displayed after the data content is filled in, thereby affecting the data display effect; if the column width is set too large in advance, a large amount of blank space may exist in the cell after the data content is filled in, which makes the entire table look inconsistent, also affecting the data display effect. Summary of the invention

[0003] In order to solve one of the above technical problems, the present disclosure provides a table column width determination method, a table column width determination system, a readable storage medium and a computer program product.

[0004] According to one aspect of the present disclosure, a method for determining table column width is provided, including: determining the initial column width of each column in the table; determining the maximum number of display rows of each column when the initial column width of each column is used for line break display, wherein the maximum number of display rows of each column is the number of display rows of data content with the largest width in each column; calculating the absolute value of the difference between the maximum number of display rows between every two columns; and when the absolute values ​​of the differences are all less than the first difference threshold, using the initial column width of each column as the target column width of each column.

[0005] According to at least one embodiment of the present disclosure, after calculating the absolute value of the difference in the maximum number of display rows between every two columns, it also includes: in a case where the absolute value of the difference is greater than or equal to a first difference threshold, adjusting the initial column widths of the columns to obtain adjusted column widths of the columns; and redetermining the adjusted column widths of the columns as the initial column widths of the columns, and again entering the step of determining the maximum number of display rows of each column when wrapping the columns with the initial column widths of the columns to perform multiple cycles of column width adjustment until the absolute values ​​of the differences are all less than the first difference threshold.

[0006] According to at least one embodiment of the present disclosure, the data content includes header data content, and determining the initial column width of each column in the table includes: using the minimum width of the header data content in the table as the initial column width of each column.

[0007] According to at least one embodiment of the present disclosure, the initial column widths of the columns are adjusted to obtain the adjusted column widths of the columns, including: determining a target column and remaining columns in the table, wherein the target column is the column with the largest number of displayed rows in the table when the initial column widths of the columns are used for line wrapping and display, and the remaining columns are the columns other than the target column in the table when the initial column widths of the columns are used for line wrapping and display; and increasing the initial column width of the target column by the target width, while keeping the initial column widths of the remaining columns unchanged, to obtain the adjusted column widths of the columns.

[0008] According to at least one embodiment of the present disclosure, the data content includes header data content, and determining the initial column width of each column in the table includes: taking the maximum width of the header data content in the table as the initial column width of each column.

[0009] According to at least one embodiment of the present disclosure, the initial column widths of the columns are adjusted to obtain the adjusted column widths of the columns, including: determining a target column and remaining columns in the table, wherein the target column is a column with the smallest number of displayed rows in the table when the initial column widths of the columns are used for line wrapping display, and the remaining columns are columns other than the target column in the table when the initial column widths of the columns are used for line wrapping display; and reducing the initial column width of the target column by the target width, while keeping the initial column widths of the remaining columns unchanged, to obtain the adjusted column widths of the columns.

[0010] According to at least one embodiment of the present disclosure, determining the maximum number of display rows for each column when wrapping and displaying with the initial column width of each column includes: dividing the width of the data content with the largest width in each column by the initial column width of the column where the data content is located and rounding up to obtain the maximum number of display rows for each column when wrapping and displaying with the initial column width of each column.

[0011] According to at least one embodiment of the present disclosure, after the initial column width of each column is used as the target column width of each column, it also includes: adjusting the target column width of each column to obtain the adjusted target column width of each column; determining the maximum number of display rows of the data content with the largest width in each column when the adjusted target column width of each column is used for line wrapping display; calculating the absolute value of the difference in the maximum number of display rows between every two columns when the adjusted target column width of each column is used for line wrapping display; and when the absolute values ​​of the differences calculated when the adjusted target column width of each column is used for line wrapping display are all less than a second difference threshold, using the adjusted target column width of each column as the target column width of each column, wherein the second difference threshold is less than the first difference threshold.

[0012] According to at least one embodiment of the present disclosure, before determining the initial column width of each column in a table, it also includes: using the width of the header data content of each column in the table as the column width of each column; determining the maximum number of display rows of each column when the column width of each column is used for line wrapping display; calculating the absolute value of the difference in the maximum number of display rows between every two columns when the column width of each column is used for line wrapping display; and determining that when the column width of each column is used for line wrapping display, there is an absolute value of the difference greater than or equal to the first difference threshold.

[0013] According to at least one embodiment of the present disclosure, the data content includes header data content and body data content. Before using the width of the header data content of each column as the column width of each column, it also includes: determining the size relationship between the width of the header data content and the maximum width of the body data content in each column; and determining that the size relationship in each column exists such that the width of the body data content is greater than the maximum width of the header data content.

[0014] According to at least one embodiment of the present disclosure, after determining the size relationship between the width of the header data content in each column and the maximum width of the body data content, it also includes: when the size relationship in each column is that the width of the header data content is greater than or equal to the maximum width of the body data content, using the width of the header data content of each column as the target column width of each column.

[0015] According to another aspect of the present disclosure, a table column width determination system is provided, including a processor and a memory, the memory storing a computer program, and when the computer program is executed by the processor, the processor performs the following process: determining the initial column width of each column in the table; determining the maximum number of display rows of each column when the initial column width of each column is used for line break display, wherein the maximum number of display rows of each column is the number of display rows of data content with the largest width in each column; calculating the absolute value of the difference between the maximum number of display rows between every two columns; and when the absolute values ​​of the differences are all less than the first difference threshold, using the initial column width of each column as the target column width of each column.

[0016] According to another aspect of the present disclosure, a readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the method as described in any one of the above aspects.

[0017] According to another aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, it is used to implement at least the method as described in any one of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.

[0019] Figure 1 It is a schematic diagram of an application scenario of a method for determining table column width according to an embodiment of the present disclosure.

[0020] Figure 2 It is a schematic diagram of an application scenario of a method for determining table column width according to another embodiment of the present disclosure.

[0021] Figure 3 It is a flowchart of a method for determining table column width according to an embodiment of the present disclosure.

[0022] Figure 4 is a visualization example diagram of a table according to an embodiment of the present disclosure.

[0023] Figure 5 is a visualization example diagram of a table according to another embodiment of the present disclosure.

[0024] Figure 6 This is a visualization example diagram of a table in which the width of the header data content of each column is used as the column width for line wrapping display according to an embodiment of the present disclosure.

[0025] Figure 7 This is a visualization example diagram of a table in which the minimum width of the header data content of each column is used as the column width for line wrapping display according to an embodiment of the present disclosure.

[0026] Figure 8 This is a visualization example diagram of a table when the maximum width of the header data content of each column is used as the column width for line wrapping display according to an embodiment of the present disclosure.

[0027] Fig. 9 This is a visualization example diagram of a table when line wrapping is performed with a target column width according to an embodiment of the present disclosure.

[0028] Fig.10 This is a visualization example diagram of a table when line wrapping is performed with a target column width according to another embodiment of the present disclosure.

[0029] Fig.11 It is a flowchart of a method for determining table column width according to another embodiment of the present disclosure.

[0030] Fig.12 The present invention is a block diagram showing the structure of a table column width determination system using a hardware implementation method of a processor according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The present disclosure is further described in detail below in conjunction with the accompanying drawings and examples. It is understood that the specific examples described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.

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

[0033] In the related art, since the column width of each column in the table is set in advance, it will remain fixed once set and will not change with the change of data content in the table. This will cause the following problems: if the column width is set too small in advance, the data content in the cell may not be fully displayed after the data content is filled in, thereby affecting the data display effect; if the column width is set too large in advance, a large amount of blank area may exist in the cell after the data content is filled in, thereby causing the entire table to look uncoordinated and affecting the data display effect; even if the column width is set just right in advance, when the data content in the subsequent table is reduced, the column width remains unchanged, so there will still be a large amount of blank area in the table; and when the data content in the subsequent table is expanded, the column width remains unchanged, so the expanded data content cannot be displayed, thereby affecting the data display effect.

[0034] In the present disclosure, the table column width determination system includes but is not limited to servers, mobile phones, tablet computers, laptop computers, personal computers, wearable devices, ATMs, etc. Terminal devices include but are not limited to mobile phones, tablet computers, laptop computers, personal computers, wearable devices, ATMs, etc. In addition, the server can be a server with a physical form or a cloud server, and the present disclosure does not limit the type of server.

[0035] The number of columns in a table can be understood as the number of cells contained in each row of the table.

[0036] The number of rows in a table can be understood as the number of cells contained in each column in the table.

[0037] The number of displayed rows can be understood as the number of rows of data content in a cell in the table when the line breaks are displayed. It should be noted that the number of displayed rows is the number of rows in the cell, not the number of rows in the table.

[0038] The maximum number of display rows can be understood as the number of display rows of the widest data content in multiple cells of a column when the line breaks are displayed.

[0039] Figure 1The application scenario schematic diagram of the table column width determination method according to an embodiment of the present disclosure is shown. Among them, the server 100 stores a table, which can be an empty table or a table storing data content, which is not limited here. The terminal device 200 can send a data content update instruction to the server 100, and the data content update instruction is used to update the data content of the table stored in the server 100. The update operation includes but is not limited to adding, deleting, modifying, etc. After receiving the data content update instruction, the server 100 can automatically perform a corresponding update operation on the data content in the table to obtain an updated table, and then determine the initial column width of each column in the table, and determine the maximum number of display rows of each column when the initial column width of each column is used for line wrap display, and calculate the absolute value of the difference between the maximum number of display rows between each two columns, and when the absolute value of the difference is greater than or equal to the first difference threshold, adjust the initial column width of each column to obtain the target column width of each column. After receiving the table query request sent by the terminal device 200, the server 100 controls the terminal device 200 to display the data content of each column of the table in a line wrap manner with the target column width of each column. In this way, the server 100 dynamically determines the target column width of each column according to the data content in the table each time the data content in the table changes, and can then quickly respond to the table query request after receiving the table query request. This is applicable to the case where the frequency of data content changes in the table is less than the frequency threshold, and the difference in the maximum number of displayed rows between each two columns in the displayed table is small, the data display effect is better, and the coordination of the table is high. If the sum of the target column widths of each column is greater than the display width of the screen, a scroll bar is displayed in the display interface of the screen, and the scroll bar includes a slider, and the position of the slider in the scroll bar is associated with the column of the table. When the scroll bar is dragged, the column of the table associated with the position of the slider in the scroll bar is displayed.

[0040] Figure 2A schematic diagram of an application scenario of a method for determining a table column width according to another embodiment of the present disclosure is shown. The server 100 stores a table, which may be an empty table or a table storing data content, which is not limited here. After receiving a table query request sent by the terminal device 200, the server 100 determines the initial column width of each column in the table, and determines the maximum number of display rows of each column when the initial column width of each column is used for line break display, and calculates the absolute value of the difference in the maximum number of display rows between every two columns, and when the absolute value of the difference is greater than or equal to a first difference threshold, adjusts the initial column width of each column to obtain the target column width of each column, and controls the terminal device 200 to display the data content of each column of the table in a line break with the target column width of each column. In this way, the server 100 dynamically determines the target column width of each column according to the data content in the table each time a table query request is received, and responds to the table query request based on the determined target column width of each column. This is applicable to the case where the frequency of change of the data content in the table is greater than or equal to the frequency threshold, i.e., dynamic change, and can reduce the difference in the maximum number of displayed rows between every two columns in the displayed table to a greater extent, resulting in better data display effects and higher coordination of the table. If the sum of the target column widths of each column is greater than the display width of the screen, a scroll bar is displayed in the display interface of the screen, and the scroll bar includes a slider, and the position of the slider in the scroll bar is associated with the column of the table. When the scroll bar is dragged, the column of the table associated with the position of the slider in the scroll bar is displayed.

[0041] Figure 3 A schematic flow chart of a method for determining table column width according to an embodiment of the present disclosure is shown. Figure 3 The detailed description is for a clearer understanding of the technical solution of the present disclosure and should not be considered as a limitation of the protection scope of the present disclosure. In the process of implementing the technical idea of ​​the present disclosure, one or some steps may be omitted, or other alternatives may be adopted.

[0042] In step S301, the width of the data content of the header of each cell in the table and the width of the data content of the body of each cell in the table are determined. Figure 4 , the table may include a header part and a body part. The header part may be located in the first row of the table, and the body part may extend downward from the second row of the table for multiple lines. The header data content is the data content of the header part, and the body data content is the data content of the body part. The data content includes one or more of numbers, Chinese characters, letters, and symbols. The width of the header data content and the width of the body data content may be determined by methods in the relevant technology, such as by JS (JavaScript) methods, which are not limited here. The width of the header data content and the width of the body data content may be determined based on the font size, font, and number of words of the data content in the table. In the process of determining the width of each data content in the table, the scaling ratio of the table may be ignored. Figure 4In the example, the width of the header data content of the first column is 2, the width of the header data content of the second column is 4, the width of the header data content of the third column is 8, the width of the body data content of the first column and the second row is 10, the width of the body data content of the second column and the second row is 6, and the width of the body data content of the third column and the second row is 1.

[0043] In step S302, the maximum width of the table body data content in each column of the table is determined. Exemplarily, the widths of the multiple table body data contents in the first column are sorted from large to small, and the width ranked first is used as the maximum width of the table body data content in the first column; then, the widths of the multiple table body data contents in the second column are sorted from large to small, and the width ranked first is used as the maximum width of the table body data content in the second column, and so on, so that the maximum width of the table body data content in each column of the table can be accurately determined.

[0044] In step S303, the size relationship between the width of the header data content and the maximum width of the body data content in each column is determined, that is, for each column in the table, the width of the header data content of the column needs to be compared with the maximum width of the body data content of the column to determine the size relationship. In one embodiment, the size relationship between the width of the header data content and the maximum width of the body data content is determined by the ratio of the width of the body data content to the maximum width of the header data content. For example, the width of the body data content of the i-th column is divided by the maximum width of the header data content of the i-th column to obtain the ratio. If the ratio is greater than 1, it is determined that the width of the body data content in the i-th column is greater than the maximum width of the header data content; if the ratio is less than or equal to 1, it is determined that the width of the body data content in the i-th column is less than or equal to the maximum width of the header data content. In this way, the size relationship can be accurately determined. In another embodiment, the size relationship between the width of the header data content and the maximum width of the body data content is determined by the difference between the width of the body data content and the maximum width of the header data content. For example, the difference is obtained by subtracting the maximum width of the header data content in the i-th column from the width of the body data content in the i-th column. If the difference is greater than 0, it is determined that the width of the body data content in the i-th column is greater than the maximum width of the header data content; if the difference is less than or equal to 0, it is determined that the width of the body data content in the i-th column is less than or equal to the maximum width of the header data content. In this way, the size relationship can be accurately determined.

[0045] In step S304, determine whether the size relationship in each column is such that the maximum width of the table body data content is greater than the width of the header data content. If not, that is, the size relationship in each column is such that the maximum width of the table body data content is less than or equal to the width of the header data content, then go to step S305; if so, go to step S306.

[0046] In step S305, when the maximum width of the body data content in each column is less than or equal to the width of the header data content, the width of the header data content of each column is used as the target column width of each column, and the table column width determination process ends. Since the width of the header data content is all larger than the width of the body data content below the header, the width of the header data content is directly used as the target column width, which can not only improve the efficiency of determining the target column width, but also ensure that the body data content is fully displayed in one row without line breaks, and the number of displayed rows of the data content in each cell is one row, and there is basically no difference in the number of displayed rows in the cells between every two columns. The data display effect is better, the screen effect is higher, and the table is more coordinated. Figure 5 shown.

[0047] In step S306, if the maximum width of the table body data content is greater than the width of the table header data content in the size relationship of each column, the width of the table header data content of each column in the table is used as the column width of each column. In this way, for each cell in the table, the width of the table body data content that can be displayed in one row is the same as the width of the table header data content in its column, such as Figure 6 As shown, in the case of line wrapping display, the width of the table data content that can be displayed in a row of cells in the first column is the same as the width of the table header data content in the first column, which is the width of 2 Chinese characters; the width of the table data content that can be displayed in a row of cells in the second column is the same as the width of the table header data content in the second column, which is the width of 4 Chinese characters; the width of the table data content that can be displayed in a row of cells in the third column is the same as the width of the table header data content in the third column, which is the width of 8 Chinese characters.

[0048] In step S307, the maximum number of rows displayed for each column when the column width (i.e., the width of the header data content of each column) is used for line wrapping display is determined, wherein the maximum number of rows displayed for each column is the number of rows displayed for the data content with the largest width in each column. Exemplarily, the width of the data content with the largest width in each column is divided by the column width of the column where the data content is located and then rounded up. The resulting integer is the maximum number of rows displayed for each column when the column width is used for line wrapping display. In this way, the processor can accurately determine the maximum number of rows displayed for each row. Figure 4 Taking the first column as an example, since the width of the header data content of the first column is 2, and the maximum width of the data content of the second row in the first column is 10, 10 is divided by 2 and rounded up to 5. Furthermore, it can be determined that the maximum number of display rows in the first column is 5 when the width of the header data content of the first column is used for line wrapping display.

[0049] In step S308, the absolute value of the difference between the maximum number of display rows between two columns when the column width is used for line wrapping display is calculated. Figure 6In the example, the maximum number of displayed rows in the first column is 5, the maximum number of displayed rows in the second column is 2, and the maximum number of displayed rows in the third column is 1. The absolute value of the difference in the maximum number of displayed rows between the first column and the second column is 3, the absolute value of the difference in the maximum number of displayed rows between the second column and the third column is 1, and the absolute value of the difference in the maximum number of displayed rows between the third column and the first column is 4.

[0050] In step S309, determine whether the absolute value of the difference in the maximum number of display rows between every two columns when the column width is used for line wrapping display is less than the first difference threshold. If so, proceed to step S310; if not, that is, the absolute value of the difference in the maximum number of display rows between two columns is greater than or equal to the first difference threshold, proceed to step S311. The first difference threshold can be set in advance and is not limited here. The larger the first difference threshold is set, the faster the target column width is determined; the smaller the first difference threshold is set, the smaller the difference in the maximum number of display rows between every two columns when the target column width is used for line wrapping display, and the better the data display effect. In an example, the first difference threshold is 2. Figure 6 In the example of , since the absolute value of the difference between the maximum number of display rows of two columns is greater than or equal to 2, step S311 and steps after step S311 are used to determine the target column width of each column.

[0051] In step S310, when the absolute value of the difference in the maximum number of displayed rows between two columns is less than the first difference threshold value when the column width of each column is used for line wrapping display, the column width of each column determined in step S306, that is, the width of the header data content of each column, is used as the target column width of each column. In this way, the efficiency of determining the target column width is improved, and the determined target column width can ensure that the difference in the maximum number of displayed rows between two columns is small when the target column width is used for line wrapping display, and the data display effect is better.

[0052] In step S311, when the absolute value of the difference between the maximum number of displayed rows of two columns is greater than or equal to the first difference threshold value when the column widths of the columns are used for line wrapping display, the initial column width of each column in the table is determined. In one embodiment, the minimum width of the header data content in the table is used as the initial column width of each column, that is, the initial column width of each column is set to the same value, which is the minimum width of the header data content in the table. Figure 6 For example, the width of the header data content in the first column is 2, the width of the header data content in the second column is 4, and the width of the header data content in the third column is 8. It can be determined that the minimum width of the header data content in the table is 2. Then, the initial column width of each column in the table is set to 2, and the following is obtained: Figure 7In another embodiment, the maximum width of the header data content in the table is used as the initial column width of each column, that is, the initial column width of each column is set to the same value, which is the maximum width of the header data content in the table. Figure 6 For example, the width of the header data content in the first column is 2, the width of the header data content in the second column is 4, and the width of the header data content in the third column is 8. It can be determined that the maximum width of the header data content in the table is 8. Then, the initial column width of each column in the table is set to 8, and the following is obtained: Figure 8 The table shown is displayed in line breaks, so that the overall height of the table is small, which is beneficial to improving the screen effect. It is worth noting that in other embodiments, the initial column width of each column can also be set to a different value, which is not limited here. Exemplarily, when the minimum width of the header data content in the table is used as the initial column width of each column, and the target column width cannot be determined, the maximum width of the header data content in the table is used as the initial column width of each column; or, when the maximum width of the header data content in the table is used as the initial column width of each column, and the target column width cannot be determined, the minimum width of the header data content in the table is used as the initial column width of each column.

[0053] In step S312, the maximum number of display rows of each column is determined when the initial column width of each column is used for line wrapping display. Exemplarily, the width of the data content with the largest width in each column is divided by the initial column width of the column where the data content is located and then rounded up. The obtained integer is the maximum number of display rows of each column when the initial column width of each column is used for line wrapping display. In this way, the processor can accurately determine the maximum number of display rows of each row.

[0054] In step S313, the absolute value of the difference between the maximum number of display rows between two columns when the initial column width of each column is used for line wrapping is calculated. For details about the absolute value of the difference, please refer to the description in step S308, which will not be repeated here for the sake of brevity.

[0055] In step S314, it is determined whether the absolute value of the difference in the maximum number of display rows between each two columns when the initial column width of each column is used for line wrapping display is less than the first difference threshold. If so, the process proceeds to step S315; if not, that is, the absolute value of the difference is greater than or equal to the first difference threshold, the process proceeds to step S316. For the content related to the first difference threshold, please refer to the description in step S309, which will not be repeated here for the sake of brevity.

[0056] In step S315, when the absolute value of the difference in the maximum number of displayed rows between every two columns is less than the first difference threshold value when the initial column width of each column is used for line wrapping display, the initial column width of each column is used as the target column width of each column. In this way, when the data content in the table is wrapped and displayed with the target column width of each column, the difference in the maximum number of displayed rows between every two columns in the displayed table can be controlled within the first difference threshold value, so that the data display effect is better and the coordination of the table is higher.

[0057] In step S316, when the absolute value of the difference is greater than or equal to the first difference threshold value when the initial column width of each column is used for line wrapping display, the initial column width of each column is adjusted to obtain the adjusted column width of each column. In one embodiment, when the minimum width of the header data content in the table is used as the initial column width of each column, the initial column width adjustment step is as follows: determine the target column and the remaining columns in the table, wherein the target column is the column with the largest number of displayed rows in the table when the initial column width of each column is used for line wrapping display, and the remaining columns are the columns other than the target column in the table when the initial column width of each column is used for line wrapping display, increase the initial column width of the target column by the target width, and keep the initial column width of the remaining columns unchanged, to obtain the adjusted column width of each column, so that, in general, the initial column width increases from the minimum width, which can make the final target column width as small as possible, and at the same time, the difference in the maximum number of displayed rows between columns is small, so that more data can be displayed on the screen, and the data display effect can be improved while improving the screen effect. If the sum of the adjusted column widths of each column is greater than the preset maximum width of the table, the initial column widths of each column at this time are directly used as the target column widths of each column, and the table column width determination process ends. In another embodiment, when the maximum width of the header data content in the table is used as the initial column width of each column, the initial column width adjustment steps are as follows: determine the target column and the remaining columns in the table, wherein the target column is the column with the smallest number of displayed rows in the table when the initial column width of each column is used for line wrapping display, and the remaining columns are the columns other than the target column in the table when the initial column width of each column is used for line wrapping display, and the initial column width of the target column is reduced by the target width, and the initial column widths of the remaining columns are kept unchanged to obtain the adjusted column widths of each column. In this way, overall, the initial column width decreases from the maximum width, which can make the final target column width as small as possible, and at the same time, the difference in the maximum number of displayed rows between columns is small, so that more data can be displayed on the screen, and the data display effect can be improved while improving the screen effect. It is understandable that if the column width is too wide, there may be a lot of blank areas in the cells of the same column of the table; if the maximum number of displayed rows is too large, there may be a lot of blank areas in the cells of the same row of the table, and the display area of ​​the screen is limited. A large blank area will result in less data being displayed on the screen, thereby reducing the screen efficiency. The target width can be the width of a word in the table or the width of multiple words in the table, which is not limited here.

[0058] In step S317, the adjusted column width of each column is re-determined as the initial column width of each column, and the process proceeds to step S312 again. In this way, multiple cycles of column width adjustment can be performed until the target column width of each column is determined. In one example, Figure 7 For the table shown in the figure, after multiple cycles of adjusting the column width, it can be determined that the target column width of the first column is 3, the target column width of the second column is 2, and the target column width of the third column is 2. Fig. 9 As shown, the absolute value of the difference in the maximum number of displayed rows between every two columns is less than 2 (the first difference threshold).

[0059] In step S318, the target column width of each column is adjusted to obtain the adjusted target column width of each column. Exemplarily, the principle of the step of adjusting the target column width is the same as the principle of the step of adjusting the initial column width. For the content related to the adjustment of the target column width, please refer to the description in step S316, which will not be repeated here for the sake of brevity.

[0060] In step S319, the maximum number of display rows of the data content with the largest width in each column is determined when the adjusted target column width of each column is used for line wrapping display. The content related to the maximum number of display rows can be found in the description of step S312, which will not be repeated here for the sake of brevity.

[0061] In step S320, the absolute value of the difference between the maximum number of display rows between two columns when the adjusted target column width of each column is used for line wrapping display is calculated. For details about the absolute value of the difference, please refer to the description in step S308, which will not be repeated here for the sake of brevity.

[0062] In step S321, determine whether the absolute value of the difference in the maximum number of display rows between every two columns when the adjusted target column width of each column is used for line wrapping display is less than the second difference threshold, and the second difference threshold is less than the first difference threshold. If so, proceed to step S322; if not, that is, there is a difference absolute value greater than or equal to the first difference threshold, proceed to step S323. The second difference threshold can be set in advance and is not limited here. The larger the second difference threshold is set, the fewer times the target column width is adjusted; the smaller the second difference threshold is set, the smaller the difference in the maximum number of display rows between every two columns when the adjusted target column width is used for line wrapping display, and the better the data display effect. In an example, the second difference threshold is 1, for Fig. 9 In the example of , since the absolute value of the difference between the maximum number of display rows of two columns is greater than or equal to 1, step S323 and steps after step S323 can be used to re-determine the target column width of each column.

[0063] In step S322, the adjusted target column width of each column is used as the target column width of each column, and the table column width determination process is terminated. In this way, when the data content in the table is displayed in a line break with the adjusted target column width of each column, the difference in the maximum number of displayed rows between every two columns in the displayed table can be controlled within the second difference threshold, so that the data display effect is better and the table is more coordinated.

[0064] In step S323, it is determined whether the adjustment condition is met, if so, the process proceeds to step S324; if not, the process proceeds to step S325. Exemplarily, when the number of adjustments of the target column width is less than or equal to the adjustment number threshold, the adjustment condition is determined to be met; when the number of adjustments of the target column width is greater than the adjustment number threshold, the adjustment condition is determined not to be met.

[0065] In step S324, the adjusted target column width of each column is re-determined as the target column width of each column, and step S318 is entered again. In this way, the target column width adjustment can be repeated for multiple cycles until a target column width is determined that can make the absolute value of the difference in the maximum number of displayed rows between each two columns less than the second difference threshold, which is conducive to further improving the data display effect and coordination. In one example, Fig. 9 In the table shown, after multiple cycles of adjusting the target column width, it can be finally determined that the target column width of the first column is 4, the target column width of the second column is 3, and the target column width of the third column is 3, as shown in Fig.10 As shown, the absolute value of the difference between the maximum number of displayed rows between every two columns is less than 1 (the second difference threshold).

[0066] In step S325, the target column width of each column determined in step S310 or step S315 is kept unchanged, and the table column width determination process is ended, that is, the target column width of each column determined in step S310 or step S315 is used as the final target column width of each column. It can be understood that although the data display effect when the absolute value of the difference in the maximum number of displayed rows between each two columns is less than the second difference threshold is better than the data display effect when the absolute value of the difference in the maximum number of displayed rows between each two columns is less than the first difference threshold, due to the differences and particularities of the data contents in the table, it is possible to obtain a target column width that makes the absolute value of the difference in the maximum number of displayed rows between each two columns less than the second difference threshold. Therefore, in this case, the target column width that makes the absolute value of the difference in the maximum number of displayed rows between each two columns less than the first difference threshold can be selected as the final target column width.

[0067] It should be noted that the specific numerical values ​​mentioned above are only used as examples to illustrate the implementation of the present disclosure in detail, and should not be understood as limiting the present disclosure. In other examples or implementations or embodiments, other numerical values ​​can be selected according to the present disclosure, and are not specifically limited here.

[0068] According to a further embodiment of the present disclosure, a method for determining a table column width is also provided. Fig.11 FIG. 2 shows a flow chart of a method for determining table column width according to another embodiment of the present disclosure. Fig.11 As shown, the table column width determination method may include step S410, step S420, step S430 and step S440.

[0069] S410: Determine the initial column width of each column in the table.

[0070] S420: Determine the maximum number of display rows for each column when wrapping is performed with the initial column width of each column, wherein the maximum number of display rows for each column is the number of display rows of the data content with the largest width in each column.

[0071] S430: Calculate the absolute value of the difference between the maximum number of displayed rows between every two columns.

[0072] S440: When the absolute values ​​of the differences are all smaller than the first difference threshold, the initial column width of each column is used as the target column width of each column.

[0073] After step S440, the method further includes: S450, when the absolute value of the difference is greater than or equal to the first difference threshold, adjusting the initial column width of each column to obtain the adjusted column width of each column; and S460, redetermining the adjusted column width of each column as the initial column width of each column, and again entering the step of determining the maximum number of display rows of each column when the initial column width of each column is used for line wrap display to perform multiple cycles of column width adjustment, until the absolute values ​​of the differences are all less than the first difference threshold and stop.

[0074] As a possible implementation, the data content includes header data content, and step S410 may include: using the minimum width of the header data content in the table as the initial column width of each column. Step S450 may include: determining the target column and the remaining columns in the table, wherein the target column is the column with the largest number of displayed rows in the table when the initial column width of each column is used for line wrapping display, and the remaining columns are the columns in the table other than the target column when the initial column width of each column is used for line wrapping display; and increasing the initial column width of the target column by the target width, and keeping the initial column width of the remaining columns unchanged, to obtain the adjusted column widths of each column.

[0075] As another possible implementation, the data content includes header data content, and step S410 may include: taking the maximum width of the header data content in the table as the initial column width of each column. Step S450 may include: determining the target column and the remaining columns in the table, wherein the target column is the column with the smallest number of displayed rows in the table when the initial column width of each column is used for line wrapping display, and the remaining columns are the columns in the table other than the target column when the initial column width of each column is used for line wrapping display; and reducing the initial column width of the target column by the target width, and keeping the initial column widths of the remaining columns unchanged, to obtain the adjusted column widths of each column.

[0076] Step S420 may include: dividing the width of the data content with the largest width in each column by the initial column width of the column where the data content is located and then rounding up to obtain the maximum number of display rows of each column when the initial column width of each column is used for line wrapping display.

[0077] After step S440, it also includes: adjusting the target column width of each column to obtain the adjusted target column width of each column; determining the maximum number of display rows of the data content with the largest width in each column when the adjusted target column width of each column is used for line wrapping display; calculating the absolute value of the difference in the maximum number of display rows between every two columns when the adjusted target column width of each column is used for line wrapping display; and when the absolute values ​​of the differences calculated when the adjusted target column width of each column is used for line wrapping display are all less than a second difference threshold, using the adjusted target column width of each column as the target column width of each column, wherein the second difference threshold is less than the first difference threshold.

[0078] Before step S410, the method further includes: using the width of the header data content of each column in the table as the column width of each column; determining the maximum number of display rows of each column when the column width of each column is used for line wrapping display; calculating the absolute value of the difference between the maximum number of display rows between each two columns when the column width of each column is used for line wrapping display; and determining that the absolute value of the difference is greater than or equal to the first difference threshold when the column width of each column is used for line wrapping display. Further, the data content includes the header data content and the body data content. Before using the width of the header data content of each column as the column width of each column, the method further includes: determining the size relationship between the width of the header data content in each column and the maximum width of the body data content; and determining that the size relationship in each column exists such that the width of the body data content is greater than the maximum width of the header data content. After determining the size relationship between the width of the header data content in each column and the maximum width of the body data content, it also includes: when the size relationship in each column is that the width of the header data content is greater than or equal to the maximum width of the body data content, the width of the header data content of each column is used as the target column width of each column.

[0079] For details about the method for determining the table column width, please refer to the above description, which will not be repeated here for the sake of brevity.

[0080] According to a further embodiment of the present disclosure, a system for determining table column width is also provided.

[0081] Fig.12The structural schematic block diagram of a table column width determination system using a hardware implementation of a processor in one embodiment of the present disclosure is shown. The hardware structure of the table column width determination system 1000 of the present disclosure can be implemented using a bus architecture. The bus architecture may include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, a memory 1300 and / or hardware modules together. The bus 1100 may also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc. The bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 1100 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one connecting line is used in the figure, but it does not mean that there is only one bus or one type of bus. The memory 1300 stores a computer program. When the processor 1200 executes the computer program, the processor 1200 can perform the following process.

[0082] The initial column width of each column in the table is determined, and this process can be implemented by the first determination module 1002 .

[0083] Determine the maximum number of display rows for each column when wrapping is performed with the initial column width of each column, wherein the maximum number of display rows for each column is the number of display rows of the data content with the largest width in each column. This process can be implemented by the second determination module 1004.

[0084] The absolute value of the difference between the maximum number of displayed rows between every two columns is calculated. This process can be implemented by the calculation module 1006 .

[0085] When the absolute values ​​of the differences are all smaller than the first difference threshold, the initial column width of each column is used as the target column width of each column. This process can be implemented by the third determination module 1008 .

[0086] For contents related to the table column width determination system, please refer to the above description, which will not be repeated here for the sake of brevity.

[0087] The present disclosure also provides a readable storage medium, in which a computer program is stored, and the computer program is used to implement the above method when executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.

[0088] The present disclosure also provides a computer program product. The method of the present disclosure can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part.

[0089] A computer program or instruction may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, a computer program or instruction may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.

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

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

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

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

[0094] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.

[0095] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0096] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.

Claims

1. A method for determining table column width, characterized in that: include: Determine the initial column width of each column in the table; Determine the maximum number of display rows of each column when the initial column width of each column is used for line wrapping display, wherein the maximum number of display rows of each column is the number of display rows of the data content with the largest width in each column; Calculating the absolute value of the difference between the maximum number of displayed rows between every two columns; and When the absolute values ​​of the differences are all smaller than the first difference threshold, the initial column width of each column is used as the target column width of each column.

2. The method for determining table column width according to claim 1, characterized in that: After calculating the absolute value of the difference between the maximum number of display rows between every two columns, the method further includes: In the case where the absolute value of the difference is greater than or equal to the first difference threshold, adjusting the initial column width of each column to obtain an adjusted column width of each column; and The adjusted column width of each column is redetermined as the initial column width of each column, and the step of determining the maximum number of display rows of each column when wrapping and displaying with the initial column width of each column is entered again to perform multiple cycles of column width adjustment until the absolute values ​​of the differences are all less than the first difference threshold.

3. The method for determining table column width according to claim 2, characterized in that: The data content includes header data content, and the determining of the initial column width of each column in the table includes: The minimum width of the header data content in the table is used as the initial column width of each column.

4. The method for determining table column width according to claim 3, characterized in that: The adjusting the initial column width of each column to obtain the adjusted column width of each column includes: Determine a target column and remaining columns in the table, wherein the target column is a column with the largest number of displayed rows in the table when the initial column widths of the columns are used for line wrapping display, and the remaining columns are columns other than the target column in the table when the initial column widths of the columns are used for line wrapping display; and The initial column width of the target column is increased by the target width, and the initial column widths of the remaining columns are kept unchanged, so as to obtain the adjusted column widths of the columns.

5. The method for determining table column width according to claim 2, characterized in that: The data content includes header data content, and the determining of the initial column width of each column in the table includes: The maximum width of the header data content in the table is used as the initial column width of each column.

6. The method for determining table column width according to claim 5, characterized in that: The adjusting the initial column width of each column to obtain the adjusted column width of each column includes: Determine a target column and remaining columns in the table, wherein the target column is a column with the smallest number of displayed rows in the table when the initial column widths of the columns are used for line wrapping display, and the remaining columns are columns in the table other than the target column when the initial column widths of the columns are used for line wrapping display; and The initial column width of the target column is reduced by the target width, and the initial column widths of the remaining columns are kept unchanged, to obtain the adjusted column widths of the columns.

7. The method for determining table column width according to any one of claims 1 to 6, characterized in that: The determining of the maximum number of display rows of each column when wrapping the initial column width of each column comprises: The width of the data content with the largest width in each column is divided by the initial column width of the column where the data content is located and then rounded up to obtain the maximum number of display rows of each column when the initial column width of each column is used for line wrapping display.

8. A table column width determination system, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following process: Determine the initial column width of each column in the table; Determine the maximum number of display rows of each column when the initial column width of each column is used for line wrapping display, wherein the maximum number of display rows of each column is the number of display rows of the data content with the largest width in each column; Calculating the absolute value of the difference between the maximum number of displayed rows between every two columns; and When the absolute values ​​of the differences are all smaller than the first difference threshold, the initial column width of each column is used as the target column width of each column.

9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program is used to implement the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that The computer program product comprises a computer program, which is used to implement at least the method according to any one of claims 1 to 7 when being executed by a processor.