Table adjustment method and device
By identifying and classifying table cell structure categories and automatically adjusting merged and separate areas in a spreadsheet, the problem of unreasonable table adjustment in the prior art is solved, and the efficiency and readability of table adjustment are improved.
Patent Information
- Application Number
- CN202111350764.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2041-11-15
AI Technical Summary
The automatic adjustment function of existing spreadsheet software cannot effectively handle the situation where the content in the table is uneven, resulting in unreasonable adjustment of row height or column width, affecting readability, and users need to perform repeated operations to achieve the ideal table format, which is inefficient.
By identifying the cell structure categories in the table, dividing the adjustment areas into merged and separate adjustment areas, and automatically adjusting the column width and row height for different areas, combined with the pre-trained table structure recognition model, the adjustment strategy is optimized to reduce user operations.
The efficiency of table adjustment is improved, the complexity of user operation is reduced, the readability and consistency of the adjusted table are ensured, and the problem of unreasonable adjustment in the prior art is avoided.
Smart Images

Figure CN114201946B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a table adjustment method and device. Background Art
[0002] Spreadsheet software is a commonly used software in daily office work. Users can use spreadsheet software to create spreadsheets in various formats (hereinafter referred to as spreadsheets for convenience) to record information, statistics, etc.
[0003] In the prior art, in order to meet the personalized needs of users when making tables, so that the content in the table will not be blocked and is easy to read, spreadsheet software provides a variety of table adjustment functions, and users can adjust the structure and style of the table to the style they need.
[0004] To further improve the efficiency of spreadsheet software, current spreadsheet software also provides corresponding automatic adjustment functions for some table adjustment functions, such as automatic adjustment of row height, automatic adjustment of column width, automatic line wrapping, etc.
[0005] However, the automatic adjustment function is generally based on fixed rules, applying a certain cell in the table to other cells, and the adjustment results are often unsatisfactory. For example, the automatic adjustment of row height will reuse the maximum row height of each cell in the currently selected area in the selected area, resulting in some rows being too high, and the content in the table being scattered and inconvenient to read. In addition, since the table has a relatively rich adjustment function, users need to repeatedly call different adjustment functions to adjust the table, which is time-consuming and labor-intensive. The above problems make it difficult to further improve the efficiency of table use. Summary of the Invention
[0006] The embodiments of this specification provide a table adjustment method and device to partially solve the problems existing in the above-mentioned prior art.
[0007] The embodiments of this specification adopt the following technical solutions:
[0008] This manual provides a table adjustment method, including:
[0009] Determining a table to be adjusted and a table structure category of each cell in the table to be adjusted;
[0010] Determining a merged adjustment region and a separate adjustment region in the table to be adjusted according to a position of each cell in the table to be adjusted and a table structure category of each cell;
[0011] Adjust the cells belonging to the individual adjustment area and the cells belonging to the combined adjustment area in the table to be adjusted respectively, and determine the adjustment results;
[0012] According to the adjustment results, determine the table in which the adjustment is completed.
[0013] Optionally, determining the table structure category of the table to be adjusted and each cell in the table to be adjusted includes:
[0014] Determine the worksheet;
[0015] Inputting the worksheet into a pre-trained table structure recognition model to determine a recognition result;
[0016] According to the recognition result, determining at least one table as a table to be adjusted;
[0017] According to the recognition result, the table structure category of each cell in the table to be adjusted is determined.
[0018] Optionally, the worksheet is input into a pre-trained table structure recognition model, and at least one table is determined as a table to be adjusted based on the recognition result; and the table structure category of each cell in the table to be adjusted is determined based on the recognition result, specifically including:
[0019] Determine the worksheet dynamic link library file;
[0020] Determine the parameters of the worksheet according to the dynamic link library file, and input the pre-trained table structure recognition model;
[0021] Performing file parsing on the recognition result output by the table structure recognition model to determine at least one table to be adjusted;
[0022] File parsing is performed on the recognition result output by the table structure recognition model to determine the table structure category of each cell in the table to be adjusted.
[0023] Optionally, determining the table structure category of the table to be adjusted and each cell in the table to be adjusted includes:
[0024] Determine a worksheet and a selected area in the worksheet;
[0025] Inputting the worksheet containing the selected area into a pre-trained table structure recognition model to determine a recognition result;
[0026] According to the recognition result, at least a table corresponding to the selected area is determined as a table to be adjusted;
[0027] According to the recognition result, the table structure category of each cell in the table to be adjusted is determined based on the recognition result.
[0028] Optionally, determining the merged adjustment area and the individual adjustment area in the table to be adjusted according to the position of each cell in the table to be adjusted and the table structure category of each cell includes:
[0029] According to the position of each cell in the table to be adjusted and the table structure category of each cell, determining the area corresponding to each adjacent cell belonging to a preset table structure category as a merged adjustment area;
[0030] Determine other areas in the table to be adjusted that do not belong to the combined adjustment area as separate adjustment areas;
[0031] The preset table structure categories at least include categories related to titles.
[0032] Optionally, the method further includes:
[0033] Adjusting the range of each combined adjustment area according to the individual adjustment areas, and / or;
[0034] Adjust the range of the merged adjustment area based on the range of cells in different table categories in the merged adjustment area.
[0035] Optionally, before adjusting the cells in the table to be adjusted that belong to the individual adjustment area and the cells in the combined adjustment area, the method further includes:
[0036] The table to be adjusted is initialized according to each table structure category.
[0037] Optionally, initializing the table to be adjusted according to each table structure category and determining the initialized table includes:
[0038] Treat each merged adjustment area as a cell, and initialize and adjust the content style and format style of each cell in each merged adjustment area according to the table structure category corresponding to each merged adjustment area;
[0039] According to the table structure category of each cell in the separate adjustment area, the content style and format style of each cell are respectively initialized and adjusted.
[0040] Optionally, adjusting cells belonging to the individual adjustment area and cells belonging to the combined adjustment area in the table to be adjusted respectively to determine adjustment results includes:
[0041] Performing a first adjustment on the cells in the separate adjustment area according to the contents of the cells in the table to be adjusted that belong to the separate adjustment area;
[0042] performing a second adjustment on the cells in the merged adjustment area according to the contents of the cells in the table to be adjusted that belong to the merged adjustment area;
[0043] The first adjustment and the second adjustment each include at least one of column width adjustment and row height adjustment.
[0044] Optionally, performing a first adjustment on the cells in the independent adjustment area according to the contents of the cells in the table to be adjusted that belong to the independent adjustment area includes:
[0045] Determine the width of each column in each separately adjusted area according to the content of each cell in each separately adjusted area;
[0046] Adjusting the width of the corresponding columns in the table to be adjusted according to the determined width of each column;
[0047] Determining the row height of each row in each separate adjustment area according to the determined column widths, the adjustment strategy, and the content of each cell in each separate adjustment area;
[0048] According to the determined row heights of the rows, the row heights of the corresponding rows in the table to be adjusted are adjusted.
[0049] Optionally, performing a second adjustment on the cells in the merged adjustment area according to the contents of the cells in the merged adjustment area in the table to be adjusted includes:
[0050] According to the merged adjustment areas in the table to be adjusted, the merging method of each merged adjustment area, and the content of each cell in each merged adjustment area, respectively adjust the column width of each merged adjustment area;
[0051] Based on the adjusted column width, adjust the row height of each merged adjustment area separately.
[0052] Optionally, determining an adjusted table according to the adjustment results of the first adjustment and the second adjustment specifically includes:
[0053] The adjusted table is determined based on the positional relationship between the individual adjustment area and the combined adjustment area in the table to be adjusted, the cells of the individual adjustment area obtained after the first adjustment, and the cells of the combined adjustment area obtained after the second adjustment.
[0054] This specification provides a table adjustment device, including:
[0055] An adjustment region determination module determines a table to be adjusted and a table structure category of each cell in the table to be adjusted;
[0056] a table partitioning module, which determines a merged adjustment area and a separate adjustment area in the table to be adjusted according to the position of each cell in the table to be adjusted and the table structure category of each cell;
[0057] An adjustment module adjusts cells belonging to the individual adjustment area and cells belonging to the combined adjustment area in the initialization table respectively, and determines adjustment results;
[0058] Determine the module and determine the adjusted table based on the adjustment results.
[0059] This specification provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above table adjustment method is implemented.
[0060] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the above table adjustment method is implemented.
[0061] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0062] First, in response to the user's table adjustment request, the table to be adjusted and the table structure category of each cell in the table to be adjusted can be determined. Then, according to the position of the cells of each table structure category in the table to be adjusted, the merged adjustment area and the individual adjustment area are determined, and the column width and row height of the cells in the individual adjustment area are adjusted respectively, and the column width and row height of the cells in the merged processing area are adjusted. Finally, based on the adjustment results, the adjusted table is determined. It can be seen that in the method provided by the present application, the user does not need to repeatedly adjust each cell. By identifying the table to be adjusted, the area where the cells suitable for merging and processing are located, and the area where the cells suitable for independent processing are located in the table to be adjusted are determined, and the column width and row height are adjusted in turn to obtain the adjusted table. The workload of the user in adjusting the table is reduced and the efficiency of using the table is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The exemplary embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation of this specification. In the drawings:
[0064] Figure 1 A flowchart of a table adjustment method provided in an embodiment of this specification;
[0065] Figure 2a and 2b Schematic diagram of the table structure category of the cell provided in the embodiment of this specification
[0066] Figure 3 Schematic diagram of the entry for the form adjustment request provided for this specification;
[0067] Figure 4 Schematic diagram of the combined adjustment area and the separate adjustment area provided in this manual;
[0068] Figure 5 Schematic diagram for adjusting the scope of the merged adjustment area provided in this manual
[0069] Figure 6 A schematic diagram of the selection interface provided for this manual;
[0070] Figure 7 A schematic diagram of a table adjustment device provided in an embodiment of this specification;
[0071] Figure 8 The embodiments of this specification provide corresponding Figure 1 Schematic diagram of the structure of the electronic equipment. DETAILED DESCRIPTION
[0072] To make the objectives, technical solutions, and advantages of this specification more clear, the following will clearly and completely describe the technical solutions of this specification in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this specification.
[0073] The technical solutions provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0074] In general, existing table adjustment methods include: manual adjustment and adjustment through the automatic adjustment function provided by the software. The former requires the user to adjust the rows, columns or individual cells that need to be adjusted one by one. Whether entering a value or manually dragging, multiple operations need to be repeated, and it is easy to make inconsistent adjustments. For example, there are differences in row heights and column widths between several rows of a table. The latter is usually only for a single column or a single row, and adjusts the entire column or row based on the format of a cell in the column or row. The adjustment method is relatively simple and rigid. Alternatively, the user is required to adjust a cell, column or row in advance, and then reuse the format of the cell, column or row to other selected columns. The user still needs to operate multiple times, so the table adjustment efficiency is still low.
[0075] Furthermore, as mentioned above, the auto-adjustment function is relatively simple and rigid. When the content of cells in the adjusted column is unevenly distributed, the adjusted table may have excessive white space in the cells, which can affect readability. For example, if one cell contains a lot of text, while the rest of the cells contain less text, adjusting the row height or column width will result in a large amount of white space in the cells with less text.
[0076] Furthermore, when exporting existing tables or partial cells to a new worksheet, the original table style is not retained, resulting in poor readability when copying or exporting the table. This means that after copying or exporting, manual adjustments to the table are still required. This means that users may need to make multiple adjustments to the same content, making it difficult to improve table efficiency.
[0077] In order to avoid problems existing in table adjustment in the prior art, this specification provides a table adjustment method.
[0078] Figure 1 The flowchart of the table adjustment method provided in the embodiment of this specification includes:
[0079] S100: Determine a table to be adjusted and a table structure category of each cell in the table to be adjusted.
[0080] In one or more embodiments provided in this specification, the user's adjustment of the table is usually based on the following two reasons: one is the table structure corresponding to the cells in the table. For example, the adjustment of the title part and the adjustment of the content part in the table are usually different. The title needs to be prominent and the font size is larger, and the cell size needs to match the size of the content area. The second is the content distribution of each cell in the row and column of the table where the cells with the same content are located. For example, for the content area in the table, for each row, the row height of the changed row is determined according to the amount of content in each cell in the row, whether there is a line break, etc. It can be seen that the table adjustment not only needs to take into account the content in the cell, but also needs to consider whether the cell is a title or content in the table.
[0081] Therefore, in order to reduce the operations required by users when adjusting a table, in the embodiments of this specification, it is also necessary to first determine the table structure of the table to be adjusted, so as to adjust the entire table based on the table structure and the content in each cell, thereby reducing the complexity of user operations while ensuring the effect of table adjustment and avoiding the defects of the existing automatic adjustment function.
[0082] Specifically, the table adjustment method provided in this specification can be executed by a terminal, specifically by software installed in the terminal that can open a corresponding table format. This software can be spreadsheet software, a plug-in software attached to the spreadsheet software, or software code embedded in the spreadsheet software, and this specification does not limit this. For ease of description, the spreadsheet software is used as an example to illustrate the table adjustment process.
[0083] First, due to the table adjustment process provided in this specification, the spreadsheet software can determine the currently displayed worksheet (ie, sheet) in response to the user's table adjustment request when opening any table.
[0084] Afterwards, the spreadsheet software can use the entire worksheet as input and input the pre-trained table structure recognition model to obtain the recognition result output by the table recognition model. The recognition result may include the range corresponding to the table in the worksheet and the table structure category of each cell in the table. In the embodiment provided in this specification, the table structure category may include at least: main title, subtitle, row title, supplementary information, content and other categories, such as Figure 2a and Figure 2b shown.
[0085] Figure 2a and Figure 2b A schematic diagram of the table structure category of a cell provided in an embodiment of this specification.
[0086] Among them, the main title is the overall title of the entire table, which generally corresponds to all rows and columns in the entire table. Supplementary information is usually the cell for editing notes under the main title. Row titles are also commonly called table headers. Generally, table headers only correspond to some columns or some rows, or some rows and columns in the table. Subtitles generally correspond to all columns and some rows in the table, or all rows and some columns. Generally speaking, the tables corresponding to the subtitles are consistent in structure, and the tables corresponding to the subtitles are combined to form the entire table corresponding to the main title. The cells corresponding to the content are generally the cells in the table where the data content is specifically edited.
[0087] In addition, since multiple independent tables can be edited in a worksheet, if the currently displayed worksheet contains multiple tables, the table structure recognition model can also output the range corresponding to each table and the table structure category of each cell in each table, so that users can determine the tables that need to be adjusted and avoid adjusting tables that do not need adjustment, thereby improving efficiency.
[0088] To facilitate subsequent description, this specification first describes an embodiment in which the worksheet contains only one table, and then provides supplementary descriptions of other situations.
[0089] Therefore, the spreadsheet software can determine at least one table based on the recognition results output by the table structure recognition model and use the table as the table to be adjusted. At the same time, the recognition results of the table structure recognition model also include the table structure category of each cell in the table to be adjusted.
[0090] Figure 3 Schematic diagram of the entry for the form adjustment request provided for this manual. Figure 3 It can be seen that there is a table (i.e., the shaded area) in the worksheet currently displayed in the spreadsheet software. The user calls up a menu bar in the worksheet. The menu bar contains a button "Table Adjustment" corresponding to the entry for the table adjustment request. When the spreadsheet software detects that the user operates the button, it receives the table adjustment request initiated by the user and executes step S100 and subsequent steps in response to the request.
[0091] It should be noted that Figure 3 This is only a schematic diagram of one case of the entry for the form adjustment request. The entry can also be set in the menu bar of the spreadsheet software, or in other function pop-up windows, such as the print pop-up window, the save as pop-up window, etc. The entry can be set as needed and is not limited in this specification.
[0092] S102: Determine a merged adjustment region and a separate adjustment region in the table to be adjusted according to a position of each cell in the table to be adjusted and a table structure type of each cell.
[0093] In one or more embodiments provided in this specification, the separately adjusted area is the "content" area in the table, which is generally more complex, that is, the possibility of large differences in the contents of different cells is higher, such as the area where the information of various types of orders in the order table is located, and the area where the information of various users in the list table is located. In contrast, the cells of table structure categories such as headlines, subtitles, and row titles are relatively small in number and are also affected by the size of the cells in the separately adjusted area. Therefore, in order to obtain a better adjustment effect, this specification can adjust the cells of different table structure categories separately.
[0094] Specifically, after determining the table structure category of each cell in the table to be adjusted, the table structure category and the positional relationship of each cell can be used to determine the areas in the table to be adjusted that can be merged and adjusted as a single cell, i.e., the merged adjustment area. Also, areas that are not suitable for merged adjustment, i.e., the individual adjustment area, can be determined. An individual adjustment area indicates that each cell within the area is not suitable for adjustment as a single cell with surrounding cells.
[0095] First, in this manual, the spreadsheet software can determine, for each preset table structure category, the areas corresponding to the adjacent cells belonging to the preset table structure category according to the positions of the cells in the table to be adjusted and the table structure category of each cell, and use the determined areas as a merged adjustment area.
[0096] In particular, since the structure of the title bar in a general table is relatively uniform for purposes such as improving user readability and highlighting, the table structure categories related to the title and the areas corresponding to adjacent cells can be used as merged adjustment areas. In this specification, the preset table structure categories include at least categories related to the title. For example, the preset table structure categories may include: main title, subtitle, row title, etc.
[0097] Of course, the preset table category can be one or more. Furthermore, if the information recorded by the cells belonging to the table structure category of the content category in the table is relatively uniform, the preset table category can also include the table structure category of the content category. Specifically, what other preset table structure categories can be included, and what specific preset table categories are, can be set as needed, and this specification does not impose any restrictions.
[0098] Secondly, other areas in the table to be adjusted that do not belong to the merged adjustment area are determined as separate adjustment areas. Of course, it should be noted that in this specification, since the merged adjustment area in the table is composed of cells that belong to the same category and are adjacent, cells of the same category may also fall into different merged adjustment areas if they are not adjacent. Therefore, multiple merged adjustment areas may be determined from the table to be adjusted, and each merged adjustment area may be of a different category or non-adjacent. Furthermore, the separate adjustment area may also be multiple independent and non-adjacent areas, which are "divided" by the merged adjustment area.
[0099] Figure 4 This is a diagram of the merged adjustment areas and individual adjustment areas provided in this manual. Areas filled with patterns are merged adjustment areas, with different patterns representing different table structure types. Areas not filled with patterns are individual adjustment areas. It can be seen that the merged adjustment area filled with vertical lines and the merged adjustment area filled with diagonal lines are divided into two different merged adjustment areas, and the merged adjustment area filled with two diagonal lines "divides" the individual adjustment area into two.
[0100] In addition, since generally for tables, the areas corresponding to the category cells related to the title and the areas corresponding to the other category cells should correspond in terms of overall size, that is to say, a table is usually a regular rectangle. On the one hand, the rectangular table conforms to the user's habit of browsing tables, and on the other hand, the "correspondence" between the title and the content can also avoid ambiguity when the user browses the table. Therefore, the total width of the merged adjustment area should match the total width of the individual adjustment area, so the spreadsheet software can also adjust the range of each merged adjustment area according to the determined size of the individual adjustment area. Since the subsequent steps will be affected by the range of various adjustment areas when performing the first adjustment or the second adjustment, in order to avoid errors in the subsequent adjustments due to inconsistent ranges of the adjustment areas, or the adjustment effect cannot achieve the expected problem. In this manual, the spreadsheet software can also adjust the range of the merged adjustment area and the individual adjustment area after determining them.
[0101] Figure 5 A schematic diagram for adjusting the range of the merged adjustment area provided in this manual, in which the number (or width) of cells corresponding to the visible title is inconsistent with the merged adjustment area corresponding to the row title below and the separate adjustment area corresponding to the content. In this case, the range of the cells corresponding to the title can be adjusted to obtain the table on the right side of the arrow.
[0102] It can be seen that the adjustment of the merge adjustment area range can also include merging the originally "empty" cells. Specifically, when the range of the merge adjustment area is expanded, the spreadsheet software can determine whether the cells in the expanded area contain content. If not, the range is adjusted, otherwise the range is not adjusted. For example, Figure 5 For example, if the cells in the expanded range contain supplementary information such as "Remarks", the range does not need to be expanded.
[0103] Furthermore, in one or more embodiments provided in this specification, the spreadsheet software, in addition to adjusting the range of adjacent merged adjustment areas according to the range of individual adjustment areas, can also adjust the range of the merged adjustment area according to the range of cells of different table categories in the merged adjustment area.
[0104] Taking the merged adjustment area as the area where the title-related cells are located as an example, specifically, in this manual, after adjusting the range of the merged adjustment area according to separate adjustments, it is also possible to determine whether the ranges of the cells of each table category in the merged adjustment area are consistent for the merged adjustment containing more than two table category cells. If not, the maximum width is determined based on the width of the corresponding range of cells of each table category in the merged adjustment area, and the corresponding ranges of cells of other table categories in the merged adjustment area are adjusted based on the maximum width to make the widths of cells of each table category in the merged adjustment area consistent.
[0105] For example, if the merged adjustment area is the area containing header-related cells, and cells of different header categories are typically not located in the same row, only the width adjustment can be performed. If cells of different table categories within the merged adjustment area are located in the same row, the height adjustment range can also be performed.
[0106] S104: Adjust the cells in the table to be adjusted that belong to the individual adjustment area and the cells in the combined adjustment area respectively, and determine the adjustment results.
[0107] In one or more embodiments provided in this specification, step S102 belongs to the division of the table to be adjusted. Since the separate adjustment area is the area where the "content" in the table is located, it is generally more complex, that is, there is a higher possibility that the contents of different cells are very different, such as the area where the information of various types of orders in the order table is located, and the area where the information of various users in the list table is located. In contrast, cells of table structure categories such as headlines, subtitles, and row titles are relatively small in number and are also affected by the size of cells in the separate adjustment area. Therefore, in order to obtain a better adjustment effect, the spreadsheet software in this specification can first adjust the separate adjustment area, and then adjust the merged adjustment area.
[0108] Specifically, as previously mentioned, since the size of cells in areas suitable for merged adjustment, such as titles, should be adjusted in conjunction with the size of cells in the content area suitable for individual adjustment, the spreadsheet software can, based on the adjustment strategy and the content of each cell in the table to be adjusted, first perform a first adjustment on each cell in each individual adjustment area, and then perform a second adjustment on each cell in each merged adjustment area. Furthermore, if row height and column width need to be adjusted, both the first and second adjustments involve adjusting the column width first, followed by adjusting the row height. Since cell content can wrap, the row height of a cell is affected by the column width, text content, and line wrapping, while the column width of a cell is affected by the number of cells in a row and the total width of the table. As can be seen, among the variables affecting the column width of a cell, the number of cells is fixed, while the total width of the table is adjustable. Therefore, prioritizing the column width adjustment reduces the difficulty of adjustment and avoids repeated adjustments. For example, if the row height is adjusted first and then the column width is adjusted later, the previously adjusted row height may become inappropriate, requiring repeated adjustments.
[0109] Furthermore, because the content of cells in different table types varies significantly, and the adjustment requirements for merged adjustment areas determined based on the table type differ from those for individual adjustment areas, one or more embodiments provided herein employ different adjustment methods for individual adjustment areas than for merged adjustment areas. Specifically, a first adjustment is performed on cells in individual adjustment areas, while a second adjustment is performed on cells in merged adjustment areas.
[0110] When adjusting cells in a separate adjustment area, the spreadsheet software determines the column widths of each column in the separate adjustment area based on the adjustment policy and the contents of each cell in the separate adjustment area. Column widths and row heights are adjusted from left to right and from top to bottom.
[0111] Specifically, taking the adjustment of column width and row height for each determined adjustment area as an example, the spreadsheet software performs a first adjustment on any individual adjustment area, first:
[0112] For each column, the maximum column width can be determined based on the maximum width of the text line in each cell in the column. Then, a consensus is calculated based on the margin width corresponding to the adjustment strategy to determine the expected column width corresponding to the maximum column width. Then, based on the expected column width corresponding to the table structure category included in the adjustment strategy, it is determined whether the expected column width is greater than the expected column width corresponding to the table structure category of the column cell. If so, the column width of the column cell is adjusted according to the expected column width. If not, the column width of the column cell is adjusted according to the expected column width. The margin width is positively correlated with the maximum column width.
[0113] Secondly:
[0114] For each row, the expected row height of each cell is determined based on the expected column width of the column corresponding to each cell in the row, the row width of each text line in the cell, the number of text lines, and the row height of a single row. The adjusted row height of the row is determined based on the maximum expected row height of each cell and the margin spacing corresponding to the adjustment strategy. The margin spacing is positively correlated with the maximum expected row height. The margin spacing is positively correlated with the expected column width.
[0115] The column width adjustment can be considered as adjusting the width of the entire column in the table to be adjusted based on the determined width of each column. Similarly, the row height adjustment can be considered as adjusting the height of the entire row in the table to be adjusted based on the determined height of each row.
[0116] Then:
[0117] After determining the row height and column width of each individual adjustment area, a second adjustment can be performed on each non-adjacent merged adjustment area, and the column width of the merged adjustment area can be adjusted according to the merging method of the merged adjustment area and the content of each cell in the merged adjustment area.
[0118] Finally, based on the adjusted column width, continue to adjust the row height of the merged adjustment area.
[0119] Merge methods include: horizontal merging (merging multiple columns with only one row), vertical merging (merging multiple rows with only one column), and multi-dimensional merging (merging multiple rows and multiple columns). Corresponding to different merging methods, the adjustment strategy can set different column width adjustment and row height adjustment methods. As long as the size of the adjusted merged adjustment area matches the size of the adjacent individual adjustment areas, the adjustment is still performed by adjusting the column width first and then the row height.
[0120] Of course, it should be noted that whether to adjust both row height and column width for each individual adjustment area and each merged adjustment area can be set as needed and implemented by setting different adjustment strategies. For example, in the merged adjustment area of the table structure belonging to the large title, since there is usually only one line of text, row height is rarely an issue, so only column width can be adjusted.
[0121] S108: Determine the adjusted table according to the adjustment result.
[0122] In one or more embodiments provided in this specification, the column width adjustment and row height adjustment of the individual adjustment areas in the table to be adjusted are completed in sequence, and then the column width adjustment and row height adjustment of the combined adjustment area are completed, and the table can be determined as the adjusted table based on the adjustment results.
[0123] Specifically, in one or more embodiments provided in this specification, since the individual adjustment areas and the combined adjustment areas in the table to be adjusted are respectively adjusted first and second in sequence, when determining the adjusted table, the spreadsheet software can also splice the adjustment results corresponding to the individual adjustment areas obtained by the first adjustment and the adjustment results corresponding to the combined adjustment areas obtained by the second adjustment based on the positional relationship between the individual adjustment areas and the combined adjustment areas in the table to be adjusted, to determine the adjusted table. Figure 4 For example, in order from top to bottom, the spreadsheet software can determine the merged adjustment area corresponding to the vertical and diagonal line filling area above the table to be adjusted, the adjustment result after the second adjustment, the separate adjustment area corresponding to the blank filling area in the middle of the table to be adjusted, the adjustment result after the first adjustment, the merged adjustment area corresponding to the diagonal line filling area in the middle of the table to be adjusted, the adjustment result after the second adjustment, and the separate adjustment area corresponding to the blank filling area below the table to be adjusted, and the adjustment result after the first adjustment, and the four adjustment results are spliced in order from top to bottom to determine the adjusted table.
[0124] based on Figure 1 The table adjustment method shown here first responds to a user's table adjustment request and determines the table structure category of the table to be adjusted and each cell in the table to be adjusted. It then determines the merged adjustment area and the individual adjustment areas based on the position of the cells of each table structure category in the table to be adjusted. It then adjusts the column width and row height of the cells in the individual adjustment areas, and adjusts the column width and row height of the cells in the merged area. Finally, based on the adjustment results, it determines the adjusted table.
[0125] As can be seen, in the method provided by this application, users do not need to repeatedly adjust each cell. In response to the user's request, the method identifies the table to be adjusted, determines the area of cells suitable for merging and processing, and the area of cells suitable for independent processing in the table to be adjusted, and further adjusts the column widths and row heights in sequence according to the adjustment strategy to obtain the adjusted table. This reduces the user's workload in adjusting the table and improves the efficiency of table use.
[0126] In addition, in one or more embodiments of the present specification, since the cells in the table to be adjusted usually have their contents edited and their styles set, under the premise that the cells can display the entire content, the sizes of the required cells may not be completely consistent due to differences in font styles, character spacing, different word counts, etc. Therefore, in order to make the effect of the adjusted table uniform and avoid the current table style of the table to be adjusted from having an adverse effect on the subsequent adjustment of the table, before adjusting the table to be adjusted in step S104, the spreadsheet software can also initialize the table to be adjusted according to each table structure category to obtain an initialized table, and make adjustments based on the initialized table in subsequent steps.
[0127] Specifically, the electronic spreadsheet software in this specification can initialize the table to be adjusted based on preset initialization rules of each table structure category to determine the initialization table.
[0128] In this manual, different initialization rules can be preset for different table structure categories, and for each merged adjustment area, the merged adjustment area is treated as a cell, and the content style and format style of each cell in the merged adjustment area are initialized according to the initialization rules of the table structure category corresponding to the merged adjustment area.
[0129] For each separate adjustment area, the spreadsheet software can initialize the content style and format style of each cell in the separate adjustment area according to the initialization rule of the table structure category of the cell.
[0130] As can be seen, the initialization rules in this specification include at least initialization adjustments to the content style and format style. Content style initialization includes character adjustments, such as font, size, font style, and character spacing. Format style adjustments can include adjustments to indentation, alignment, paragraph spacing, and other formats. Of course, the specific adjustments can be set as needed and are not limited by this specification.
[0131] In one or more embodiments provided herein, when recognizing a table to be adjusted, using image processing can lead to problems such as difficulty in accurately determining cell sizes and the recognition results being easily affected by the cell content, resulting in inaccurate recognition results. Furthermore, recognizing each cell in the table one by one can lead to low recognition efficiency and slow recognition speed.
[0132] Therefore, in one or more embodiments of the present specification, when determining the recognition result in step S100, the spreadsheet software may first determine the dynamic link library (DLL) file of the worksheet that needs to be called when calling or loading the worksheet. Of course, the DLL content required when loading a worksheet may vary depending on the spreadsheet software, but at least all of them contain data corresponding to the content of the worksheet, such as the worksheet parent object, cell object collection, cell size, cell border style, border color, cell object class, etc.
[0133] Therefore, no matter what kind of spreadsheet software is used, as long as the corresponding DLL file is obtained, the spreadsheet software can further determine the relevant parameters of the worksheet, that is, the parameters that characterize the table contained in the worksheet. This avoids the problems caused by image recognition or cell content recognition one by one.
[0134] Afterwards, the determined worksheet parameters can be used as input to a pre-trained table structure recognition model to obtain the recognition results output by the model. To avoid format compatibility issues with the output results, in one or more embodiments of this specification, the output results can be in a universal compatible data format, such as the common JavaScript Object Notation (JSON) data format. This allows the spreadsheet software to parse the recognition results output by the model in a synchronous environment.
[0135] The spreadsheet software can then perform file parsing on the recognition results, such as parsing a JSON file, to determine at least one table as the table to be adjusted, as well as the table structure category of each cell in the table to be adjusted. The parsed table to be adjusted includes at least the following: row start, row end, column start, and column end. That is, based on the parsed content, the range of the table to be adjusted can be determined. The table structure category of the cells in the table to be adjusted is determined based on the structural information corresponding to each row in the table to be adjusted in the recognition results.
[0136] Furthermore, in the above embodiments described in step S100, the description is based on an embodiment in which a worksheet contains only one table. However, when the worksheet contains multiple tables, in step S100, the spreadsheet software, in response to the user's table adjustment request, determines the currently displayed worksheet and inputs it into the table structure recognition model. Then, based on the recognition results output by the table structure recognition model, multiple tables can be determined.
[0137] The electronic spreadsheet software may display a selection interface including the identified tables, so that the user can select the table to be adjusted through the selection interface.
[0138] Therefore, when the spreadsheet software detects a selection operation by the user, it can determine, in response to the selection operation, the table selected by the user from the displayed tables as the table to be adjusted.
[0139] Figure 6 This is a diagram of the selection interface provided for this manual. The background is a worksheet, which contains three tables, each represented by a different fill pattern. The left side of the selection interface displays the identified tables and all tables corresponding to the worksheet as options, while the right side of the interface displays the currently selected table.
[0140] Among them, the order of arrangement and display in the selection interface can be set as needed. For example, the option containing all tables can be placed first, and the remaining tables can be arranged and displayed in order from top to bottom and from left to right according to their position in the worksheet.
[0141] Furthermore, since users may need to adjust only part of the area in the table, for example, only a part of the area in the table is difficult to browse, or text is blocked, or the characters are too small to be recognized, users can only select the area that needs to be adjusted.
[0142] Specifically, the spreadsheet software determines the user-selected area in the currently displayed worksheet based on the detected user selection operation, and then, in response to the user's table adjustment request, inputs the worksheet containing the selected area into a pre-trained table structure recognition model, and determines the table corresponding to the selected area and each table in the currently displayed worksheet based on the recognition result.
[0143] Then, the spreadsheet software displays a selection interface, which includes: a table corresponding to the selected area, each table in the worksheet, and the sum of each table, so that the user can select the table to be adjusted through the selection interface.
[0144] Finally, the table to be adjusted is determined based on the detected user selection operation.
[0145] The above are multiple embodiments of determining the table to be adjusted provided in this specification. That is to say, when the user initiates a request to adjust the table, as long as the currently displayed worksheet contains at least one table, the spreadsheet software can display the candidate adjustable tables through the display selection interface to determine the table to be adjusted based on the user's selection operation.
[0146] When the user has selected an area in the currently displayed worksheet, it is highly likely that the area is the table area that the user wants to adjust. Therefore, the table corresponding to the selected area may also be included in the selection interface as a candidate item.
[0147] Alternatively, in another embodiment provided in the present specification, when the user has selected an area in the currently displayed worksheet, the table corresponding to the area is used as the table to be adjusted based on the recognition result.
[0148] Furthermore, in this specification, after adjusting a table to be adjusted, the spreadsheet software may also display the adjusted table. In response to a user confirmation operation, the adjusted results of each cell are applied to the table to be adjusted, thereby determining the adjusted table. In other words, the spreadsheet software may generate a copy of the table to be adjusted, perform various adjustments on the copy, and obtain the adjusted results. The result is then displayed to the user as a preview, and only upon user confirmation is the copy stored as the adjusted table.
[0149] Furthermore, when the table to be adjusted still needs to be initialized, the spreadsheet software can also generate a copy of the table to be adjusted before initializing the table to be adjusted, then initialize the copy, and then make various adjustments to obtain the adjusted result, and then display the preview result to the user, and in response to the user's confirmation operation, store the copy as the adjusted table.
[0150] Alternatively, in one or more embodiments of the present specification, the spreadsheet software may also reuse the adjusted result on the table to be adjusted in response to a confirmation operation by the user.
[0151] Based on the above embodiments, this specification also provides another table adjustment process:
[0152] S200: In response to a user's selection operation on a currently displayed worksheet, determining a user-selected area in the currently displayed worksheet;
[0153] S201: In response to the user's table adjustment request, identifying the currently displayed worksheet, and determining the table to be adjusted and the table structure category of each cell in the table to be adjusted;
[0154] S202: creating a selection interface based on the recognition result, displaying various tables as candidate items, wherein the table corresponding to the selected area is selected as one of the candidate items;
[0155] S203: In response to the user's selection operation, determining a table to be adjusted from each candidate item;
[0156] S204: Determining, based on the position of each cell in the table to be adjusted and the table structure type of each cell, a merged adjustment area and a separate adjustment area in the table to be adjusted, initializing the table to be adjusted based on initialization rules of each table structure type, and determining an initialized table;
[0157] S205: adjusting the column widths and row heights of the cells in the individual adjustment area and the cells in the combined adjustment area in the initialization table in sequence;
[0158] S206: Display according to the adjusted table;
[0159] S207: In response to the user's confirmation operation, the adjusted table is determined based on the cells in the adjusted individual adjustment area and the combined adjustment area.
[0160] based on Figure 1 The table adjustment method shown in the embodiment of this specification also provides a structural schematic diagram of a table adjustment device, such as Figure 7 shown.
[0161] Figure 7 This is a schematic diagram of the structure of a table adjustment device provided in an embodiment of this specification, the device comprising:
[0162] An adjustment region determination module 300 determines a table to be adjusted and a table structure category of each cell in the table to be adjusted;
[0163] The table division module 302 determines the merged adjustment area and the individual adjustment area in the table to be adjusted according to the position of each cell in the table to be adjusted and the table structure type of each cell;
[0164] An adjustment module 304 adjusts the cells in the table to be adjusted that belong to the individual adjustment area and the cells in the combined adjustment area, respectively, and determines an adjustment result;
[0165] The determination module 306 determines the adjusted table according to the adjustment result.
[0166] Optionally, the adjustment area determination module 300 determines a worksheet, inputs the worksheet into a pre-trained table structure recognition model, determines a recognition result, determines at least one table as a table to be adjusted based on the recognition result, and determines the table structure category of each cell in the table to be adjusted based on the recognition result.
[0167] Optionally, the adjustment area determination module 300 determines the dynamic link library file of the worksheet, determines the parameters of the worksheet based on the dynamic link library file, inputs the pre-trained table structure recognition model, performs file parsing on the recognition result output by the table structure recognition model, determines at least one table to be adjusted, performs file parsing on the recognition result output by the table structure recognition model, and determines the table structure category of each cell in the table to be adjusted.
[0168] Optionally, the adjustment area determination module 300 determines a worksheet and a selected area in the worksheet, inputs the worksheet containing the selected area into a pre-trained table structure recognition model, determines a recognition result, and based on the recognition result, determines at least a table corresponding to the selected area as the table to be adjusted, and based on the recognition result, determines the table structure category of each cell in the table to be adjusted.
[0169] Optionally, the table division module 302 determines, based on the position of each cell in the table to be adjusted and the table structure category of each cell, the areas corresponding to the adjacent cells belonging to the preset table structure category as a merged adjustment area, and determines other areas in the table to be adjusted that do not belong to the merged adjustment area as separate adjustment areas, wherein the preset table structure categories at least include categories related to titles.
[0170] Optionally, the adjustment module 304 adjusts the range of each merged adjustment area according to the individual adjustment areas, and / or adjusts the range of the merged adjustment area according to the ranges of cells of different table categories in the merged adjustment area.
[0171] Optionally, the adjusting module 304 initializes the table to be adjusted according to each table structure category before adjusting the cells belonging to the individual adjustment area and the cells belonging to the combined adjustment area in the table to be adjusted.
[0172] Optionally, the adjustment module 304 treats each merged adjustment area as a cell, and initializes the content style and format style of each cell in each merged adjustment area according to the table structure category corresponding to each merged adjustment area, and initializes the content style and format style of each cell in the separate adjustment area according to the table structure category of each cell.
[0173] Optionally, the adjustment module 304 performs a first adjustment on the cells in the separate adjustment area according to the contents of the cells in the table to be adjusted that belong to the separate adjustment area; and performs a second adjustment on the cells in the merged adjustment area according to the contents of the cells in the table to be adjusted that belong to the merged adjustment area, wherein the first adjustment and the second adjustment both include at least one of column width adjustment and row height adjustment.
[0174] Optionally, the adjustment module 304 determines the column width of each column in each separate adjustment area according to the content of each cell in each separate adjustment area, adjusts the column width of the corresponding column in the table to be adjusted according to the determined column width of each column, determines the row height of each row in each separate adjustment area according to the determined column width of each column, the adjustment strategy and the content of each cell in each separate adjustment area, and adjusts the row height of the corresponding row in the table to be adjusted according to the determined row height of each row.
[0175] Optionally, the adjustment module 304 adjusts the column width of each merged adjustment area according to the merged adjustment area in the table to be adjusted, the merging method of each merged adjustment area and the content of each cell in each merged adjustment area, and adjusts the row height of each merged adjustment area based on the adjusted column width.
[0176] Optionally, the determination module 306 determines the adjusted table based on the positional relationship between the separate adjustment area and the merged adjustment area in the table to be adjusted, the cells of the separate adjustment area obtained after the first adjustment, and the cells of the merged adjustment area obtained after the second adjustment.
[0177] This specification also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can be used to perform the table adjustment method provided above.
[0178] Based on the table adjustment method provided above, this specification embodiment also provides Figure 8 The structural diagram of the electronic device shown in FIG. Figure 8 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, memory, and non-volatile storage, and may also include other hardware required for its operations. The processor reads the corresponding computer program from the non-volatile storage into the memory and then runs it to implement the above-mentioned table adjustment method.
[0179] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0180] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0181] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0182] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0183] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0184] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0185] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes 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.
[0186] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.
[0187] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0188] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0189] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0190] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0191] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0192] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Thus, this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0193] This specification may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.
[0194] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0195] The foregoing is merely an example of the present invention and is not intended to limit the present invention. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.
Claims
1. A table adjustment method, characterized in that: include: Determining a table to be adjusted and a table structure category of each cell in the table to be adjusted; According to the position of each cell in the table to be adjusted and the table structure category of each cell, determine the areas corresponding to each adjacent cell belonging to a preset table structure category as a merged adjustment area, and determine other areas in the table to be adjusted that do not belong to the merged adjustment area as separate adjustment areas; performing a first adjustment on the cells in the individual adjustment area according to the contents of the cells in the table to be adjusted that belong to the individual adjustment area, and performing a second adjustment on the cells in the combined adjustment area according to the contents of the cells in the table to be adjusted that belong to the combined adjustment area, and determining an adjustment result; The adjusted table is determined based on the positional relationship between the individual adjustment area and the combined adjustment area in the table to be adjusted, the cells of the individual adjustment area obtained after the first adjustment, and the cells of the combined adjustment area obtained after the second adjustment.
2. The method according to claim 1, wherein Determining the table structure category of the table to be adjusted and each cell in the table to be adjusted includes: Determine the worksheet; Inputting the worksheet into a pre-trained table structure recognition model to determine a recognition result; According to the recognition result, determining at least one table as a table to be adjusted; According to the recognition result, the table structure category of each cell in the table to be adjusted is determined.
3. The method according to claim 2, wherein Inputting the worksheet into a pre-trained table structure recognition model, and determining at least one table as a table to be adjusted based on the recognition result; And, determining the table structure category of each cell in the table to be adjusted according to the recognition result, including: Determine the dynamic link library file of the worksheet; Determine the parameters of the worksheet according to the dynamic link library file, and input the pre-trained table structure recognition model; Performing file parsing on the recognition result output by the table structure recognition model to determine at least one table to be adjusted; File parsing is performed on the recognition result output by the table structure recognition model to determine the table structure category of each cell in the table to be adjusted.
4. The method according to claim 1, wherein Determining the table structure category of the table to be adjusted and each cell in the table to be adjusted includes: Determine a worksheet and a selected area in the worksheet; Inputting the worksheet containing the selected area into a pre-trained table structure recognition model to determine a recognition result; According to the recognition result, at least a table corresponding to the selected area is determined as a table to be adjusted; According to the recognition result, the table structure category of each cell in the table to be adjusted is determined based on the recognition result.
5. The method according to claim 1, wherein The preset table structure categories at least include title-related categories.
6. The method according to claim 1, wherein The method further comprises: Adjusting the range of each combined adjustment area according to the individual adjustment areas, and / or; Adjust the range of the merged adjustment area based on the range of cells in different table categories in the merged adjustment area.
7. The method according to claim 1, wherein Before adjusting the cells in the table to be adjusted, which belong to the individual adjustment area and the cells in the combined adjustment area, the method further includes: The table to be adjusted is initialized according to each table structure category.
8. The method according to claim 7, wherein Initialize the table to be adjusted according to each table structure category, including: Treat each merged adjustment area as a cell, and initialize and adjust the content style and format style of each cell in each merged adjustment area according to the table structure category corresponding to each merged adjustment area; According to the table structure category of each cell in the separate adjustment area, the content style and format style of each cell are respectively initialized and adjusted.
9. The method according to claim 1, wherein The first adjustment and the second adjustment each include at least one of column width adjustment and row height adjustment.
10. The method according to claim 9, wherein Performing a first adjustment on the cells in the separate adjustment area according to the contents of the cells in the table to be adjusted that belong to the separate adjustment area includes: Determine the width of each column in each separately adjusted area according to the content of each cell in each separately adjusted area; Adjusting the width of the corresponding columns in the table to be adjusted according to the determined width of each column; Determine the row height of each row in each separate adjustment area based on the determined column widths, adjustment strategies, and the contents of each cell in each separate adjustment area; According to the determined row heights of the rows, the row heights of the corresponding rows in the table to be adjusted are adjusted.
11. The method according to claim 9, wherein Performing a second adjustment on the cells in the merged adjustment area according to the contents of the cells in the table to be adjusted, which includes: According to the merged adjustment areas in the table to be adjusted, the merging method of each merged adjustment area, and the content of each cell in each merged adjustment area, respectively adjust the column width of each merged adjustment area; Based on the adjusted column width, adjust the row height of each merged adjustment area separately.
12. A table adjustment device, characterized in that: include: An adjustment region determination module determines a table to be adjusted and a table structure category of each cell in the table to be adjusted; a table partitioning module, which determines, based on the position of each cell in the table to be adjusted and the table structure category of each cell, areas corresponding to adjacent cells belonging to a preset table structure category as a merged adjustment area, and determines other areas in the table to be adjusted that do not belong to the merged adjustment area as separate adjustment areas; an adjustment module for adjusting cells belonging to the individual adjustment area and cells belonging to the combined adjustment area in the table to be adjusted, respectively, including: performing a first adjustment on the cells in the individual adjustment area according to the content of the cells in the individual adjustment area in the table to be adjusted, performing a second adjustment on the cells in the combined adjustment area according to the content of the cells in the combined adjustment area in the table to be adjusted, and determining an adjustment result; The determination module determines the adjusted table according to the positional relationship between the individual adjustment area and the merged adjustment area in the table to be adjusted, the cells of the individual adjustment area obtained after the first adjustment, and the cells of the merged adjustment area obtained after the second adjustment.
13. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Method and device for customizing form control, and electronic equipment
CN107066439A