Table processing method and device, electronic equipment and computer readable storage medium

By obtaining the type of the table cell range and automatically adjusting the format and standardizing the layout, the problem of cumbersome table layout operations in the existing technology is solved, and efficient and beautiful table layout processing is achieved.

CN114186542BActive Publication Date: 2026-03-17BEIJING KINGSOFT OFFICE SOFTWARE INC +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-15
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing technologies for table formatting are cumbersome, requiring users to manually adjust cell sizes and text formatting, resulting in low efficiency.

Method used

By obtaining the region type of the cell range in the table, adjusting the formatting information, and performing standardized layout processing, the format and alignment of the cell range are automatically adjusted to ensure that the data content is displayed completely.

Benefits of technology

It simplifies the user operation process, improves the efficiency and aesthetics of table layout, reduces manual adjustment steps, and enhances office efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114186542B_ABST
    Figure CN114186542B_ABST
Patent Text Reader

Abstract

The application relates to a table processing method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of computers. The method comprises the following steps: acquiring the region type of a cell region in a table; adjusting the format setting information of the cell region according to the region type; performing standardization layout processing on the cell region according to the adjustment result of the format setting information to obtain a standardized cell region corresponding to the cell region; and wherein the standardized cell region completely displays the cell content in the standardized cell region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a table processing method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] When using files containing tables, users generally have a need to optimize the table layout to make the tables more standardized and aesthetically pleasing.

[0003] Currently, formatting objects within a table requires manual user intervention. For example, adjusting cell size requires manually accessing the row height and column width settings interface and inputting the corresponding values. Similarly, adjusting text style within a cell requires manually adjusting parameters such as font size, font type, and alignment. Furthermore, adjustments to different objects can interfere with each other. For instance, adjusting the font size often necessitates adjusting the row width and column height accordingly; otherwise, a smaller font size might result in large blank areas within the cell, or a larger font size might prevent the text from displaying completely. In such cases, users must repeatedly adjust multiple objects based on their settings, a cumbersome and inefficient process that causes significant inconvenience. Summary of the Invention

[0004] One objective of this application is to provide a new technical solution for table processing, which addresses the cumbersome operation involved in formatting tables in the prior art.

[0005] According to a first aspect of this application, a table processing method is provided, comprising: obtaining the region type of a cell range in a table; adjusting the formatting information of the cell range according to the region type; performing standardized layout processing on the cell range according to the adjustment result of the formatting information to obtain a standardized cell range corresponding to the cell range; wherein the standardized cell range fully displays the data content in the standardized cell range.

[0006] Optionally, the formatting information of the cell range can be adjusted according to the range type, including: adjusting the first formatting information corresponding to the text in the cell range according to the range type; and adjusting the second formatting information of the text containing the text according to the adjustment result of the first formatting information.

[0007] Optionally, based on the adjustment results of the first format setting information, the second format setting information of the text containing the text is adjusted, including: determining the number of text lines of the text containing the text based on the adjustment results of the first format setting information; determining the horizontal alignment of the text containing the text based on the region type, the number of text lines, and the number of cells contained in the cell region; and determining the vertical alignment of the text containing the text based on the region type.

[0008] Optionally, before adjusting the formatting information of the cell range according to the region type, the table processing method further includes: determining the target region range corresponding to the cell range according to the region type; and adjusting the region range of the cell range to the target region range if the region range of the cell range is inconsistent with the target region range.

[0009] Optionally, the area type can be either a main title or a subtitle.

[0010] Optionally, after adjusting the formatting information of the cell range according to the range type, the table processing method also includes: determining whether there are abnormal characters in the text of the cell range; and replacing the abnormal characters with the corresponding standard characters if the text of the cell range contains abnormal characters.

[0011] Optionally, the abnormal character includes multiple consecutive spaces, wherein the number of spaces is greater than or equal to a preset threshold for the number of spaces; the normal character corresponding to the abnormal character includes a preset newline character.

[0012] Optionally, based on the adjustment results of the formatting information, the cell range is subjected to standardized layout processing, including: determining at least one subtext based on the adjusted target text in the cell range; wherein each subtext occupies one text line, the text arrangement direction of the target text is the first direction, and the first direction is the line direction; calculating the subtext length of each subtext to obtain at least one subtext length; obtaining the first maximum value among the at least one subtext lengths, and using the first maximum value as the first text length; and performing standardized layout processing on the cell range based on the first text length.

[0013] Optionally, the standardized layout processing of the cell range based on the first text length includes: obtaining the first text length of all cell ranges in the target column where the cell range is located, to obtain at least one first text length; obtaining the second maximum value among the at least one first text length, and using the second maximum value as the target column text length of the target column; obtaining the column width margin value and column width threshold of the cell range; summing the column width margin value and the target column text length to obtain a first summation result, and using the first summation result as the preset column width value of the cell range;

[0014] The standard column width value of the cell range is determined based on the preset column width value and the column width threshold. Specifically, if the preset column width value is greater than or equal to the column width threshold, the column width threshold is used as the standard column width value of the cell range; if the preset column width value is less than the column width threshold, the preset column width value is used as the standard column width value of the cell range.

[0015] Optionally, determining at least one subtext based on the adjusted target text in the cell range includes: dividing the target text into at least one subtext based on at least one text newline character in the target text.

[0016] Optionally, calculating the subtext length of each subtext includes: obtaining the subtext length of each subtext in the first direction based on the text setting information of the text in the target text; wherein, the text setting information includes font and font size.

[0017] Optionally, after determining the standard column width value of the cell range based on the preset column width value and the column width threshold, the table processing method further includes: determining the preset text height of the cell range based on the target text and the preset column width value; determining the target row text height of the target row where the cell range is located based on the preset text height; obtaining the row height margin value of the cell range; summing the target row text height and the row height margin value to obtain a second summation result, and using the second summation result as the standard row height value of the cell range.

[0018] Optionally, the preset text height of the cell area is determined based on the target text and the preset column width value, including: obtaining the second text length of each sub-text in the cell area; determining the number of line breaks in the target text in the cell area based on the preset column width value and the second text length of each sub-text; obtaining the line height of a single line in the cell area based on the text setting information of the text in the target text; and determining the preset text height of the cell area based on the number of line breaks and the line height of a single line in the cell area.

[0019] According to a second aspect of this application, a table processing apparatus is also provided, comprising: an acquisition module for acquiring the region type of a cell range in a table; an adjustment module for adjusting the format settings information of the cell range according to the region type; and a processing module for performing standardized layout processing on the cells according to the adjustment result of the format settings information to obtain standardized cells corresponding to the cells; wherein the standardized cells fully display the cell content in the standardized cells.

[0020] Optionally, the adjustment module is used to: adjust the first format settings of the text in the cell range according to the region type; and adjust the second format settings of the text containing the text according to the adjustment result of the first format settings.

[0021] Optionally, the adjustment module is used to: determine the number of text lines of the text containing the text based on the adjustment result of the first format setting information; determine the horizontal alignment of the text containing the text based on the region type, the number of text lines, and the number of cells contained in the cell region; and determine the vertical alignment of the text containing the text based on the region type.

[0022] Optionally, the table processing device further includes: a region module, used to determine the target region range corresponding to the cell range according to the region type before the adjustment module adjusts the formatting information of the cell range according to the region type; and to adjust the region range of the cell range to the target region range if the region range of the cell range is inconsistent with the target region range.

[0023] Optionally, the area type can be either a main title or a subtitle.

[0024] Optionally, the table processing device further includes: a judgment module, used to determine whether there are abnormal characters in the text of the cell range after the adjustment module adjusts the formatting information of the cell range according to the range type; and if there are abnormal characters in the text of the cell range, to replace the abnormal characters with the corresponding standard characters.

[0025] Optionally, the abnormal character includes multiple consecutive spaces, wherein the number of spaces is greater than or equal to a preset threshold for the number of spaces; the normal character corresponding to the abnormal character includes a preset newline character.

[0026] Optionally, the processing module is used to: determine at least one subtext based on the adjusted target text in the cell range; wherein each subtext occupies one text line, the text arrangement direction of the target text is a first direction, and the first direction is the line direction; calculate the subtext length of each subtext to obtain at least one subtext length; obtain the first maximum value among the at least one subtext lengths, and use the first maximum value as the first text length; and perform standardized typesetting processing on the cell range based on the first text length.

[0027] Optionally, the processing module is configured to: obtain the first text length of all cell regions in the target column where the cell region is located, and obtain at least one first text length; obtain the second maximum value among the at least one first text length, and use the second maximum value as the target column text length of the target column; obtain the column width margin value and column width threshold of the cell region; sum the column width margin value and the target column text length to obtain a first summation result, and use the first summation result as the preset column width value of the cell region; determine the standard column width value of the cell region according to the preset column width value and the column width threshold; wherein, if the preset column width value is greater than or equal to the column width threshold, the column width threshold is used as the standard column width value of the cell region; if the preset column width value is less than the column width threshold, the preset column width value is used as the standard column width value of the cell region.

[0028] Optionally, the processing module is used to: divide the target text into at least one subtext based on at least one text newline character in the target text.

[0029] Optionally, the processing module is used to: obtain the length of each subtext in the first direction based on the text setting information of the text in the target text; wherein, the text setting information includes font and font size.

[0030] Optionally, the table processing device further includes: a determining module, configured to: after the processing module determines the standard column width value of the cell area based on the preset column width value and the column width threshold, determine the preset text height of the cell area based on the target text and the preset column width value; determine the target row text height of the target row where the cell area is located based on the preset text height; obtain the row height margin value of the cell area; sum the target row text height and the row height margin value to obtain a second summation result, and use the second summation result as the standard row height value of the cell area.

[0031] Optionally, the determining module is used to: obtain the second text length of each sub-text in the cell area; determine the number of line breaks in the target text in the cell area based on the preset column width value and the second text length of each sub-text; obtain the line height of a single line in the cell area based on the text setting information of the text in the target text; and determine the preset text height of the cell area based on the number of line breaks and the line height of a single line in the cell area.

[0032] According to a third aspect of this application, an electronic device is also provided, including a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the method according to the first aspect of this application.

[0033] According to a fourth aspect of this application, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the method according to the first aspect of this application.

[0034] One beneficial effect of this application's embodiments is that it can first obtain the region type of the cell range in the table, then adjust the formatting information of the cell range according to the region type, and finally perform standardized layout processing on the cell range based on the adjustment results, obtaining the standardized cell range corresponding to the cell range, wherein the standardized cell range fully displays the data content therein. Therefore, this application can adjust the formatting information and perform standardized layout processing of the cell range according to its region type, eliminating the need for users to manually adjust the parameters in the cell formatting information and manually format the cells, simplifying the user's operation process and effectively assisting users in improving office efficiency.

[0035] Other features and advantages of the embodiments of this application will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0036] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments of the present application and, together with their description, serve to explain the principles of the embodiments of the present application.

[0037] Figure 1 A flowchart illustrating a table processing method provided in this application embodiment;

[0038] Figure 2 This is a schematic diagram of some cell types in a table processing method provided in an embodiment of this application;

[0039] Figure 3 This is a schematic diagram illustrating other cell types in a table processing method provided in an embodiment of this application;

[0040] Figure 4 A flowchart illustrating another table processing method provided in this application embodiment;

[0041] Figure 5 A comparison diagram showing the effect before and after adjusting the first format setting information of text in a table processing method provided in this application embodiment;

[0042] Figure 6 A comparison diagram showing the effect before and after adjusting the second format setting information of text in a table processing method provided in this application embodiment;

[0043] Figure 7 A comparison diagram showing the effect before and after adjusting the area of ​​a cell in a table processing method provided in this application embodiment;

[0044] Figure 8 A flowchart illustrating another form processing method provided in this application embodiment;

[0045] Figure 9 A flowchart illustrating another table processing method provided in this application embodiment;

[0046] Figure 10 A flowchart illustrating another table processing method provided in this application embodiment;

[0047] Figure 11 A flowchart illustrating another table processing method provided in this application embodiment;

[0048] Figure 12 A flowchart illustrating another table processing method provided in this application embodiment;

[0049] Figure 13 A flowchart illustrating another table processing method provided in this application embodiment;

[0050] Figure 14 A functional structural block diagram of a table processing apparatus provided in some embodiments of this application;

[0051] Figure 15 This is a schematic diagram of the hardware structure of an electronic device according to some embodiments of this application. Detailed Implementation

[0052] Various exemplary embodiments of this application will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of this application.

[0053] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the scope of this application and its application or use.

[0054] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0055] In all the examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0056] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0057] It should be noted that the execution subject of this application embodiment can be an application located on a local terminal, or it can be a plugin or software development kit (SDK) or other functional unit set in an application located on a local terminal. This embodiment does not impose any special limitations on this.

[0058] It is understood that the application can be a native app installed on the terminal, or it can be a web app in a browser on the terminal. This embodiment does not impose any particular limitation on this.

[0059] Furthermore, the terminal devices involved in the embodiments of this application may include, but are not limited to, mobile phones, personal digital assistants (PDAs), wireless handheld devices, tablet computers, personal computers (PCs), PDAs (personal digital assistants), wearable devices (such as smart glasses, smartwatches, etc.).

[0060] <Method Implementation>

[0061] Figure 1 This document presents a flowchart illustrating a table processing method according to some embodiments of this application. The method aims to address the problem of cumbersome and inefficient manual layout of objects within a table, which requires manual user intervention. The goal is to simplify the layout process and improve user efficiency. It should be noted that the method in this application is applicable to documents containing tables, including but not limited to table files, presentations, and text documents.

[0062] like Figure 1 As shown, the method includes the following steps S110 to S130.

[0063] Step S110: Obtain the region type of the cell range in the table.

[0064] A cell range can be a range of single cells, a range of merged cells, a range of a row or a range of a column in a table.

[0065] The range type of a cell range can be determined based on the relative relationship between the data content in that cell range and all the data content in the table.

[0066] For example, if the data content in a cell range is a heading relative to all the data content in the table, then the range type of that cell range is Heading.

[0067] Area types can include any of the following: main heading, subheading, line heading (also known as table header), content area, supplementary information, and others.

[0068] For example, see the area types listed above. Figure 2 and Figure 3 As shown, Figure 2 The image shows the identification results of the main heading, row headings, content areas, and supplementary information in a table. The content area refers to... Figure 2 The "Content" section is shown. Figure 3 The image shows the recognition results for subheadings in a table. For cell ranges that cannot be identified as any of the following area types: main title, subheading, row title, content area, or supplementary information, the area type of the cell range is determined to be "Other".

[0069] In some embodiments, when obtaining the region type of a cell range in a table, type identification information of the cell range can be obtained first. This type identification information may include, for example, the text in the cell range, the number of lines of text, and the number of columns of text. Then, the region type of the cell range can be determined based on this type identification information. For example, the type identification information can be input into a pre-established type identification model to obtain the identification result of the type identification model for the region type of each cell range. The region type corresponding to each cell range in the identification result can then be used as the region type of that cell range.

[0070] It should be noted that the aforementioned type recognition model can be obtained by training a large number of table samples (for example, by training a large number of table samples according to a preset algorithm). In each table sample, the cell type of each cell in the table sample can be labeled manually. Then, by training a large number of table samples, a type recognition model that can identify the region type of each cell area in the table can be obtained.

[0071] Step S120: Adjust the formatting information of the cell range according to the range type.

[0072] The formatting information for a cell range can include: the first formatting information for the text within the cell range and the second formatting information for the text containing that text. The text containing that text is the text within the cell range. The first formatting information may include at least one of the following: font settings, text effects, font, font size, and indentation information.

[0073] For example, font settings information may include bold settings and italic settings. These settings include both enabled and disabled options.

[0074] For example, for bold settings, "Example 1" indicates no bolding, while "Example 2" indicates bolding; for italic settings, "Example 1" indicates italing, while "Example 2" indicates italing.

[0075] For example, text effect information may include settings for underline, strikethrough, superscript, and subscript.

[0076] An underline refers to an underline set for text. Regarding underline settings, "Example 1" shows no underline setting. Example 2 "Settings"; for strikethrough settings, strikethrough refers to the strikethrough setting applied to text, for example, "Example 1" is not set. " is set; for superscript settings, superscript means setting the text as superscript, for example, "Example 1" is not set, and "Example 2" is set; for subscript settings, subscript means setting the text as subscript, for example, "Example 1" is not set, and "Example 2" is set.

[0077] Font refers to the style of writing, such as regular script, cursive script, Song typeface, imitation Song typeface, and sans-serif typeface. Font size is used to set the size of the text, such as initial size, small initial size, size 1, small 1, size 2, small 2, size 3, small 3, size 4, small 4, size 5, small 5, size 6, small 6, size 7, and small 7.

[0078] Indentation information refers to the distance between the text in a cell area and the boundary of that cell area.

[0079] The second formatting information is the formatting information for the text within the cell range, such as alignment. Alignment includes vertical alignment (e.g., top alignment, center alignment, justified alignment, bottom alignment) and horizontal alignment (e.g., regular, left alignment, center alignment, right alignment, fill, justified alignment, center alignment across columns, distributed alignment).

[0080] Step S130: Based on the adjustment results of the format setting information, perform standardized layout processing on the cell range to obtain the standardized cell range corresponding to the cell range; wherein, the standardized cell range fully displays the data content in the standardized cell range.

[0081] Based on the adjustment results of the formatting information, the first length of the cell range in the first direction is adjusted to obtain the first standard length of the cell range in the first direction; then, based on the adjustment results of the first length, the second length of the cell range in the second direction is adjusted to obtain the second standard length of the cell range in the second direction, thus obtaining the standardized cell range; wherein, the first length of the standardized cell range in the first direction is the first standard length, the second length of the standardized cell range in the second direction is the second standard length, and the standardized cell range can completely display the data content in the standardized cell range.

[0082] It should be noted that "complete display" means that the data is fully displayed without being obscured or partially displayed. A standardized cell range can completely display the data content within the standardized cells; that is, all the data content in the standardized cells can be displayed without any partial obscuration or incomplete display.

[0083] When standardizing the layout of a cell range based on adjustments to formatting information, the process can involve determining the first length of the cell range in a first direction, ensuring the target text is fully displayed, based on the adjusted formatting information. Then, based on this first length, a second length in a second direction is determined, also ensuring the target text is fully displayed, thus obtaining the standardized cell range. The first direction refers to the direction in which the text is arranged within the target text, and the second direction is perpendicular to the first direction.

[0084] The first direction is the row direction, and the second direction is the column direction; or the first direction is the column direction, and the second direction is the row direction. The row direction is parallel to the extension direction of any row in the table, and the column direction is parallel to the extension direction of any column in the table.

[0085] Therefore, this application embodiment can first obtain the region type of the cell range in the table, then adjust the formatting information of the cell range according to the region type, and finally perform standardized layout processing on the cell range based on the adjustment results, obtaining the standardized cell range corresponding to the cell range, wherein the standardized cell range fully displays the data content therein. Thus, this application can adjust the formatting information and perform standardized layout processing of the cell range according to the region type, eliminating the need for users to manually adjust the parameters in the cell formatting information and manually format the cells, simplifying the user operation process and effectively assisting users in improving office efficiency.

[0086] In some embodiments, such as Figure 4As shown, the execution process of step S120 may include the following steps S410 to S420:

[0087] Step S410: Adjust the first format settings for the text in the cell range according to the region type.

[0088] In some embodiments, standard values ​​for each parameter in the first format setting information corresponding to different region types can be preset for each region type. In this case, as long as the region types of the cell regions are the same, the first format setting information of the cell regions will be the same, so that the text layout in cell regions of the same region type has uniformity, and the text in the table has visual uniformity.

[0089] The parameters in the first format settings include the glyph settings, text effects, font, font size, and indentation information mentioned above.

[0090] Taking font size as an example, if the font size of the main title is set to 7, then the standard font size for all main titles is 7; if the font size of the content area is set to 4, then the standard font size for all content areas is 4.

[0091] Taking the target parameter as an example, the font can be set according to the font corresponding to the region type in the first format setting information. The font of the cell area with the same region type in the table can be set to the font corresponding to that region type, so that the font of all cell areas with the same region type is consistent.

[0092] For example, such as Figure 5 As shown in section a, all cell ranges (i.e., a single cell within range A) have the same range type: content area. However, the font of the text in each cell range within range A is inconsistent. In this case, through step S410, the font in all cell ranges within range A is adjusted to be uniform. The adjustment result is shown in [link to example]. Figure 5 As shown in section b.

[0093] In some examples, taking the font as the target parameter, for cell ranges with area types of main title, subtitle, and row title, the text in the cell range can be bolded to better highlight the data content in the main title, subtitle, and row title, making the table layout more in line with the user's reading habits (users usually look at the various titles in the table first when reading the table).

[0094] Step S420: Based on the adjustment results of the first format setting information, adjust the second format setting information of the text containing the text.

[0095] Based on the adjustment results of the first format setting information, the second format setting information of the text containing the text is adjusted. That is, based on the adjustment results of the first format setting information corresponding to the text in the cell area, the second format setting information of the text in the cell area is adjusted. In some embodiments, the number of text lines containing the text can be determined based on the adjustment results of the first format setting information. Then, based on the area type, the number of text lines mentioned above, and the number of cells contained in the cell area, the horizontal alignment of the text containing the text is determined, and the vertical alignment of the text containing the text is determined based on the area type. During the user's text editing process, the text edited by the user is manually split into multiple lines, and the number of text lines can be the number of lines corresponding to the multiple lines mentioned above. For example, the user will input a carriage return character during the text input process to continue inputting text after a line break. In this case, the number of text lines increases by 1 each time the user inputs a carriage return character. If the user does not input a carriage return character (i.e., the number of carriage return characters is 0), the number of text lines is one line. Therefore, the number of carriage return characters in the text can be obtained first, and the number of text lines = the number of carriage return characters + 1.

[0096] After determining the number of lines of text containing the text, the horizontal alignment of the text can be determined based on the region type, the number of lines of text mentioned above, and the number of cells contained in the cell region.

[0097] In some embodiments, pre-defined conditions can be set for each horizontal alignment method. Then, it is determined whether the cell range's region type, number of text lines, and number of cells meet the conditions for each method. If all three conditions meet the requirements for a particular horizontal alignment method, the cell's horizontal alignment is set to that method; otherwise, the default horizontal alignment method is determined. The default method can be, for example, the "normal" horizontal alignment method, or any other horizontal alignment method besides "normal," such as left-aligned, center-aligned, right-aligned, filled, justified, center across columns, or distributed alignment.

[0098] In some examples, priority can be set for multiple horizontal alignment methods. If the region type, number of text lines, and number of cells of the cell region all meet the setting conditions for multiple horizontal alignment methods, the horizontal alignment of the cell region can be set to the method with the highest priority among the multiple methods.

[0099] The conditions can be set by those skilled in the art according to the actual situation, and the embodiments of this application do not limit this.

[0100] When adjusting the vertical alignment, you can pre-set the vertical alignment for each region type, and then adjust the vertical alignment of each cell region to match the vertical alignment of that cell region's region type.

[0101] By adjusting the horizontal and vertical alignment, the alignment of data content in each cell range can be automatically adjusted, resulting in a neater and more aesthetically pleasing layout. When dealing with a large number of cells, users no longer need to manually adjust the alignment of each cell individually, significantly improving the efficiency of table alignment processing.

[0102] For example, such as Figure 6 As shown, Figure 6 Part a shows the table before alignment adjustments. The text alignment in this table is messy, not neat or aesthetically pleasing, resulting in a visually chaotic table layout. Step S420 adjusts the alignment of each cell range in the table; the result after adjustment is shown in [link to table]. Figure 6 As shown in section b.

[0103] When adjusting the formatting information of a cell, you can adjust the parameter value by calling the API (Application Programming Interface) corresponding to the parameter to be adjusted in the formatting information.

[0104] Therefore, by using steps S410 to S420, the text in the cell range can be formatted uniformly, and the text in each cell range can be formatted according to the region type of each cell range. This makes the text in each cell range formatted in accordance with the region type of the cell range, thereby making the layout of all cell ranges in the table more neat and beautiful. Users do not need to manually adjust the format settings of each cell range one by one, thus improving the efficiency of the text formatting process in the table.

[0105] In some cases, the cell ranges corresponding to different region types in a table may be set incorrectly. For example, if the region type of a cell range is "header," the cell range should span all columns in the table, but it does not actually span all columns (e.g., ...). Figure 7 As shown in section a, the table boundaries are not aligned with the boundaries of the table area corresponding to the main title. In this case, it is necessary to adjust the size of the cell area so that the cell area is aligned with the table boundaries, thereby making the table settings more aesthetically pleasing and standardized.

[0106] To achieve the above objective, before executing step S120, as follows: Figure 8 As shown, the embodiments of this application may also perform the following steps S810 to S820.

[0107] Step S810: Determine the target area range corresponding to the cell range based on the area type.

[0108] Based on the region type of the cell range, you can determine the relationship between the cell range and other cell ranges of different region types in terms of range, and then determine the target range corresponding to the cell range based on the determined relationship.

[0109] For example, if the cell range's area type is "Header," then the columns and rows of this cell range should satisfy the following conditions: the columns of this cell range include the columns of cell ranges of other area types in the table (i.e., all area types in the table other than the area type of this cell range, not "Other" excluding "Header," "Subheading," "Row Heading," "Content Area," and "Supplementary Information"), while the rows of this cell range are not limited. In this case, the row range of the cell range can be kept unchanged, and the column range of this cell range can be determined based on the column ranges of cell ranges of other area types, so that the columns of this cell range include the columns of cell ranges of other area types. This allows us to obtain the target area range of this cell range.

[0110] Typically, the range of a cell range includes the coordinates of the starting and ending cells. The coordinates of the starting cell include the row and column numbers, and the coordinates of the ending cell include the row and column numbers. In this case, we can obtain the maximum and minimum row numbers of the cell range, determine the column numbers of cell ranges of other range types, obtain the maximum value among the column numbers of cell ranges of other range types as the target maximum column number, and obtain the minimum value among the column numbers of cell ranges of other range types as the target minimum column number, thus determining the target range as [(minimum row number)(target minimum column number):(maximum row number)(target maximum column number)].

[0111] The range of cells to be adjusted can be a main heading or a subheading, making the table more organized and aesthetically pleasing.

[0112] Step S820: If the range of the cell range is inconsistent with the range of the target range, adjust the range of the cell range to match the range of the target range.

[0113] Based on obtaining the maximum and minimum row numbers of the cell range, we then obtain the maximum and minimum column numbers of the cell range, thus obtaining the range of the cell range as [(minimum row number)(minimum column number):(maximum row number)(maximum column number)]. In this case, we can determine whether the range of the cell range and the target range are consistent, i.e., whether [(minimum row number)(target minimum column number):(maximum row number)(target maximum column number)] and [(minimum row number)(minimum column number):(maximum row number)(maximum column number)] are consistent. If they are consistent, no adjustment is made to the cell range; if they are inconsistent, it means that the range of the cell range is inconsistent with the target range, and the current maximum column number of the cell range is adjusted to the target maximum column number, and the current minimum column number of the cell range is adjusted to the target minimum column number, thus achieving the goal of adjusting the range of the cell range to the target range.

[0114] If the target area is larger than the cell range, the cell range can be adjusted to the target area by merging cells; if the target area is smaller than the cell range, the cell range can be adjusted to the target area by splitting and merging cells.

[0115] By adjusting the range of cell areas, tables can be made more organized and aesthetically pleasing.

[0116] For example, such as Figure 7 As shown, Figure 7 The cell range of the main title (shaded area) shown in section a should be aligned with the right edge of the table, but it is not, resulting in a blank area between the right edge of the main title and the right edge of the table. Step S820 adjusts the cell range to the target range. See the result after adjustment. Figure 7 As shown in section b, the adjusted title cell area is aligned with the right edge of the table, eliminating the blank area between the right edge of the title and the right edge of the table, making the table more neat and aesthetically pleasing.

[0117] In practice, because users are unfamiliar with using tables, they may enter incorrect characters when editing tables. For example, many users do not know that pressing Alt+Enter allows for manual line breaks, and instead manually fill in spaces to create line breaks.

[0118] Based on the above, in some embodiments, in order to standardize the characters in the table, such as... Figure 9 As shown, after executing step S120, the following steps S910 to S920 can also be executed.

[0119] Step S910: Determine whether the text in the cell range contains abnormal characters.

[0120] If the result is yes, meaning the text in the cell range contains abnormal characters, then proceed to step S920; if the result is no, meaning the text in the cell range does not contain abnormal characters, then end the current process.

[0121] The aforementioned abnormal characters may be, for example, multiple consecutive spaces, and the number of such spaces is greater than or equal to a preset threshold for the number of spaces. This threshold for the number of spaces can be set by those skilled in the art according to actual circumstances, and this application does not limit this setting.

[0122] Of course, it is understood that the aforementioned abnormal characters can also be other characters besides multiple consecutive spaces. The method for determining whether the text in a cell contains abnormal data can be set by those skilled in the art according to the actual situation, and this application embodiment does not limit this.

[0123] Step S920: If the text in the cell range contains abnormal characters, convert the abnormal characters into the corresponding normal characters.

[0124] Based on a preset mapping table, the system can determine the corresponding standard character for an abnormal character and then replace the abnormal character with the standard character. The mapping table includes a pre-defined correspondence between multiple abnormal characters and multiple standard characters.

[0125] In some examples, the abnormal character is a series of consecutive spaces, and the number of these spaces is greater than or equal to a preset threshold. In such cases, the normalized character corresponding to the abnormal character includes the preset newline character, i.e., Alt+enter. In this situation, we can first determine the normalized character corresponding to the abnormal character as Alt+enter based on the mapping table above, and then convert the abnormal character to Alt+enter to achieve the purpose of normalizing the characters in the table.

[0126] In some embodiments, when performing step S130, at least one subtext can be determined first based on the adjusted target text in the cell area; wherein each subtext occupies one text line, and the text direction (i.e., text arrangement direction) of the target text is the first direction; then the subtext length of each subtext is calculated to obtain at least one subtext length, and then the first maximum value among the at least one subtext length is obtained, and the first maximum value is used as the first text length. The cell area is then subjected to a set standardization layout processing based on the first text length to obtain a standardized cell area; wherein the standardized cell area fully displays the data content therein, so as to achieve the purpose of the adjusted cell area being able to fully display the data content therein.

[0127] The first direction can be the row direction. In this case, when performing standardized layout processing on the cell range based on the first text length, the first text length of all cell ranges in the target column containing the cell range can be obtained first, resulting in at least one first text length; the second maximum value among the at least one first text length can be obtained, and this second maximum value can be used as the target column text length of the target column; the column width margin value and column width threshold of the cell range can be obtained; the column width margin value and the target column text length can be summed to obtain a first summation result, which can be used as the preset column width value of the cell range; the standard column width value of the cell range can be determined based on the preset column width value and the column width threshold; wherein, if the preset column width value is greater than or equal to the column width threshold, the column width threshold can be used as the standard column width value of the cell range; if the preset column width value is less than the column width threshold, the preset column width value can be used as the standard column width value of the cell range. Of course, it can be understood that the above first direction can also be the column direction. In this case, by replacing the target column text length of the target column with the target row text length of the target row in the standardized typesetting process of setting the cell range according to the first text length, replacing the column width margin value with the row height margin value, replacing the column width threshold with the row height threshold, replacing the preset column width value with the preset row height value, and replacing the standard column width value with the standard row height value, the process of obtaining the standard row height value can be obtained.

[0128] When the first direction is row-oriented, during the standardized layout processing of the cell region based on the first text length, the first text length of all cell regions in the target column containing the cell region can be obtained first, resulting in at least one first text length. Then, the second maximum value among the at least one first text length can be obtained, and this second maximum value can be used as the target column text length of the target column. The column width margin value and column width threshold of the cell region can be obtained. The column width margin value and the target column text length can be summed to obtain a first summation result, which can be used as the preset column width value of the cell region. Finally, the standard column width value of the cell region can be determined based on the preset column width value and the column width threshold. Wherein, if the preset column width value is greater than or equal to the column width threshold, the column width threshold can be used as the standard column width value of the cell region; if the preset column width value is less than the column width threshold, the preset column width value can be used as the standard column width value of the cell region. Following this, the preset text height of the cell region can be determined based on the target text and the preset column width value; the target row text height of the target row containing the cell region can be determined based on the preset text height; the row height margin value of the cell region can be obtained, and the target row text height and the row height margin value can be summed to obtain a second summation result, which can be used as the standard row height value of the cell region. The column width of the cell region can be adjusted to the standard column width value and the standard row height value to obtain a standardized cell region.

[0129] The following examples illustrate the execution process of step S130.

[0130] In some examples, such as Figure 10 As shown, the execution process of step S130 may include the following steps S1010 to S1030.

[0131] Step S1010: Determine the target text length in the first direction based on the adjusted target text in the cell range; where the first direction is the text direction of the text.

[0132] The text following the formatting information in the cell range is the target text mentioned above. The text direction refers to the direction in which the text is arranged. The text direction can be the same as the row direction or the column direction in the table.

[0133] When the text direction is consistent with the row direction in the table, the target text length is the length of the target text in the row direction. By determining this target text length, the column width value of the cell range in the row direction can be determined.

[0134] When the text direction is consistent with the column direction in the table, the target text length is the length of the target text in the column direction. By determining this target text length, the row height of the cell range in the column direction can be determined.

[0135] Determining the length of the target text in the first direction can be found in the detailed description in the following embodiments (e.g., steps S1110 to S1140), and will not be repeated here.

[0136] Step S1020: Adjust the first length of the cell range in the first direction according to the target text length.

[0137] In some embodiments, the column width margin value can be preset. In step S1020, the sum of the target text length and the column width margin value can be obtained as the first length of the cell area in the first direction.

[0138] Step S1030: Adjust the second length of the cell in the second direction according to the first length; wherein the second direction is perpendicular to the first direction.

[0139] If the first direction is the row direction, the second direction is the column direction. If the first direction is the column direction, the second direction is the row direction.

[0140] The following describes the execution process of step S130 in the embodiment of this application, taking the first direction as the row direction and the second direction as the column direction as an example.

[0141] It is understood that when the first direction is a column direction and the second direction is a row direction, the execution method of step S130 is similar to that when the first direction is a row direction and the second direction is a column direction. For details, please refer to the corresponding descriptions below when the first direction is a column direction and the second direction is a row direction. This application embodiment will not repeat the details.

[0142] When the first direction is the row direction and the second direction is the column direction, the first length of the cell region in the first direction is the length of the cell region in the row direction, hereinafter referred to as the column width value of the cell region (unit: characters); the second length of the cell region in the second direction is the length of the cell region in the column direction, hereinafter referred to as the row height value of the cell region (unit: characters). In this case, in step S1010, when determining the target text length of the target text in the first direction based on the adjusted text in the cell region, specifically, the target column text length of the target column where the cell region is located is determined based on the adjusted text in the cell region.

[0143] In some examples, such as Figure 11 As shown, the process of determining the target column text length of the cell range includes the following steps S1110 to S1140.

[0144] Step S1110: Divide the target text into at least one subtext based on at least one text newline character in the target text.

[0145] For any target text newline character in at least one text newline character set, the text between the target text newline character and the text newline character preceding it is treated as a subtext. The text between the target text newline character and the text newline character following it is treated as another subtext. If there is no text newline character before the target text newline character, all text before the target text newline character is treated as a subtext; if there is no text newline character after the target text newline character, all text after the target text newline character is treated as a subtext.

[0146] Step S1120: Based on the text setting information of the text in the target text, obtain the length of each subtext in at least one subtext in the first direction, and obtain the length of at least one subtext, wherein the text setting information includes font and font size.

[0147] The length of each character in the target text along the line direction can be determined based on the font and font size. It's important to note that when the font and font size are fixed, the length of each character along the line direction is the same; determining the length of one character along the line direction determines the lengths of the other characters. In this case, based on the determination of the lengths of the characters along the line direction, for each subtext, the product of the number of characters in the subtext and the length of one character along the line direction is obtained. This product is taken as the length of the subtext in the first direction, thus yielding at least one subtext length.

[0148] Step S1130: Obtain the maximum value among at least one sub-text lengths, and use the maximum value as the first text length.

[0149] Step S1140: Obtain the maximum value among the first text lengths of all cell ranges in the target column, and use this maximum value as the target column text length.

[0150] For the target column containing the cell range, obtain the first text length of all cell ranges in that target column, thus obtaining multiple first text lengths. Find the maximum value among these multiple first text lengths and use this maximum value as the target column text length.

[0151] After performing step S1140, as Figure 12 As shown, the execution process of step S1020 may include the following steps S1210 to S1230.

[0152] Step S1210: Obtain the column width margin value and column width threshold of the cell range.

[0153] You can pre-set the corresponding column width margin and column width threshold for each cell range based on its range type.

[0154] Step S1220: Obtain the sum of the target column text length and column width margin value as the preset column width value of the cell range.

[0155] The target column text length is the same as the target column text length obtained in step S1140. In step S1220, the target column text length and the column width margin value are summed, and the sum is used as the preset column width value of the cell range.

[0156] Step S1230: Determine the standard column width value of the cell range based on the preset column width value and column width threshold.

[0157] If the preset column width value is greater than or equal to the column width threshold, the column width threshold will be used as the standard column width value of the cell range; if the preset column width value is less than the column width threshold, the preset column width value will be used as the standard column width value of the cell range.

[0158] After executing step S1230, as Figure 13 As shown, the execution process of step S1030 may include the following steps S1310 to S1330.

[0159] Step S1310: Determine the preset text height of the cell range based on the target text and the preset column width value.

[0160] First, obtain the second text length of each sub-text in the cell range. Then, based on the preset column width and the second text length of each sub-text, determine the number of line breaks for the target text within the cell range. In some examples, for the second text length of any sub-text, quotient the sub-text length and the preset column width. If the quotient has no decimal part, use the integer part as the number of line breaks for that sub-text; if the quotient has a decimal part, remove the decimal part and add 1 to the integer part, using the result as the number of line breaks for that sub-text. Finally, sum the number of line breaks for all sub-texts in the cell range and use the sum as the number of line breaks for the entire cell range.

[0161] For example, the preset column width of the cell range is 25. The target text in the cell range includes a first subtext, a second subtext, and a third subtext. The text length of the first subtext is 20, the text length of the second subtext is 55, and the text length of the third subtext is 20. The number of line breaks for the first subtext is 20 / 25 = 1; the number of line breaks for the second subtext is 55 / 25 = 3; and the number of line breaks for the third subtext is 20 / 25 = 1. The total number of line breaks for the cell range is 1 + 3 = 1 = 5.

[0162] After obtaining the line break count of the cell range, you can determine the line height of a single line in the cell range based on the text settings of the target text. Then, based on the line break count and the line height of a single line in the cell range, you can determine the preset text height of the cell range. For example, you can obtain the product of the line break count and the line height of a single line in the cell range, and use this product as the preset text height of the cell range. For instance, if the line break count of the cell range is M, and the line height of each line in the cell range is K, then the preset line height of the cell range = M * K.

[0163] In related technologies, adjusting the row height and column width of a cell area using the "fits row height" and "fits column width" functions can lead to issues. For example, if the text content lengths within cells of the same row or column differ significantly, the adjusted cell may contain excessive blank spaces because it needs to adapt to the row height or column width of the cell containing the longest text. Similarly, adjusting the number of line breaks in a cell area using "automatic line wrapping" can also result in excessive line breaks due to the same issue. This application addresses these problems by calculating the number of line breaks to adjust the cell's row height and column width, using this calculated number as the total number of line breaks for the text within the cell area. This effectively prevents excessive blank spaces or line breaks within the cell.

[0164] Step S1320: Determine the target row text height of the cell range based on the preset text height.

[0165] It can obtain the maximum value of the preset text height of all cell ranges in the target row, and use this maximum value as the target row text height.

[0166] Step S1330: Adjust the second length of the cell range in the second direction according to the target line text height.

[0167] The standard row height of a cell range can be obtained by summing the target row text height and the row height / white space value, based on the pre-set row height / white space value of the cell range.

[0168] Adjust the column width of the cell range to the standard column width value, and adjust the row height of the cell range to the standard row height value to obtain the standardized cell range corresponding to the cell range.

[0169] The above process for calculating the row height and column width of a cell range applies to both non-merged and merged cells.

[0170] In summary, the embodiments of this application can first obtain the region type of the cell range in the table, then adjust the format settings of the cell range according to the region type, and finally perform standardized layout processing on the cell range based on the adjustment results of the format settings, thereby obtaining the standardized cell range corresponding to the cell range. The standardized cell range fully displays the data content therein, thus realizing the standardized processing of each cell range in the table. Users no longer need to manually adjust the parameters in the cell format settings and manually format the cells, simplifying the user operation process and effectively helping users improve office efficiency.

[0171] For example, when copying a table document and pasting it into a blank area of ​​the table, the pasted table may not retain its original row height and column width. This application can quickly and automatically adjust the row width and column height of the cell area to ensure that the adjusted cell area fully displays its cell content, thereby improving processing efficiency.

[0172] For scenarios where tables need to be printed, the layout can be adjusted directly through pre-set print layout modes, eliminating the need for manual adjustments by the user and improving processing efficiency.

[0173] <Equipment Example>

[0174] Figure 14 This is a functional structural block diagram of a table processing apparatus according to some embodiments of this application. For example... Figure 14 As shown, the table processing device 140 may include an acquisition module 141, an adjustment module 142, and a processing module 143.

[0175] Module 141 is used to obtain the region type of a cell range in a table.

[0176] The first adjustment module 142 is used to adjust the formatting information of the cell range according to the region type.

[0177] The processing module 143 is used to perform standardized layout processing on the cell range according to the adjustment result of the format setting information, so as to obtain the standardized cell range corresponding to the cell range; wherein, the standardized cell range fully displays the data content in the standardized cell range.

[0178] Optionally, the adjustment module is used to: adjust the first format settings of the text in the cell range according to the region type; and adjust the second format settings of the text containing the text according to the adjustment result of the first format settings.

[0179] Optionally, the adjustment module is used to: determine the number of text lines of the text containing the text based on the adjustment result of the first format setting information; determine the horizontal alignment of the text containing the text based on the region type, the number of text lines, and the number of cells contained in the cell region; and determine the vertical alignment of the text containing the text based on the region type.

[0180] Optionally, the table processing device further includes: a region module, used to determine the target region range corresponding to the cell range according to the region type before the adjustment module adjusts the formatting information of the cell range according to the region type; and to adjust the region range of the cell range to the target region range if the region range of the cell range is inconsistent with the target region range.

[0181] Optionally, the area type can be either a main title or a subtitle.

[0182] Optionally, the table processing device further includes: a judgment module, used to determine whether there are abnormal characters in the text of the cell range after the adjustment module adjusts the formatting information of the cell range according to the range type; and if there are abnormal characters in the text of the cell range, to replace the abnormal characters with the corresponding standard characters.

[0183] Optionally, the abnormal character includes multiple consecutive spaces, wherein the number of spaces is greater than or equal to a preset threshold for the number of spaces; the normal character corresponding to the abnormal character includes a preset newline character.

[0184] Optionally, the processing module is used to: determine at least one subtext based on the adjusted target text in the cell range; wherein each subtext occupies one text line, the text arrangement direction of the target text is a first direction, and the first direction is the line direction; calculate the subtext length of each subtext to obtain at least one subtext length; obtain the first maximum value among the at least one subtext lengths, and use the first maximum value as the first text length; and perform standardized typesetting processing on the cell range based on the first text length.

[0185] Optionally, the processing module is configured to: obtain the first text length of all cell regions in the target column where the cell region is located, and obtain at least one first text length; obtain the second maximum value among the at least one first text length, and use the second maximum value as the target column text length of the target column; obtain the column width margin value and column width threshold of the cell region; sum the column width margin value and the target column text length to obtain a first summation result, and use the first summation result as the preset column width value of the cell region; determine the standard column width value of the cell region according to the preset column width value and the column width threshold; wherein, if the preset column width value is greater than or equal to the column width threshold, the column width threshold is used as the standard column width value of the cell region; if the preset column width value is less than the column width threshold, the preset column width value is used as the standard column width value of the cell region.

[0186] Optionally, the processing module is used to: divide the target text into at least one subtext based on at least one text newline character in the target text.

[0187] Optionally, the processing module is used to: obtain the length of each subtext in the first direction based on the text setting information of the text in the target text; wherein, the text setting information includes font and font size.

[0188] Optionally, the table processing device further includes: a determining module, configured to: after the processing module determines the standard column width value of the cell area based on the preset column width value and the column width threshold, determine the preset text height of the cell area based on the target text and the preset column width value; determine the target row text height of the target row where the cell area is located based on the preset text height; obtain the row height margin value of the cell area; sum the target row text height and the row height margin value to obtain a second summation result, and use the second summation result as the standard row height value of the cell area.

[0189] Optionally, the determining module is used to: obtain the second text length of each sub-text in the cell area; determine the number of line breaks in the target text in the cell area based on the preset column width value and the second text length of each sub-text; obtain the line height of a single line in the cell area based on the text setting information of the text in the target text; and determine the preset text height of the cell area based on the number of line breaks and the line height of a single line in the cell area.

[0190] Figure 15 This is a schematic diagram of the hardware structure of an electronic device according to some embodiments of this application.

[0191] like Figure 15 As shown, the electronic device 150 includes a processor 151 and a memory 152, the memory 152 for storing an executable computer program, and the processor 151 for executing methods as described in any of the above method embodiments under the control of the computer program.

[0192] The electronic device 150 can be a mobile phone, a personal digital assistant (PDA), a wireless handheld device, a tablet computer, a personal computer (PC), a PDA (personal digital assistant), a wearable device (such as smart glasses, smartwatches, etc.).

[0193] Each module of the table processing device 140 described above can be implemented by the processor 151 in this embodiment executing the computer program stored in the memory 152, or it can be implemented by other circuit structures, which are not limited here.

[0194] This application may be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this application.

[0195] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0196] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0197] The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from the computer-readable program instructions. These electronic circuits can execute the computer-readable program instructions to implement various aspects of this application.

[0198] Various aspects of this application are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0199] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0200] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0201] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be well known to those skilled in the art that implementation in hardware, implementation in software, and implementation using a combination of software and hardware are equivalent.

[0202] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical applications, or technological improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of this application is defined by the appended claims.

Claims

1. A form processing method characterized by, The method comprises: acquiring a region type of a cell region in a table, wherein the region type of the cell region is determined according to a relative relationship between data content in the cell region and all data content in the table, and the region type comprises at least one of the following: main title, subtitle, row title, content area, supplementary information, and others; automatically adjusting format setting information of the cell region according to the region type; performing a standardization layout processing on the cell region according to an adjustment result of the format setting information, to obtain a standardization cell region corresponding to the cell region; wherein the standardization cell region completely displays data content in the standardization cell region; wherein the automatically adjusting format setting information of the cell region according to the region type comprises: automatically adjusting first format setting information corresponding to a character in the cell region according to the region type, wherein the first format setting information comprises at least one of the following: font setting information, character effect information, font, font size, and indentation information; automatically adjusting second format setting information of a text in which the character is located according to an adjustment result of the first format setting information, wherein the second format setting information comprises an alignment mode.

2. The method of claim 1, wherein, The automatically adjusting second format setting information of the text in which the character is located according to the adjustment result of the first format setting information comprises: determining a number of text lines of the text in which the character is located according to the adjustment result of the first format setting information; determining a horizontal alignment mode of the text in which the character is located according to the region type, the number of text lines, and a number of cells contained in the cell region; and determining a vertical alignment mode of the text in which the character is located according to the region type.

3. The method according to any of claims 1-2, characterized in that, Before the automatically adjusting format setting information of the cell region according to the region type, the method further comprises: determining a target region range corresponding to the cell region according to the region type; in a case where a region range of the cell region is inconsistent with the target region range, adjusting the region range of the cell region to the target region range.

4. The method of claim 3, wherein, The region type is a main title or a subtitle.

5. The method according to any of claims 1-2, characterized by, After the automatically adjusting format setting information of the cell region according to the region type, the method further comprises: judging whether an abnormal character exists in a text of the cell region; in a case where the abnormal character exists in the text of the cell region, replacing the abnormal character with a corresponding standard character.

6. The method of claim 5, wherein, The abnormal character comprises a plurality of consecutive space characters, wherein a number of the plurality of space characters is greater than or equal to a preset space character number threshold; and the standard character corresponding to the abnormal character comprises a preset line break character.

7. The method of claim 1, wherein, The performing a standardization layout processing on the cell region according to the adjustment result of the format setting information comprises: determining at least one subtext according to a target text in the cell region after adjustment; wherein each subtext occupies one text line, a character arrangement direction of the target text is a first direction, and the first direction is a row direction; Calculate the subtext length of each subtext to obtain at least one subtext length; Obtain the first maximum value in the at least one subtext length, and take the first maximum value as the first text length; According to the first text length, the standard layout processing of the cell area is set.

8. The method of claim 7, wherein, The standard layout processing of the cell area according to the first text length comprises: Obtain the first text length of all cell areas in the target column where the cell area is located to obtain at least one first text length; Obtain the second maximum value in the at least one first text length, and take the second maximum value as the target column text length of the target column; Obtain the column width blank value and the column width threshold value of the cell area; Sum the column width blank value and the target column text length to obtain a first summation result, and take the first summation result as the preset column width value of the cell area; Determine the standard column width value of the cell area according to the preset column width value and the column width threshold value; wherein, in the case that the preset column width value is greater than or equal to the column width threshold value, the column width threshold value is taken as the standard column width value of the cell area; in the case that the preset column width value is less than the column width threshold value, the preset column width value is taken as the standard column width value of the cell area.

9. The method of claim 8, wherein, The determination of at least one subtext according to the adjusted target text in the cell area comprises: According to at least one text line break in the target text, the target text is divided into at least one subtext.

10. The method of claim 7, wherein, The calculation of the subtext length of each subtext comprises: According to the character setting information of the characters in the target text, the subtext length of each subtext in the first direction is obtained; wherein, the character setting information comprises font and font size.

11. The method of claim 8, wherein, After determining the standard column width value of the cell area according to the preset column width value and the column width threshold value, the method further comprises: Determine the preset text height of the cell area according to the target text and the preset column width value; Determine the target row text height of the target row where the cell area is located according to the preset text height; Obtain the row height blank value of the cell area; Sum the target row text height and the row height blank value to obtain a second summation result, and take the second summation result as the standard row height value of the cell area.

12. The method of claim 11, wherein, The determination of the preset text height of the cell area according to the target text and the preset column width value comprises: Obtain the second text length of each subtext in the cell area; Determine the folding row number of the target text in the cell area according to the preset column width value and the second text length of each subtext; According to the character setting information of the characters in the target text, the row height of a single row in the cell area is obtained; Determine the preset text height of the cell area according to the folding row number and the row height of a single row in the cell area.

13. A table processing apparatus characterized by comprising: Comprise: The acquisition module is configured to acquire a region type of a cell region in a table, wherein the region type of the cell region is determined according to a relative relationship between data content in the cell region and all data content in the table, and the region type includes at least one of the following: a main title, a sub-title, a row title, a content area, supplementary information, and others. The adjustment module is configured to automatically adjust format setting information of the cell region according to the region type. The processing module is configured to perform a standardized layout processing on the cell according to an adjustment result of the format setting information, to obtain a standardized cell corresponding to the cell; wherein the standardized cell completely displays cell content in the standardized cell. The adjustment module is specifically configured to: automatically adjust first format setting information corresponding to text in the cell region according to the region type, wherein the first format setting information includes at least one of the following: font setting information, text effect information, font, font size, and indentation information; and automatically adjust second format setting information of a text in which the text is located according to an adjustment result of the first format setting information, wherein the second format setting information includes an alignment mode.

14. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the method according to any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the method according to any one of claims 1-12.

Citation Information

Patent Citations

  • Cell adjusting method and device

    CN103473001A

  • Off-site data management method, device and equipment and storage medium

    CN113449499A