[go: up one dir, main page]

CN114004203A - A form adjustment method, device, electronic device and storage medium - Google Patents

A form adjustment method, device, electronic device and storage medium Download PDF

Info

Publication number
CN114004203A
CN114004203A CN202111242647.1A CN202111242647A CN114004203A CN 114004203 A CN114004203 A CN 114004203A CN 202111242647 A CN202111242647 A CN 202111242647A CN 114004203 A CN114004203 A CN 114004203A
Authority
CN
China
Prior art keywords
column
cell
target
width
column width
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111242647.1A
Other languages
Chinese (zh)
Other versions
CN114004203B (en
Inventor
王乙雯
陈方达
王路
马曦文
罗晟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Bamboo Information Technology Co ltd
Original Assignee
Hangzhou Netease Bamboo Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Netease Bamboo Information Technology Co ltd filed Critical Hangzhou Netease Bamboo Information Technology Co ltd
Priority to CN202111242647.1A priority Critical patent/CN114004203B/en
Publication of CN114004203A publication Critical patent/CN114004203A/en
Application granted granted Critical
Publication of CN114004203B publication Critical patent/CN114004203B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Design And Manufacture Of Integrated Circuits (AREA)

Abstract

The embodiment of the disclosure provides a form adjusting method, a form adjusting device, an electronic device and a storage medium, wherein the form adjusting method comprises the following steps: in response to monitoring that a column width of any column in a table and a row height of a cell in the column meet an 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 of the column, and a first magnification; determining a first target line height corresponding to each cell in the column according to the area of data contained in each cell in the column and the first target column width; determining a second target line height corresponding to each cell in the column according to the first target line height corresponding to each cell in the column and the line 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. And automatic self-adaptive adjustment of the row width and the column width is realized.

Description

Table adjusting method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of page display, and in particular, to a method and an apparatus for adjusting a table, an electronic device, and a storage medium.
Background
This section is intended to provide a background or context to the embodiments of the disclosure recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
When data contents are displayed in a table, the data contents are usually displayed according to a preset fixed line height, a fixed column width, or a fixed line height and a fixed column width of a cell, if the amount of the data contents displayed in one cell is too large, a column edge line and/or a row edge line of the table need to be manually adjusted to adjust the column width and/or the line height of the table, so that the data contents contained in the cell can be completely displayed in the cell. However, the adjustment efficiency of the table adjustment method is low, and the adjusted table structure is disordered and disordered, so that the data content in all cells in the table cannot be displayed in a balanced manner.
Disclosure of Invention
In view of the above technical problems, the present disclosure provides a table adjusting method, an apparatus, an electronic device, and a storage medium, so as 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 is displayed in a balanced manner.
In one aspect, an embodiment of the present disclosure provides a table adjustment method, including:
in response to monitoring that a column width of any column in a table and a row height of a cell in the column meet an 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 of the column, and a first magnification;
determining a first target line height corresponding to each cell in the column according to the area of data contained in each cell in the column and the first target column width;
determining a second target line height corresponding to each cell in the column according to the first target line height corresponding to each cell in the column and the line 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.
In one possible embodiment, the column width of any column of the table and the row height of each cell in the column are determined to satisfy the adjustment condition by:
if the row height of any cell in the column is larger than the column width of the column with a second multiplying power, determining that the column width of the column and the row height of the cell in the column meet an adjustment condition; or
And if the dispersion of the row heights of the cells in the row is greater than or equal to a preset threshold value, determining that the row width of the row and the row heights of the cells in the row meet an adjustment condition.
In a possible implementation manner, 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:
determining a second target column width corresponding to each cell in the column according to the row height and the first multiplying power of each cell in the column, and determining a third target column width corresponding to each cell in the column according to the row height and the second multiplying power of each cell in the column, wherein the second multiplying power is larger than the first multiplying power;
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 a first target column width of the column.
In a possible implementation manner, 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:
respectively setting a first target column width parameter corresponding to each cell in the column;
determining a line height objective 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 multiplying power;
calculating a first target column width parameter value corresponding to each cell according to the area of data contained in each cell in the column and the line height target function corresponding to each cell;
determining a first target column width for the column based on each of the first target column width parameter values.
In a possible implementation manner, determining, according to the target column width parameter and the first magnification ratio corresponding to each cell in the column, a line height objective function corresponding to each cell in the column specifically includes:
determining the following formula as the line height objective function corresponding to each cell in the column:
hi=a1*xi
wherein h isiRepresenting a line height objective function corresponding to the ith cell in the column, wherein i is 1,2, … …, n, n represents the number of cells in the column;
a1representing the first magnification;
xiand the first target column width parameter corresponding to the ith unit cell in the column is represented.
In a possible implementation manner, calculating a first target column width parameter value corresponding to each cell according to an area of data included in each cell in the column and the line height objective function corresponding to each cell, specifically includes:
calculating a first target column width parameter value corresponding to each cell in the column by the following formula:
Figure BDA0003320035900000031
wherein x isiPresentation instrumentA first target column width parameter corresponding to an ith cell in the column;
sirepresenting the area of data contained in the ith cell in the column.
In a possible implementation manner, 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:
setting a second target column width parameter for each cell in the column;
setting a column width objective function corresponding to the column according to the area of data contained in each unit cell in the column, the second target column width parameter and the first multiplying power;
and calculating to obtain a first target column width of the column according to the column width objective function.
In a possible implementation manner, setting a column width objective function corresponding to the column according to an area of data included in each cell in the column, the target column width parameter, and the first magnification specifically includes:
setting the following formula as a column-wide objective function corresponding to the column:
Figure BDA0003320035900000041
wherein f (x) represents a column width objective function corresponding to the column;
sirepresenting the area of data contained in the ith cell in the column, i ═ 1,2, … …, n, n represents the number of cells in the column;
x represents a second target column width parameter for each cell in the column;
a1the first magnification is expressed.
In a possible implementation manner, determining, according to the first target line height corresponding to each cell in the column and the line height of each cell in the column, the second target line height corresponding to each cell in the column specifically includes:
for each cell in the column, if it is determined that the first target line height corresponding to the cell is greater than or equal to the line height of the cell, determining the first target line height corresponding to the cell as a second target line height corresponding to the cell;
and if the first target line height corresponding to the cell is determined to be smaller than the line height of the cell, determining the line height of the cell as a second target line height corresponding to the cell.
In one aspect, an embodiment of the present disclosure provides a table adjusting apparatus, including:
a first determining unit, configured to determine a first target column width of a column based on a row height of each cell in the column, a column width of the column, and a first magnification 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 second determining unit, configured to determine, according to an area of data included in each cell in the column and the first target column width, a first target row height corresponding to each cell in the column;
a third determining unit, configured to determine, according to the first target line height corresponding to each cell in the column and the line height of each cell in the column, a second target line height corresponding to each cell in the column;
and an adjusting unit 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.
In a possible implementation manner, the first determining unit is specifically configured to determine that the column width of any column of the table and the row height of each cell in the column satisfy the adjustment condition by: if the row height of any cell in the column is larger than the column width of the column with a second multiplying power, determining that the column width of the column and the row height of the cell 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 value, determining that the column width of the column and the row heights of the cells in the column meet an adjustment condition.
In a possible implementation manner, the first determining unit is specifically configured to 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, where 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 a first target column width of the column.
In a possible implementation manner, the first determining unit is specifically configured to set a first target column width parameter corresponding to each cell in the column; determining a line height objective 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 multiplying power; calculating a first target column width parameter value corresponding to each cell according to the area of data contained in each cell in the column and the line height target function corresponding to each cell; determining a first target column width for the column based on each of the first target column width parameter values.
In a possible implementation manner, the first determining unit is specifically configured to determine the following formula as a line height objective function corresponding to each cell in the column:
hi=a1*xi
wherein h isiRepresenting a line height objective function corresponding to the ith cell in the column, wherein i is 1,2, … …, n, n represents the number of cells in the column;
a1representing the first magnification;
xiand the first target column width parameter corresponding to the ith unit cell in the column is represented.
In a possible implementation manner, the first determining unit is specifically configured to calculate a first target column width parameter value corresponding to each cell in the column by using the following formula:
Figure BDA0003320035900000061
wherein x isiA first target column width parameter representing a corresponding ith cell in the column;
sirepresenting the area of data contained in the ith cell in the column.
In a possible implementation manner, the first determining unit is specifically configured to set a second target column width parameter for each cell in the column; setting a column width objective function corresponding to the column according to the area of data contained in each unit cell in the column, the second target column width parameter and the first multiplying power; and calculating to obtain a first target column width of the column according to the column width objective function.
In a possible implementation manner, the first determining unit is specifically configured to set the following formula as a column width objective function corresponding to the column:
Figure BDA0003320035900000062
wherein f (x) represents a column width objective function corresponding to the column;
sirepresenting the area of data contained in the ith cell in the column, i ═ 1,2, … …, n, n represents the number of cells in the column;
x represents a second target column width parameter for each cell in the column;
a1the first magnification is expressed.
In a possible implementation manner, the third determining unit is specifically configured to, for each cell in the column, determine, if it is determined that the first target line height corresponding to the cell is greater than or equal to the line height of the cell, the first target line height corresponding to the cell is determined as the second target line height corresponding to the cell; and if the first target line height corresponding to the cell is determined to be smaller than the line height of the cell, determining the line height of the cell as a second target line height corresponding to the cell.
In one aspect, an embodiment of the present disclosure provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the table adjustment method according to the present disclosure when executing the computer program.
In one aspect, the disclosed embodiments provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the computer program instructions implement the steps in the table adjusting method disclosed in the present disclosure.
The beneficial effects of the disclosed embodiment are as follows:
in response to monitoring that the column width of any column in the table and the row height of a cell in the column satisfy a preset condition, determining a 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 a first magnification, determining a first target row height (i.e., an 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 further determining a final target row height to be adjusted corresponding to each cell in the column according to the first target row height of each cell in the column and the row height of each cell in the column: the row width of the row is adjusted to be the first target row width, and the row heights of all the cells in the row are adjusted to be the second target row heights corresponding to the first target row width, so that automatic self-adaptive adjustment of the row heights and the row widths is realized.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
fig. 1 is a schematic view of an application scenario of a table adjustment method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart illustrating an implementation of a table adjustment method according to an embodiment of the disclosure;
fig. 3 is a schematic flow chart illustrating an implementation of determining a first target column width of any column satisfying an adjustment condition according to an embodiment of the present disclosure;
fig. 4 is a schematic flow chart illustrating another implementation of determining a first target column width of any column satisfying an adjustment condition according to an embodiment of the present disclosure;
fig. 5 is a schematic flow chart illustrating another implementation of determining a first target column width of any column satisfying an adjustment condition according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a table adjusting apparatus according to an embodiment of the disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The principles and spirit of the present disclosure will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the present disclosure, and are not intended to limit the scope of the present disclosure in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Embodiments of the present disclosure may be implemented as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
In this document, it is to be understood that any number of elements in the figures are provided by way of illustration and not limitation, and any nomenclature is used for differentiation only and not in any limiting sense.
For convenience of understanding, technical terms involved in the embodiments of the present disclosure are explained:
1. height of the cell: the height of the top edge to the bottom edge of a cell in the table.
2. Cell column width: the width from the left edge to the right edge of a cell in the table.
3. Height: the height of a row in the table, all cells in the same row have the same row height.
4. Column width: the width of a column in the table, all cells in the same column have the same column width.
5. Embedded pictures: the picture embedded in the cell is displayed in the cell in a limited way by taking the cell as a container.
6. Gold rectangle: the aspect ratio of the golden rectangle is the golden ratio.
The principles 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
The inventor finds that, when data content is displayed in a table, in the related art, the data content is usually displayed according to a preset fixed line height, a fixed column width, or a fixed line height and a fixed column width of a cell, if the amount of data content displayed in a cell is too large, for example, when text data content in a cell is too long, or when an area of an embedded picture inserted in a cell is too large, it is necessary to adjust the column width and/or the line height of the table by manually adjusting a column edge and/or a row edge of the table, for example, adjusting the column width in the case of fixed line height by double clicking on the column edge of the table, or adjusting the line height in the case of fixed line width by double clicking on the row edge of the table, or manually adjusting the line height and the column width respectively, so that the data content contained in the cell can be completely displayed in the cell, however, the adjustment of such a table is inefficient, and the adjusted table structure is disordered and disordered, and the data contents in all cells in the table cannot be displayed in a balanced manner.
In order to solve the above problem, the present disclosure provides a table adjustment method, an apparatus, an electronic device, and a storage medium, in response to monitoring that a column width of any column in a table and a row height of a cell in the column satisfy a preset condition, determining a first target column width of the column according to a row height of each cell in the column, a column width of the column, and a first magnification, determining a first target row height (i.e., an ideal target row height) corresponding to each cell in the column according to an area of data in each cell in the column and the first target column width, and further determining a final target row height to be adjusted corresponding to each cell in the column according to the first target row height of each cell in the column and the row height of each cell in the column: the row width of the row is adjusted to be the first target row width, and the row heights of all the cells in the row are adjusted to be the second target row heights corresponding to the first target row width, so that automatic self-adaptive adjustment of the row heights and the row widths is realized.
Having described the general principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
Application scene overview
Fig. 1 is a schematic view of an application scenario of a table adjustment method according to 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 through a communication network. The server 102 may monitor a table in operation by the user through the terminal device 101 or a table that has been operated and input to the terminal device 101 by the user, and in response to monitoring that the column width of any column in the table and the row height of a cell in the column satisfy an adjustment condition, the server 102 adjusts the column width of each column and the row height of each cell in the column that satisfy the adjustment condition, so that the overall structure of the table is orderly and the data content in each cell in the table can be displayed in a balanced manner. In another application scenario, the table adjusting method provided in the embodiment of the present disclosure may also be directly applied to the terminal device 101, and the terminal device 101 may monitor a table in user operation or a table input by a user and completed in operation, and in response to monitoring that a column width of any column in the table and a row height of a cell in the column satisfy an adjustment condition, the terminal device 101 adjusts a column width of each column and a row height of each cell in the column that satisfy the adjustment condition, which is not limited in the embodiment of the present disclosure.
The communication network may be a local area network, a wide area network, a mobile internet, and the like, and the terminal device 101 may be, but is not limited to: the server 102 may be an independent physical server, or may be a cloud server that provides basic cloud computing services such as a cloud server, a cloud database, and cloud storage, which is not limited in this disclosure.
Exemplary method
The following describes a table adjustment method according to an exemplary embodiment of the present disclosure in conjunction with the above application scenarios. It should be noted that the above application scenarios are merely illustrated for the convenience of understanding the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. Rather, embodiments of the present disclosure may be applied to any scenario where applicable.
The embodiment of the present disclosure provides a table adjusting method, which may be applied to the server 102 shown in fig. 1, or may also be applied to the terminal device 101 shown in fig. 1, and in the embodiment of the present disclosure, the table adjusting method is described only by taking the application to the terminal device 101 as an example, as shown in fig. 2, which is an implementation flow diagram of the table adjusting method provided in the embodiment of the present disclosure, and specifically may include the following steps:
s21, in response to the fact that the column width of any column in the table and the row height of the cells in the column meet the adjusting condition, 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 multiplying power.
In specific implementation, a user may establish a table on the terminal device, and operate the table, for example, input data content in each cell, and the type of the 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 text data is inserted into the cells, the text data can be automatically subjected to line feed setting, line feed character input, font size setting, copying, cutting, pasting and other operations. The user can also upload the table which is operated to the terminal device, the terminal device can monitor the table which is in operation or the table which is operated, the terminal device responds to the monitored column width of any column in the table and the monitored line height of the cells in the column to meet the adjustment condition, and the target column width of the column is determined according to the line height of each cell in the column, the column width of the column and the first multiplying power, is recorded as a first target column width, and is the target column width which is finally required to be adjusted by the column.
In implementation, in order to enable the row height and the column width of the cells in the table to exhibit visual equalization effect, the inventor of the present disclosure may design an adjustment rule of the row height and the column width according to a visual rule of a golden ratio, wherein a first magnification represents a ratio of the row height to the column width of the cells in the table, for example, assuming that the row height of the cells in the table is h, the column width is x, and the first magnification is a1Then, the relationship between the row height, column width and first magnification of the cell can be expressed as: h is a1x, e.g. a1The golden section ratio can be adopted, the embodiment of the disclosure is not limited to the golden section ratio, and in the implementation process, the golden section ratio can be set according to the requirement, a1The value of (a) can make the table display balanced, and satisfy comfortable reading effect, for example, when a1When the golden ratio is set, namely: the ratio of the height h to the width x of the row is golden ratio, and meets the golden ratio rule, so that the generated sheetThe unit lattice is a golden rectangle, so that a relatively balanced display effect can be achieved, and the reading comfort level is improved.
Specifically, it can be determined that the column width of any column of the table and the row height of each cell in the column satisfy the adjustment condition in the following manner:
in one possible embodiment, 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 cell in the column satisfy the adjustment condition.
In specific implementation, if the terminal device monitors that the height of any cell in the table is greater than the row width of the row of the cell with the second magnification, it is determined that the row width of the row and the height of the cell in the row meet the adjustment condition, and the row width and the height of each cell in the row need to be adjusted. For example, when the second magnification a2When the line height of any cell is 1, if the terminal equipment monitors that the line height of the cell is larger than the line width of the column where the cell is located, the line width of the column and the line height of the cell in the column are determined to meet the adjustment condition.
In one possible embodiment, if the dispersion of the row heights of each cell 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 height of the cell in the column satisfy the adjustment condition.
In specific implementation, for a column in the table, the terminal device may further determine whether the column width of the column and the row height of the cell in the column satisfy the adjustment condition by comparing the dispersion of the row height of each cell in the column with a preset threshold.
Specifically, the variance or standard deviation of the line heights of each cell in a column may be determined as the dispersion of the line heights of each cell in a column, the preset threshold may be set according to an empirical value, which is not limited in the embodiments of the present disclosure, for example, a preset threshold value of 0.36 may be set, if the dispersion of the row heights of each cell in a row is smaller than the preset threshold value, the data contents of each cell in the row are considered to be relatively evenly displayed without adjusting the row width of the row and the row heights of the cells included in the row, if the dispersion of the row heights of each cell in a row is greater than or equal to the preset threshold value, the data contents of each cell in the row are considered to be unevenly displayed, it is determined that the column width of the column and the row height thereof containing the cell satisfy the adjustment condition, and the column width of the column and the row height thereof containing the cell need to be adjusted.
And S22, determining a first target line 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.
In specific implementation, for any column of cells meeting the adjustment condition, the terminal device may determine a first target line height corresponding to each cell in the column according to an area of data included in each cell in the column and the determined first target line width of the column, where the determined first target line height corresponding to each cell is an ideal line height of each cell, that is, if the cells are displayed according to the first target line width and the first target line height corresponding to each cell in the column, the column may achieve a more 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 size (namely the word size) of the characters and the number of the 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, and if the data in the cell is mixed data of the text data and the embedded picture, 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.
And S23, determining a second target line height corresponding to each cell in the column according to the first target line height corresponding to each cell in the column and the line height of each cell in the column.
In specific implementation, considering that the area of the data content contained in some cells in other columns in the table is larger than the area of the data content contained in the cells in the corresponding row in the column, in order to enable the cells in other columns to achieve the effect of balanced display, the finally adjusted target row height (which may be referred to as a second target row height) of each cell in the column needs to be adjusted 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 a second target line height corresponding to each cell in the column according to a first target line height corresponding to each cell in the column and a line height of each cell in the column, determines, for each cell in the column, the first target line height corresponding to the cell as the second target line height corresponding to the cell if it is determined that the first target line height corresponding to the cell is greater than or equal to the line height of the cell, and determines the line height of the cell as the second target line height corresponding to the cell if it is determined that the first target line height corresponding to the cell is less than the line height of the cell.
S24, adjusting the column width of the column to the first target column width, and adjusting the row height of each cell in the column to the corresponding second target row height.
In specific implementation, the terminal device adjusts the column width of the column to a first target column width, and adjusts the row heights of the cells in the column to corresponding second target row heights.
In the table adjusting method provided by the embodiment of the present disclosure, in response to monitoring that a column width of any column in a table and a row height of a cell in the column satisfy a preset condition, a terminal device (or a server) determines a first target column width of the column according to a row height of each cell in the column, a column width of the column, and a first magnification, determines a first target row height corresponding to each cell in the column according to an area of data in each cell in the column and the first target column width, and further determines a final target row height to be adjusted corresponding to each cell in the column according to the first target row height of each cell in the column and the row height of each cell in the column: the row width of the row is adjusted to be the first target row width, and the row heights of all the cells in the row are adjusted to be the second target row heights corresponding to the first target row width, so that automatic self-adaptive adjustment of the row heights and the row widths is realized.
As a possible implementation manner, the step of determining the first target column width of any column satisfying the adjustment condition in step S21 may be executed according to the flowchart shown in fig. 3, and specifically includes the following steps:
and S31, determining a second target column width corresponding to each unit cell in the column according to the line height and the first multiplying power of each unit cell in the column, and determining a third target column width corresponding to each unit cell in the column according to the line height and the second multiplying power of each unit cell in the column.
In the implementation process, in order to enable the row height and the column width of the cells in the table to show the visual balance effect, the adjustment rules of the row height and the column width can be designed to satisfy the following relations: the row height may be required to be between a column width at a first magnification and a column width at a second magnification, wherein the second magnification is the same as the first magnification and each characterizes a ratio of the row height to the column width of a cell, e.g., assuming the row height of a cell in a table is h, the column width is x, and the second magnification is a2Then, the relationship between the row height, column width and second magnification of the cell can be expressed as: h is a2x, wherein the second magnification is greater than the first magnification according to the visual principle of the golden ratio (i.e., golden ratio), a1Can be set to the golden ratio, a2May be set to 1, which is not limited by the embodiments of the present disclosure.
In specific implementation, considering that the area of the data content in different cells in a column is different, the row height is different, the column width is x, and the row height of each cell in the column can be set at a1x~a2Between x, assume that a row to be adjusted includes n rows, that is, the row includes n cells, and assume that the row height of each cell is h1~hnThe terminal device then selects the row height h of each cell 1-n in the column1~hnAnd a first magnification a1Determining a second target column width x corresponding to each of the cells 1-n in the column1~xnThe method specifically comprises the following steps:
Figure BDA0003320035900000151
according to the line height h of each cell 1-n in the column1~hnAnd a second magnification a2Determining a third target column width x corresponding to each of the cells 1-n in the column1~xnThe method specifically comprises the following steps:
Figure BDA0003320035900000152
s32, in response to the fact that the maximum third target column width is smaller 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; and in response to the maximum third target column width being greater than the minimum second target column width, determining a target column width interval according to any two third target column widths and the minimum second target column width.
In specific implementation, the acceptable maximum column width can satisfy the following conditions: in that
Figure BDA0003320035900000153
And is in
Figure BDA0003320035900000154
… …, and is in
Figure BDA0003320035900000155
That is, the target column width interval that the column width x needs to satisfy is:
Figure BDA0003320035900000156
namely: the maximum third target column width and the minimum second target column width.
In the implementation process, if the maximum third target column width is less than or equal to the minimum second target column width, determining the maximum third target column width as the lower limit of the interval of the target column width interval, and determining the minimum second target column width as the upper limit of the interval of the target column width interval, to obtain the target column width interval, that is: will be provided with
Figure BDA0003320035900000157
The maximum value of (2) is taken as the lower limit of the interval
Figure BDA0003320035900000158
The minimum value of the sum is used as the upper limit of the interval to obtain the target column width interval.
If the maximum third target column width is larger than the minimum second target column width, that is, the maximum third target column width is larger than the minimum second target column width
Figure BDA0003320035900000159
When there is no value, the target column width interval may be determined according to 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 may be removed, i.e., removed
Figure BDA00033200359000001510
And continuing to calculate the target column width interval until the maximum value in the currently remaining third target column widths is less than or equal to the minimum value in the second target column widths, so that the obtained target column width interval has a value.
S33, determining any value in the target column width interval as the first target column width of the column.
In particular, the terminal device may determine any value falling within the range of 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.
Note that, for a cell without data content, that is, a cell with a data area of 0, is negligible in calculation, and after the first target column width is calculated, the row height of this cell can be directly displayed as the first target column width at the first magnification.
The following description is given with reference to an example, in which1A value of 0.618, a2The value is 1, and the row height of each cell of the column to be adjusted may be set between 0.618x and x, which is not limited to this embodiment of the disclosure. Assuming that a column to be adjusted contains n cells, each cell is knownAre each h1~hnThen, the second target column width corresponding to each cell 1-n in the column is:
Figure BDA0003320035900000161
Figure BDA0003320035900000162
the third target column width corresponding to each cell 1-n in the column is: x is the number of1=h1,x2=h2,……,xn=hnThen, the target column width interval that the column width x needs to satisfy is:
Figure BDA0003320035900000163
if h1,h2,……,hnIs less than or equal to
Figure BDA0003320035900000164
The minimum value of (d), then h1,h2,……,hnThe maximum value of (2) is taken as the lower limit of the interval
Figure BDA0003320035900000165
The minimum value of the target row width interval is used as the upper limit of the interval to obtain a target row width interval; if h1,h2,……,hnIs greater than
Figure BDA0003320035900000166
The minimum value of h is removed1,h2,……,hnMaximum and minimum values of, e.g., h1,h2,……,hnThe maximum value and the minimum value in (1) are respectively h1And h2Then h is removed1And h2Calculating
Figure BDA0003320035900000167
Obtaining a target column width interval if h3,h4,……,hnIs less than or equal to
Figure BDA0003320035900000168
The minimum value of (d), then h3,h4,……,hnThe maximum value of (2) is taken as the lower limit of the interval
Figure BDA0003320035900000171
The minimum value of the target column width is used as the upper limit of the interval, and if h is the target column width interval3,h4,……,hnThe maximum value in (a) is still greater than
Figure BDA0003320035900000172
The minimum value of h is continuously removed3,h4,……,hnAnd (4) continuously calculating the target column width interval until the calculated target column width interval has a value.
As a possible implementation manner, in order to make the visual display effect of the row heights and column widths of the cells in the table more balanced, the step of determining the first target column width of any column satisfying the adjustment condition in step S21 may be further performed according to the flow shown in fig. 4, and specifically includes the following steps:
and S41, setting a first target column width parameter corresponding to each cell in the column.
In specific implementation, in order to make the visual display effects of the line height and the line width of the cells in the table more balanced, the adjustment rules of the line height and the line width can be designed to satisfy the following relations: the row heights of all cells in any column can be made to approach the column width at the first magnification on average. For example, the visual display effect of the line height and the line width of the cells in the table can be more similar to the visual law of the golden ratio, namely the first multiplying power a1The golden section ratio may be employed and embodiments of the present disclosure are not limited in this respect. In the implementation process, the terminal device may set a first target column width parameter corresponding to each cell in the column: x is the number ofi,i=1,2,……,n,xiAnd a first target column width parameter corresponding to the ith cell in the column is represented, and n represents the number of cells in the column.
And S42, determining a line height objective function corresponding to each cell in the column according to the first target column width parameter and the first multiplying power corresponding to each cell in the column.
In specific implementation, the following formula may be determined as the line height objective function corresponding to each cell in the column:
hi=a1*xi
wherein h isiRepresenting the line height objective function corresponding to the ith cell in the column, wherein i is 1,2, … …, n, and n represents the number of cells in the column;
a1representing a first magnification;
xia first target column width parameter corresponding to an ith cell in the column is indicated.
And S43, calculating corresponding first target column width parameter values according to the area of the data contained in each cell in the column and the corresponding line height target function.
In specific implementation, the first target column width parameter value corresponding to each cell in the column may be calculated by the following formula:
Figure BDA0003320035900000181
wherein x isiA first target column width parameter representing a correspondence of an ith cell in the column;
sirepresenting the area of data contained in the ith cell in the column;
a1the first magnification is shown.
And S44, determining the first target column width of the column according to the first target column width parameter values.
In particular, x may beiMedian in (1) }
Figure BDA0003320035900000182
The first target column width for that column is determined, and x may also beiThe first target column width parameter value corresponding to each cell in theArranging the sizes in sequence to obtain median
Figure BDA0003320035900000183
The mean value of the first target column width parameter values of the preset number on the left side of the median and the first target column width parameter values of the preset number on the right side of the median is used as the first target column width of the column, which is not limited in the embodiment of the disclosure. The preset number may be set according to actual needs, for example, may be set to 1, and this is not limited in the embodiment of the present disclosure.
It should be noted that, for a cell without data content, that is, a cell with a data area of 0, can be ignored during calculation, and after the first target column width is calculated, the row height of the cell can be directly shown as the first target column width at the first magnification, that is, the row height of the cell is: a is1x。
In order to make the visual display effect of the line height and the line width of the cells in the table more approximate to the visual rule of golden ratio, the first multiplying power a is still used1The setting of 0.618 is for illustration, and assuming that a column to be adjusted includes n cells, it is known that the row heights of the cells 1 to n are h1~hnThe areas of the data contained in the cells 1 to n are s1~snTo make the row height average of cells 1 to n in the column close to 0.618x, a first target column width parameter is set for each cell 1 to n in the column: x is the number of1~xnSetting the respective corresponding line height objective functions of the cells 1 to n as follows: h is1=0.618x1,h2=0.618x2,……,hn=0.618xnAnd then according to
Figure BDA0003320035900000184
h1=0.618x1It is known that
Figure BDA0003320035900000185
Then the first target column width parameter corresponding to cell 1 can be calculated
Figure BDA0003320035900000191
In the same way, according to
Figure BDA0003320035900000192
h2=0.618x2The first target column width parameter corresponding to the cell 2 can be calculated
Figure BDA0003320035900000193
According to
Figure BDA0003320035900000194
hn=0.618xnCalculating the first target column width parameter corresponding to the cell n
Figure BDA0003320035900000195
Furthermore, the first target column width parameter set { x ] corresponding to each of the cells 1 to n may be set1,x2,……,xnThe median in (f) is determined as the first target column width of that column, i.e. the set
Figure BDA0003320035900000196
The median of (a) is determined as the first target column width for that column.
As a possible implementation manner, in order to make the visual display effect of the row heights and column widths of the cells in the table more balanced, the step of determining the first target column width of any column satisfying the adjustment condition in step S21 may be further performed according to the flow shown in fig. 5, and specifically includes the following steps:
and S51, setting a second target column width parameter for each cell in the column.
In specific implementation, in order to make the visual display effects of the line height and the line width of the cells in the table more balanced, the adjustment rules of the line height and the line width can be designed to satisfy the following relations: the line heights of all the cells in any column can be infinitely close to the column width of the first multiplying power, namely the visual display effect of the line heights and the column widths of the cells in the column tends to be infinitely set ratio. For example, all cells in any column may be madeThe visual display effect of the line height and the line width is infinitely close to the golden ratio, the first multiplying power a1The golden section ratio may be employed and embodiments of the present disclosure are not limited in this respect. In the implementation process, the terminal device sets a target column width parameter for each cell in any column to be adjusted: x, which may be denoted as a second target column width parameter.
And S52, setting a column width objective function corresponding to the column according to the area of the data contained in each cell in the column, the second target column width parameter and the first multiplying power.
In specific implementation, the following formula may be set as a column width objective function corresponding to the column:
Figure BDA0003320035900000197
wherein, f (x) represents a column width objective function corresponding to the column;
siindicating the area of data contained in the ith cell in the column, i ═ 1,2, … …, n, n indicates the number of cells in the column;
x represents a second target column width parameter for each cell in the column;
a1the first magnification is shown.
In the specific implementation process, the column to be adjusted includes n cells, the second target column width parameter is x, and the areas of the data included in the cells 1 to n in the column are s1~snTo make the row heights of cells 1 to n in the column approach the column width of the first magnification, there are:
Figure BDA0003320035900000201
due to the fact that
Figure BDA0003320035900000202
Can deduce
Figure BDA0003320035900000203
Further, it can be found that
Figure BDA0003320035900000204
Further, it can be found that:
Figure BDA0003320035900000205
namely: column-wide objective function for column correspondence
Figure BDA0003320035900000206
And S53, calculating and obtaining a first target column width of the column according to the column width objective function.
During specific implementation, the terminal device calculates an optimal solution of the column width objective function, and determines the optimal solution of the column width objective function as a first target column width of the column.
Specifically, the optimal solution for the column-wide objective function may be calculated by:
Figure BDA0003320035900000207
namely:
Figure BDA0003320035900000208
order to
Figure BDA0003320035900000209
Then
Figure BDA00033200359000002010
Can be expressed as:
Figure BDA00033200359000002011
namely, the method comprises the following steps:
Figure BDA00033200359000002012
Figure BDA00033200359000002013
further, to
Figure BDA00033200359000002014
The derivation can be:
f’(x)=(-2Bx-3+2na1 2x)x-1=0;
further derivation to obtain 2Bx-4=2na1 2Then can calculate out
Figure BDA0003320035900000211
Which is the column width objective function
Figure BDA0003320035900000212
The optimal solution of (1).
It should be noted that, for a cell without data content, that is, a cell with a data area of 0, can be ignored during calculation, and after the first target column width is calculated, the row height of the cell can be directly shown as the first target column width at the first magnification, that is, the row height of the cell is: a is1x。
In order to make the visual display effect of the line height and the line width of the cells in the table infinitely trend to the golden ratio, the first multiplying power a is still used1The setting of 0.618 is for illustration, and assuming that a column to be adjusted includes n cells, it is known that the row heights of the cells 1 to n are h1~hnThe areas of the data contained in the cells 1 to n are s1~snA second target column width parameter x is set for each cell 1-n such that the row heights of cells 1-n in the column all approach 0.618x, as follows:
Figure BDA0003320035900000213
due to the fact that
Figure BDA0003320035900000214
Can deduce
Figure BDA0003320035900000215
Figure BDA0003320035900000216
Further, it can be found that
Figure BDA0003320035900000217
Figure BDA0003320035900000218
Further, it can be found that:
Figure BDA0003320035900000219
Figure BDA00033200359000002110
namely: column-wide objective function for column correspondence
Figure BDA00033200359000002111
Figure BDA00033200359000002112
Further, calculate
Figure BDA00033200359000002113
The optimal solution of (2) can be obtained:
Figure BDA00033200359000002114
in the method, the relation between the area and the line height and the line width is considered, so that the data in each cell can be completely displayed while the data of each cell in the table can be uniformly displayed, and the reading effect is further improved.
In each of the above-listed examples in the embodiments of the present application, a represents1、a2The values of (0.618 and 1) are only used for illustrating and explaining the disclosure and are not used for limiting the disclosure, a1、a2The table display needs to be balanced, and a comfortable reading effect is achieved.
In the embodiment of the disclosure, based on the display rule that the visual display effect of the line height and the line width tends to the golden ratio, automatic adaptive adjustment of the line height and the line width of the table is realized, the adjustment efficiency is improved, the integral structure of the table is tidy and ordered, the data content in each cell in the table can be displayed uniformly and completely, and a user can obtain better reading experience when using and reading the table.
Exemplary device
Based on the same inventive concept, the embodiment of the present disclosure further provides a table adjusting apparatus, and since the principle of the table adjusting apparatus for solving the problem is similar to that of the table adjusting method, the implementation of the apparatus may refer to the implementation of the method, and repeated details are not repeated.
Fig. 6 is a schematic structural diagram of a table adjusting apparatus 60 according to an embodiment of the disclosure. In one embodiment, the table adjusting means 60 comprises: a first determining unit 601, a second determining unit 602, a third determining unit 603 and an adjusting unit 604.
A first determining unit 601, configured to determine a first target column width of a column based on a row height of each cell in the column, a column width of the column, and a first magnification 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 second determining unit 602, configured to determine, according to an area of data included in each cell in the column and the first target column width, a first target row height corresponding to each cell in the column;
a third determining unit 603, configured to determine, according to the first target line height corresponding to each cell in the column and the line height of each cell in the column, a second target line height corresponding to each cell in the column;
an adjusting unit 604, 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.
In a possible implementation manner, the first determining unit 601 is specifically configured to determine that the column width of any column of the table and the row height of each cell in the column satisfy the adjustment condition by: if the row height of any cell in the column is larger than the column width of the column with a second multiplying power, determining that the column width of the column and the row height of the cell 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 value, determining that the column width of the column and the row heights of the cells in the column meet an adjustment condition.
In a possible implementation, the first determining unit 601 is specifically configured to 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, where 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 a first target column width of the column.
In a possible implementation manner, the first determining unit 601 is specifically configured to set a first target column width parameter corresponding to each cell in the column; determining a line height objective 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 multiplying power; calculating a first target column width parameter value corresponding to each cell according to the area of data contained in each cell in the column and the line height target function corresponding to each cell; determining a first target column width for the column based on each of the first target column width parameter values.
In a possible implementation manner, the first determining unit 601 is specifically configured to determine the following formula as a line height objective function corresponding to each cell in the column:
hi=a1*xi
wherein h isiRepresenting the ith cell pair in the columnThe corresponding line height objective function, i ═ 1,2, … …, n, denotes the number of cells in the column;
a1representing the first magnification;
xiand the first target column width parameter corresponding to the ith unit cell in the column is represented.
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:
Figure BDA0003320035900000241
wherein x isiA first target column width parameter representing a corresponding ith cell in the column;
sirepresenting the area of data contained in the ith cell in the column.
In a possible implementation manner, the first determining unit 601 is specifically configured to set a second target column width parameter for each cell in the column; setting a column width objective function corresponding to the column according to the area of data contained in each unit cell in the column, the second target column width parameter and the first multiplying power; and calculating to obtain a first target column width of the column according to the column width objective function.
In a possible implementation manner, the first determining unit 601 is specifically configured to set the following formula as a column width objective function corresponding to the column:
Figure BDA0003320035900000242
wherein f (x) represents a column width objective function corresponding to the column;
sirepresenting the area of data contained in the ith cell in the column, i ═ 1,2, … …, n, n represents the number of cells in the column;
x represents a second target column width parameter for each cell in the column;
a1the first magnification is expressed.
In a possible implementation manner, the third determining unit 603 is specifically configured to, for each cell in the column, determine, if it is determined that the first target line height corresponding to the cell is greater than or equal to the line height of the cell, the first target line height corresponding to the cell is determined as the second target line height corresponding to the cell; and if the first target line height corresponding to the cell is determined to be smaller than the line height of the cell, determining the line height of the cell as a second target line height corresponding to the cell.
Based on the same inventive concept as the above table adjustment method, the embodiment of the present disclosure also provides an electronic device 70. As shown in fig. 7, the electronic device 70 may include a processor 701 and a memory 702.
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 device, discrete Gate or transistor logic device, discrete hardware components, and may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present disclosure. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present disclosure may be embodied directly in a hardware processor, or in a combination of hardware and software modules.
Memory 702, which is a non-volatile computer-readable storage medium, may 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, and may include, for example, a flash Memory, a hard disk, a multimedia card, a card-type Memory, a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Programmable Read Only Memory (PROM), a Read Only Memory (ROM), a charged Erasable Programmable Read Only Memory (EEPROM), a magnetic Memory, a magnetic disk, an optical disk, and so on. The memory is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 702 in the disclosed embodiments may also be circuitry or any other device capable of performing a storage function to store program instructions and/or data.
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more units described above may be embodied in one unit, in accordance with embodiments of the present disclosure. Conversely, the features and functions of one unit described above may be further divided into embodiments by a plurality of units.
Further, while the operations of the disclosed methods are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the present disclosure have been described with reference to several particular embodiments, it is to be understood that the present disclosure is not limited to the particular embodiments disclosed, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (10)

1.一种表格调整方法,其特征在于,包括:1. a form adjustment method, is characterized in that, comprises: 响应于监测到表格中任一列的列宽和所述列中单元格的行高满足调整条件,基于所述列中的各单元格的行高、所述列的列宽以及第一倍率,确定所述列的第一目标列宽;In response to monitoring that the column width of any column in the table and the row height of the cells in the column satisfy the adjustment condition, determine based on the row height of each cell in the column, the column width of the column and the first magnification the first target column width of the column; 根据所述列中的各单元格包含的数据的面积和所述第一目标列宽,确定所述列中的各单元格各自对应的第一目标行高;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 first target column width; 根据所述列中的各单元格各自对应的第一目标行高以及所述列中的各单元格的行高,确定所述列中的各单元格各自对应的第二目标行高;According to the first target row height corresponding to each cell in the column and the row height of each cell in the column, determine the second target row height corresponding to 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 corresponding second target row height. 2.根据权利要求1所述的方法,其特征在于,基于所述列中的各单元格的行高、所述列的列宽以及第一倍率,确定所述列的第一目标列宽,具体包括:2 . The method according to claim 1 , wherein the first target column width of the column is determined based on the row height of each cell in the column, the column width of the column, and a first magnification, Specifically include: 根据所述列中的各单元格的行高和所述第一倍率,确定所述列中的各单元格各自对应的第二目标列宽,以及根据所述列中的各单元格的行高和第二倍率,确定所述列中的各单元格各自对应的第三目标列宽,其中,所述第二倍率大于所述第一倍率;A second target column width corresponding to each cell in the column is determined according to the row height of each cell in the column and the first magnification, and according to the row height of each cell in the column and a second magnification to determine a third target column width corresponding to each cell in the column, 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 interval is determined as the first target column width of the column. 3.根据权利要求1所述的方法,其特征在于,基于所述列中的各单元格的行高、所述列的列宽以及第一倍率,确定所述列的第一目标列宽,具体包括:3 . The method according to claim 1 , wherein the first target column width of the column is determined based on the row height of each cell in the column, the column width of the column and a first magnification, Specifically include: 分别为所述列中的各单元格设置各自对应的第一目标列宽参数;respectively setting the corresponding first target column width parameter for each cell in the column; 根据所述列中的各单元格各自对应的第一目标列宽参数和所述第一倍率,确定所述列中的各单元格各自对应的行高目标函数;Determine the row height objective 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; 根据所述列中的各单元格包含的数据的面积和各自对应的所述行高目标函数,计算各自对应的第一目标列宽参数值;Calculate the corresponding first target column width parameter value according to the area of the data contained in each cell in the column and the corresponding row height objective function; 根据各个所述第一目标列宽参数值确定所述列的第一目标列宽。The first target column width of the column is determined according to each of the first target column width parameter values. 4.根据权利要求3所述的方法,其特征在于,根据所述列中的各单元格各自对应的目标列宽参数和所述第一倍率,确定所述列中的各单元格各自对应的行高目标函数,具体包括:4 . The method according to claim 3 , wherein the corresponding target column width parameters and the first magnification of each cell in the column are determined according to the corresponding target column width parameter of each cell in the column. 5 . The row-height objective function, including: 将以下公式确定为所述列中的各单元格各自对应的行高目标函数:Determine the following formula as the respective row height objective function for each cell in the column: hi=a1*xi h i =a 1 *x i 其中,hi表示所述列中的第i个单元格对应的行高目标函数,i=1,2,……,n,n表示所述列中的单元格数量;Wherein, hi represents the row height objective function corresponding to the ith cell in the column, i=1,2,...,n,n represents the number of cells in the column; a1表示所述第一倍率;a 1 represents the first magnification; xi表示所述列中的第i个单元格对应的第一目标列宽参数。 xi represents the first target column width parameter corresponding to the ith cell in the column. 5.根据权利要求4所述的方法,其特征在于,根据所述列中的各单元格包含的数据的面积和各自对应的所述行高目标函数,计算各自对应的第一目标列宽参数值,具体包括:5 . The method according to claim 4 , wherein, according to the area of the data contained in each cell in the column and the respective corresponding row height objective function, the first target column width parameter corresponding to each is calculated. 6 . values, including: 通过以下公式计算所述列中的各单元格各自对应的第一目标列宽参数值:The first target column width parameter value corresponding to each cell in the column is calculated by the following formula:
Figure FDA0003320035890000021
Figure FDA0003320035890000021
其中,xi表示所述列中的第i个单元格对应的第一目标列宽参数;Wherein, x i represents the first target column width parameter corresponding to the i-th cell in the column; si表示所述列中的第i个单元格包含的数据的面积。 si represents the area of the data contained in the ith cell in the column.
6.根据权利要求1所述的方法,其特征在于,基于所述列中的各单元格的行高、所述列的列宽以及第一倍率,确定所述列的第一目标列宽,具体包括:6. The method according to claim 1, wherein the first target column width of the column is determined based on the row height of each cell in the column, the column width of the column, and a first magnification, Specifically include: 为所述列中的各单元格设置一个第二目标列宽参数;Set a second target column width parameter for each cell in the column; 根据所述列中的各单元格包含的数据的面积、所述第二目标列宽参数和所述第一倍率,设置所述列对应的列宽目标函数;Setting the column width objective function corresponding to the column according to the area of the data contained in each cell in the column, the second target column width parameter and the first magnification; 根据所述列宽目标函数计算获得所述列的第一目标列宽。The first target column width of the column is obtained by calculating according to the column width objective function. 7.根据权利要求6所述的方法,其特征在于,根据所述列中的各单元格包含的数据的面积、所述目标列宽参数和所述第一倍率,设置所述列对应的列宽目标函数,具体包括:7 . The method according to claim 6 , wherein the column corresponding to the column is set according to the area of the data contained in each cell in the column, the target column width parameter and the first magnification. 8 . Wide objective function, including: 将以下公式设置为所述列对应的列宽目标函数:Set the following formula as the column width objective function corresponding to the column:
Figure FDA0003320035890000031
Figure FDA0003320035890000031
其中,f(x)表示所述列对应的列宽目标函数;Wherein, f(x) represents the column width objective function corresponding to the column; si表示所述列中的第i个单元格包含的数据的面积,i=1,2,……,n,n表示所述列中的单元格数量;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; x表示所述列中的各单元格的第二目标列宽参数;x represents the second target column width parameter of each cell in the column; a1表示所述第一倍率。a 1 represents the first magnification.
8.一种表格调整装置,其特征在于,包括:8. A table adjustment device, characterized in that, comprising: 第一确定单元,用于响应于监测到表格中任一列的列宽和所述列中单元格的行高满足调整条件,基于所述列中的各单元格的行高、所述列的列宽以及第一倍率,确定所述列的第一目标列宽;a first determination unit, configured to respond to monitoring that the column width of any column in the table and the row height of the cells in the column satisfy the adjustment condition, based on the row height of each cell in the column, the column of the column width and the first magnification to determine the first target column width of the column; 第二确定单元,用于根据所述列中的各单元格包含的数据的面积和所述第一目标列宽,确定所述列中的各单元格各自对应的第一目标行高;a second determining unit, configured to 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 first target column width; 第三确定单元,用于根据所述列中的各单元格各自对应的第一目标行高以及所述列中的各单元格的行高,确定所述列中的各单元格各自对应的第二目标行高;a third determining unit, configured to determine the corresponding first target row height of 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 Two target line height; 调整单元,用于将所述列的列宽调整为所述第一目标列宽,将所述列中的各单元格的行高调整为各自对应的所述第二目标行高。An adjustment unit, 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. 9.一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7任一项所述表格调整方法的步骤。9. An electronic device, comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements any one of claims 1 to 7 when the processor executes the computer program The steps of the table adjustment method described in item . 10.一种计算机可读存储介质,其上存储有计算机程序指令,其特征在于,该计算机程序指令被处理器执行时实现权利要求1至7任一项所述表格调整方法的步骤。10 . 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 7 are implemented.
CN202111242647.1A 2021-10-25 2021-10-25 Table adjustment method, device, electronic device and storage medium Active CN114004203B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111242647.1A CN114004203B (en) 2021-10-25 2021-10-25 Table adjustment method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111242647.1A CN114004203B (en) 2021-10-25 2021-10-25 Table adjustment method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN114004203A true CN114004203A (en) 2022-02-01
CN114004203B CN114004203B (en) 2024-11-22

Family

ID=79923900

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111242647.1A Active CN114004203B (en) 2021-10-25 2021-10-25 Table adjustment method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114004203B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116341506A (en) * 2023-05-25 2023-06-27 广东杰纳医药科技有限公司 Method for iteratively calculating column width of table

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090083614A1 (en) * 2007-09-26 2009-03-26 Xerox Corporation System and method for optimizing information display in spreadsheets and tables
JP2015170011A (en) * 2014-03-05 2015-09-28 日本電気株式会社 Table layout generator
CN111191162A (en) * 2019-11-05 2020-05-22 腾讯科技(深圳)有限公司 Data processing method and equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090083614A1 (en) * 2007-09-26 2009-03-26 Xerox Corporation System and method for optimizing information display in spreadsheets and tables
JP2015170011A (en) * 2014-03-05 2015-09-28 日本電気株式会社 Table layout generator
CN111191162A (en) * 2019-11-05 2020-05-22 腾讯科技(深圳)有限公司 Data processing method and equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116341506A (en) * 2023-05-25 2023-06-27 广东杰纳医药科技有限公司 Method for iteratively calculating column width of table
CN116341506B (en) * 2023-05-25 2023-08-25 广东杰纳医药科技有限公司 Method for iteratively calculating column width of table

Also Published As

Publication number Publication date
CN114004203B (en) 2024-11-22

Similar Documents

Publication Publication Date Title
US8255789B2 (en) Providing spreadsheet features
WO2021068331A1 (en) Web page adaptive layout method, server and computer-readable storage medium
CN111984351A (en) Page adaptation method, electronic device, and computer-readable storage medium
CN111240557A (en) Page display method, device and equipment
CN112256383A (en) Method, device, equipment and medium for adjusting CPU core number of virtual machine
CN106791283A (en) A kind of method for correcting video flashes, device and video equipment
CN111062884A (en) An image enhancement method, apparatus, storage medium and terminal device
CN108377421B (en) Video playing method, display device and computer readable storage medium
CN114004203A (en) A form adjustment method, device, electronic device and storage medium
US12511047B2 (en) Method and apparatus for adjusting random write performance, electronic device, and storage medium
DE112017007318B4 (en) STORAGE MANAGEMENT SYSTEM, INFORMATION PROCESSING DEVICE AND STORAGE MANAGEMENT METHOD
CN109359255B (en) Form data display method and terminal equipment
CN113689364B (en) Image processing method and device
CN111444452A (en) Conversion method, device and storage medium of webpage
US20160140102A1 (en) Quality distributions for automated document
Sun et al. An improved cuckoo search algorithm for multi-level gray-scale image thresholding
CN117094816B (en) Enterprise financial assessment method and system based on big data
CN118675707A (en) Modeling method, monitoring method and system for monitoring model of cognitive training process
US20140280719A1 (en) System and method for dynamically loading a webpage
CN106846341B (en) Method and device for determining growth threshold of point cloud region of complex outer plate of hull
CN116661856A (en) Data stitching system of EDA software
CN107807755B (en) Adjust the method and device of touch-control block size on display panel
CN112231545B (en) Method, device, equipment and storage medium for ordering aggregation set
CN114782258A (en) Adaptive sharpening overshoot control method and device for image
CN117674330A (en) Charge and discharge current information adjustment method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant