A table content processing method and an electronic device

CN115204131BActive Publication Date: 2026-08-18LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210898304.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-08-18
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

[0003]然而,由于待插入图片的尺寸与表格中单元格尺寸往往不匹配,在将图片插入该表格后,需要手动调整单元格和/或图片尺寸,以使所插入的图片能够在单元格内合理显示,过程繁琐,降低了处理效率和用户体验

Benefits of technology

[0048] Therefore, this application provides a method for processing table content and an electronic device. When responding to an insertion operation for an image to be inserted, the device can obtain image attributes such as image size and insertion information in the table, thereby determining the cell in the table where the image to be inserted will be inserted. Then, based on the image attributes and/or insertion information, the image size of the image to be inserted and/or the cell size of the corresponding insertion cell can be adaptively adjusted to obtain a matching target image to be inserted and a target insertion area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115204131B_ABST
    Figure CN115204131B_ABST
Patent Text Reader

Abstract

The application provides a table content processing method and an electronic device. When responding to an insertion operation on a picture to be inserted, picture properties such as a picture size of the picture to be inserted and insertion information in a table are obtained, so that an insertion cell of the picture to be inserted in the table is determined. Then, based on the picture properties and / or the insertion information, the picture size of the picture to be inserted and / or the cell size of the corresponding insertion cell are adaptively adjusted, so that a matching target insertion picture and a target insertion region are obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates primarily to the field of data processing technology, and more specifically to a method for processing table content and an electronic device. Background Technology

[0002] In our daily work, we often need to insert images, links, and other content into spreadsheets (such as Excel documents) to enrich the content and meet our work requirements.

[0003] However, since the size of the image to be inserted often does not match the size of the cells in the table, after inserting the image into the table, it is necessary to manually adjust the cell and / or image size so that the inserted image can be displayed reasonably within the cell. This process is cumbersome and reduces processing efficiency and user experience. Summary of the Invention

[0004] In view of this, this application provides a method for processing table content, the method comprising:

[0005] In response to an insertion operation on an image to be inserted, the system obtains the image attributes of the image to be inserted and its insertion information in a table; wherein the image attributes include at least the image size, and the insertion information indicates the cell in which the image to be inserted is inserted in the table;

[0006] Based on the image attributes and / or the insertion information, adjust the image size of the image to be inserted and / or the cell size of the insertion cell to obtain the target insertion image and the target insertion area;

[0007] The target insertion image is displayed in the target insertion area.

[0008] Optionally, obtaining the insertion information of the image to be inserted in the table includes:

[0009] The display reference area for the image to be inserted is detected in the table, the area size of the display reference area is determined, and the cell at the first preset position in the display reference area is determined as the insertion cell for the image to be inserted.

[0010] The step of adjusting the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information to obtain the target insertion image and the target insertion area includes:

[0011] Adjust the cell size of the inserted cell according to the area size to obtain the target insertion area;

[0012] The image size of the image to be inserted is adjusted proportionally according to the area size to obtain the target inserted image; the image size of the target inserted image is less than or equal to the area size.

[0013] Optionally, the image attributes further include image type, and the step of adjusting the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information to obtain the target insertion image and the target insertion area further includes:

[0014] Once the image type is determined to be a text image, the candidate image size for the image to be inserted is obtained when the text content contained in the image to be inserted meets the preset text requirements.

[0015] Based on the comparison between the region size and the candidate image size, the image size of the image to be inserted and the cell size of the insertion cell are adjusted to obtain the target insertion image and the target insertion region.

[0016] Optionally, the image attribute further includes the image type, and obtaining the insertion information of the image to be inserted in the table includes:

[0017] If no display reference area for the image to be inserted is detected in the table, the cell at the second preset position in the display area of ​​the table is determined as the insertion cell for the image to be inserted.

[0018] The step of adjusting the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information to obtain the target insertion image and the target insertion area includes:

[0019] Once the image type is determined to be a text image, the image size of the image to be inserted is adjusted until the text content contained in the image to be inserted meets the preset text requirements, thus obtaining the target inserted image;

[0020] Adjust the cell size of the insertion cell according to the image size of the target image to obtain the target insertion area.

[0021] Optionally, obtaining the image attributes of the image to be inserted includes:

[0022] Perform text recognition on the image to be inserted to obtain the initial text content and text line spacing ratio of the image to be inserted;

[0023] Based on the initial text content and the text line spacing ratio, the target text content of the image to be inserted is obtained;

[0024] Based on the target text content, the image type of the image to be inserted is determined.

[0025] Optionally, the step of performing text recognition on the image to be inserted to obtain the initial text content and line spacing ratio of the image to be inserted includes:

[0026] Perform text recognition on the image to be inserted to obtain the text region contained in the image;

[0027] The image to be inserted is divided into horizontal and vertical segments according to the image pixel size to obtain the text coordinates of the text region, the line spacing of each character, the size of each character, and the image coordinates of the image to be inserted.

[0028] Using the text coordinates, the text area of ​​the text region is obtained; using the image coordinates, the image area of ​​the image to be inserted is obtained.

[0029] The ratio of the text area to the image area is determined as the initial text content;

[0030] Obtain the ratio between the line spacing size of each character and the size of each character in the corresponding line, and determine the average value of the ratio as the line spacing ratio of the text area.

[0031] Optionally, determining the average value of the ratios as the text line spacing ratio of the text region includes:

[0032] Obtain a first ratio between the same line spacing size and the size of the first line of text constituting that line spacing, and a second ratio between the same line spacing size and the size of the second line of text constituting that line spacing;

[0033] The average ratio of the first ratio and the second ratio is determined as the undetermined text line spacing ratio corresponding to the text line spacing.

[0034] The average value of the line spacing ratio of the text to be determined corresponding to the line spacing of each of the texts is obtained and determined as the line spacing ratio of the text region.

[0035] Optionally, obtaining the target text content of the image to be inserted based on the initial text content and the text line spacing ratio includes:

[0036] According to preset text layout requirements, determine the text density coefficient corresponding to the text line spacing ratio; the preset text layout requirements can characterize the correspondence between different line spacing ratio ranges and different text density coefficients;

[0037] The target text content of the image to be inserted is obtained using the initial text content and the text density coefficient.

[0038] Determining the image type to be inserted based on the target text content includes:

[0039] The target text content is compared with a preset text content threshold;

[0040] If the target text content is greater than the text content threshold, the image to be inserted is determined to be a text image;

[0041] If the target text content is less than or equal to the text content threshold, the image to be inserted is determined to be a non-text image.

[0042] Optionally, the text content contained in the image to be inserted conforms to preset text requirements, including:

[0043] Obtain the minimum text height that meets the preset text requirements from the preset text display rules, and adjust the image size of the image to be inserted according to the minimum text height to obtain the candidate image size or the target inserted image.

[0044] This application also proposes an electronic device, the electronic device comprising:

[0045] monitor;

[0046] The memory is used to store programs that implement the processing methods for the table content as described above;

[0047] A processor is used to load and execute the program stored in the memory to implement the table content processing method described above.

[0048] Therefore, this application provides a method for processing table content and an electronic device. When responding to an insertion operation for an image to be inserted, the device can obtain image attributes such as image size and insertion information in the table, thereby determining the cell in the table where the image to be inserted will be inserted. Then, based on the image attributes and / or insertion information, the image size of the image to be inserted and / or the cell size of the corresponding insertion cell can be adaptively adjusted to obtain a matching target image to be inserted and a target insertion area. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0050] Figure 1 A flowchart illustrating an optional example of the method for processing table content proposed in this application;

[0051] Figure 2This is a diagram illustrating the result of inserting an image directly into a table.

[0052] Figure 3 This is a diagram illustrating the results of manually adjusting the image size and cell size after inserting an image into a table.

[0053] Figure 4 A flowchart illustrating yet another optional example of the method for processing the table content proposed in this application;

[0054] Figure 5 A schematic diagram of the selected display reference area in the method for processing the table content proposed in this application;

[0055] Figure 6 This is a schematic diagram illustrating the adjustment of cell size for cells inserted in the display reference area in the table content processing method proposed in this application.

[0056] Figure 7 This is a schematic diagram illustrating an optional example of inserting and displaying an image to be inserted into a cell of a table, as part of the table content processing method proposed in this application.

[0057] Figure 8 A flowchart illustrating yet another optional example of the method for processing the table content proposed in this application;

[0058] Figure 9 A flowchart illustrating yet another optional example of the method for processing the table content proposed in this application;

[0059] Figure 10 A flowchart illustrating yet another optional example of the method for processing the table content proposed in this application;

[0060] Figure 11 A schematic diagram of the vertical and horizontal division of the image to be inserted in the method for processing the table content proposed in this application;

[0061] Figure 12 This is a schematic diagram illustrating another optional example of inserting and displaying an image to be inserted into a table cell in the table processing method proposed in this application.

[0062] Figure 13 A schematic diagram of an optional example of the apparatus for processing table content as proposed in this application;

[0063] Figure 14 A schematic diagram of the hardware structure of an optional example of an electronic device for processing the table content proposed in this application. Detailed Implementation

[0064] Regarding the description in the background section, in the application scenario of inserting images into table content, this application aims to simplify the insertion process. It can adaptively adjust the image size of the image to be inserted and / or the cell size of the cell to be inserted, based at least on the image size of the image to be inserted and / or the insertion information that represents the insertion cell in the table. This allows for quick and accurate determination of the target image and the target insertion area—that is, an image and insertion area with matching sizes. The complete target image is then displayed in the target insertion area, enhancing readability. This eliminates the need for manual adjustment of image and cell sizes, improving processing efficiency and the user experience of using the table.

[0065] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0066] Reference Figure 1 This is a flowchart illustrating an optional example of the table content processing method proposed in this application. This method can be executed by an electronic device, which may include, but is not limited to, user terminals such as smartphones, tablets, smart medical devices, smart transportation devices, and desktop computers. The product type can be determined based on the table content processing requirements in the application environment. Figure 1 As shown, the method for processing table content proposed in this embodiment may include:

[0067] Step S11: Respond to the insertion operation for the image to be inserted, and obtain the image attributes of the image to be inserted and the insertion information in the table;

[0068] In scenarios where any table to be processed is output using spreadsheet applications on electronic devices, and an image (denoted as the image to be inserted) needs to be inserted into the table content, if the image to be inserted is cropped, copied, or cut, and then the table to be processed is output, and the image to be inserted is pasted into a cell, or the image to be inserted is selected directly from the insert menu, the processing method proposed in this application can adaptively adjust the image size of the image to be inserted and the cell size, so that the image to be inserted is displayed in the cell of an appropriate size.

[0069] Therefore, when an electronic device receives an insertion operation (such as the paste operation mentioned above) for an image to be inserted, it can respond to the insertion operation and obtain the image attributes of the image to be inserted and the insertion information in the table. It should be noted that the image attributes may include at least the image size, and the insertion information can represent the cell in the table where the image to be inserted is inserted, such as the touch position information of the insertion operation performed on the table. This application does not limit the content of the insertion information and can be determined as appropriate.

[0070] In addition, the image to be inserted can be any image that has been retrieved, cropped, or cut, or it can be a thumbnail / homepage image of a linked video file, etc. This application does not restrict the content and source of the image to be inserted, and can be determined as appropriate.

[0071] Step S12: Based on image attributes and / or insertion information, adjust the image size of the image to be inserted and / or the cell size of the insertion cell to obtain the target insertion image and the target insertion area;

[0072] The original images to be inserted often have different dimensions from different sources, while the cell sizes in the table being processed are often relatively small. This results in a mismatch between the original image size and the cell size. If the image to be inserted directly into the table cell, such as... Figure 2 As shown, the inserted image is too large and will obscure multiple cells in the table. If these cells contain content, the inserted image will also obscure the content, reducing the readability of the table.

[0073] To improve the above problems, this application aims to adaptively adjust the image size of the image to be inserted and / or the cell size of the corresponding insertion cell. Specifically, this can be achieved based on the image attributes such as the image size of the image to be inserted and / or the insertion information, to obtain a target insertion image and a target insertion area (i.e., the area in the insertion cell that matches the image size of the target insertion image). The implementation process of adaptive adjustment of image size and / or cell size in this application embodiment will not be described in detail.

[0074] Step S13: Display the target insertion image in the target insertion area.

[0075] In this embodiment of the application, following the method described above, a target image with a matching size is determined, such as an image to be inserted with an adjusted image size, and a target insertion area for displaying the target image in the insertion cell. The target image can then be directly controlled to be displayed in the target insertion area. Figure 3As shown, while minimizing the impact on table readability, the integrity of the content displayed for the inserted image is ensured. Furthermore, since users do not need to manually adjust the size of the inserted cell or the size of the inserted image, processing efficiency and user experience with the table are improved.

[0076] Reference Figure 4 This is a flowchart illustrating another optional example of the table content processing method proposed in this application. This embodiment can describe an optional refined implementation of the table content processing method proposed above, such as... Figure 4 As shown, this refined implementation method may include:

[0077] Step S41: In response to the insertion operation for the image to be inserted, obtain the image size of the image to be inserted;

[0078] Step S42: Detect the display reference area in the table for the image to be inserted, and determine the area size of the display reference area;

[0079] After determining the image to be inserted through methods such as cropping, copying, or cutting, and then performing the insertion operation on the image within the table content output by the electronic device, one processing mechanism allows selecting a table range within the output table—that is, the range of cells where the image will be inserted. For example... Figure 5 As shown, the table area typically includes multiple cells. The size of the selected table area can be determined based on the display size requirements of the image to be inserted, so that the original image size and the cell size of the inserted image can be adaptively adjusted accordingly. Therefore, this application can designate the selected table area as the display reference area, and there are no restrictions on the method of selecting the table area or the numerical value of its size.

[0080] Based on the above analysis, in practical applications, when a user performs an insertion operation on an image to be inserted, including a selection operation on a display reference area consisting of one or more cells in a table, the electronic device responds to the insertion operation by not only obtaining the image size of the image to be inserted, i.e., the original image size, but also detecting the display reference area for the image to be inserted based on the insertion operation, and determining the area size of the display reference area, such as the width w and height h of the selected display reference area.

[0081] Step S43: The cell at the first preset position in the display reference area is determined as the insertion cell for the image to be inserted;

[0082] In this embodiment, the cell located at the upper left corner of the selected display reference area can be determined as the insertion cell for the image to be inserted. Therefore, the first preset position mentioned above can refer to the upper left corner position, which is the position of the first row and first column cell in the selected display reference area. That is, the insertion cell can be the cell in the first row and first column of the display reference area. Of course, this application can also flexibly adjust the content of the first preset position according to the actual situation, and this application does not limit it.

[0083] Step S44: Adjust the cell size of the inserted cell according to the size of the area to obtain the target insertion area;

[0084] Step S45: Adjust the size of the image to be inserted proportionally according to the size of the area to obtain the target inserted image;

[0085] Step S46: Display the target insertion image in the target insertion area.

[0086] To achieve adaptive adjustment of the image size to be inserted and the cell size to be inserted, and to ensure that the two sizes match after adjustment, after determining the display reference area and its size according to, but not limited to, the size of the area, the image size to be inserted and the cell size to be inserted can be automatically adjusted based on the size of the area.

[0087] The adjustment method described in steps 44 and S45 above is as follows: Figure 6 As shown, this application can adjust the cell size of the determined insertion cell to the area size, and determine the area where the adjusted insertion cell is located as the target insertion area. Therefore, the width of the target insertion area is w, and the height is h. Furthermore, in order to obtain an image size that matches the area size of the target insertion area, and to ensure that the adjusted image ratio remains unchanged, avoiding a decrease in image quality due to image ratio misalignment, the image size of the image to be inserted can be adjusted proportionally according to the shorter side length of the display reference area (i.e., the minimum matching value), until the adjusted image size reaches that side length, so that the adjusted image size has at least the width w or height h of the display reference area. In this embodiment, the image to be inserted with the adjusted image size is recorded as the target insertion image. Figure 7 As shown, this ensures that the size of the target inserted image matches the size of the target insertion area, thus completing the insertion and display of the target inserted image within the target insertion area.

[0088] Optionally, during the process of adjusting the original image size of the image to be inserted according to the area size of the display reference area, the image content can also be adjusted adaptively based on the image type of the image to be inserted, such as a text image. This can be achieved by adjusting parameters such as text size and line spacing, and is not limited to the proportional adjustment of the entire image to be inserted as described above.

[0089] In addition, during the process of proportionally adjusting the image to be inserted as described above, the proportional adjustment of the image to be inserted can also be achieved by using the size of other areas of the display reference area, or the difference between the size of the area and the original image size, etc., or by determining the adjustment parameters of the image size of the image to be inserted, and predicting the image size of the target inserted image according to the adjustment parameters, so that the target inserted image can be displayed according to the image size when the image is displayed later. This application does not limit the implementation method of how to automatically adjust the image size of the image to be inserted based on the area size of the selected display reference area, and can be determined as appropriate.

[0090] Furthermore, it should be noted that the execution order of the above-mentioned process of adjusting the cell size of the inserted cell and the process of adjusting the image size of the image to be inserted includes, but is not limited to, the order described in the above embodiments. They can also be executed simultaneously as needed. This application will not provide detailed examples of each of these.

[0091] In summary, for application scenarios involving inserting an image into a table, this application proposes a method to flexibly select a display reference area for the inserted image based on parameters such as the required display position and size of the image within the table, as well as the display position and size of the existing content in the table. For example, by selecting multiple cells, their display area can be determined as the display reference area for the inserted image. Subsequently, based on the area size, the cell size of the inserted cell at the first preset position within the display reference area, as well as the image size of the inserted image, can be adaptively adjusted to obtain a target inserted image and a target insertion area that match the size. This allows the target inserted image to be displayed appropriately within the target insertion area, significantly improving processing efficiency compared to manually adjusting the image size and cell size.

[0092] Reference Figure 8 This is a flowchart illustrating another optional example of the table content processing method proposed in this application. This embodiment can describe another optional refined implementation of the table content processing method proposed above, such as... Figure 8 As shown, this refined implementation method may include:

[0093] Step S81: In response to the insertion operation for the image to be inserted, obtain the image size and image type of the image to be inserted;

[0094] Step S82: If no display reference area for the image to be inserted is detected in the table, the cell at the second preset position in the display area of ​​the table is determined as the insertion cell for the image to be inserted.

[0095] In practical application of this embodiment, when a user performs an insertion operation for an image in the currently output table document, such as using a mouse, keyboard, or touch screen, after performing a paste operation for the image to be inserted, the user can select multiple cells constituting the table according to the method described above to determine the display reference area for the image to be inserted; alternatively, the user can choose not to select the display reference area. In this case, the user can directly determine the cell at the second preset position in the display area of ​​the table as the insertion cell for the image, according to the system default configuration. For example, in the table displayed on the screen of an electronic device, the user can select the cell at the top left corner (the cell position of the first row and first column in the display area of ​​the table output by the screen, i.e., the second preset position) as the insertion cell.

[0096] In some other embodiments, the second preset position can also be determined based on the table content displayed in the table display area output by the electronic device. For example, the second preset position can be determined by the position of the next cell adjacent to the last cell of the last row and last column of the table, where the next cell is the inserted cell. Optionally, this application can also determine the position of the input mark (such as the input cursor) in the table display area output by the electronic device as the second preset position, where the cell where the input mark is located is the inserted cell, etc. This application does not limit the content of the second preset position and its determination method, and can be determined as appropriate.

[0097] Step S83: Determine that the image type is a text image, adjust the image size of the image to be inserted until the text content contained in the image to be inserted meets the preset text requirements, and obtain the target inserted image;

[0098] Step S84: Adjust the cell size of the insertion cell according to the image size of the target image to obtain the target insertion area;

[0099] When resizing the image to be inserted into text content, the size of the text within the text content needs to be considered to ensure that the user can clearly see the image content inserted into the table. Therefore, this application can obtain the image type of the image to be inserted (the method for obtaining this information can be found in the description of the corresponding section of the following embodiments, which will not be detailed here). That is, it can detect whether the image to be inserted is a text image or a non-text image. If it is determined that the image to be inserted is a text image, preset text requirements configured for the text content contained in the image can be retrieved, such as requirements for text parameters such as font size / height in the text content. The required content can also be determined based on the viewing distance between the current user and the display of the output table. In this embodiment, the preset text requirements can characterize the readability of the text content after the image size of the inserted image is adjusted. Therefore, the preset text requirements can include minimum requirements to ensure the readability of the text content. This application does not limit the content of the preset text requirements or the method of determining them, and can be determined as appropriate.

[0100] In the process of dynamically adjusting the image size of the image to be inserted based on preset text requirements, the text content contained in the image to be inserted with the adjusted image size can be detected in real time or periodically. It can then be determined whether the detected text content meets the preset text requirements. If it does, the image to be inserted after this adjustment can be identified as the target image to be inserted. If it does not, it is usually because the font size is too large. Although the text content is readable, it will waste display area due to the large image size. In this case, the image size of the image to be inserted can be adjusted again (usually by reducing the image size). The method described above is used to continue to detect whether the text content of the image to be inserted after the image size adjustment meets the preset text requirements. This process is repeated until the text content of the image to be inserted after the image size adjustment meets the preset text requirements, and the target image to be inserted is obtained.

[0101] Optionally, during the process of dynamically adjusting the image size of the image to be inserted, the text content contained in the detected image to be inserted with the dynamically adjusted image size can be compared with the preset text requirements. Based on the comparison results, the image size of the image to be inserted can be adjusted in a targeted manner, thereby reducing the number of times the image size of the image to be inserted is adjusted and improving image processing efficiency.

[0102] In some other embodiments, the aforementioned preset text requirements may also include a range for adjusting the text parameters of the text content to ensure readability of the text content to be inserted into the image. This adjustable range may not consider the display area size occupied by the image to be inserted. Thus, during the process of adjusting the image size to be inserted accordingly, it is possible to detect whether the text parameters of the text content of the image to be inserted after each adjustment exceed the text parameter adjustment range, i.e., whether it meets the preset text requirements. However, this is not limited to detecting the text parameters; it can be determined based on the preset text requirements content determined in this embodiment.

[0103] Following the adjustment method described above, if it is determined that the text parameters of the text content in the adjusted image to be inserted reach the minimum value of the text parameter adjustment range, it can still be considered to meet the preset text requirements. However, if the image size is further adjusted in the same direction (e.g., shrinking), it may result in the text in the adjusted image being too small, reducing its readability. In this case, the text content of the image to be inserted can be considered not to meet the preset text requirements. Therefore, the image to be inserted whose text content met the preset text requirements after the previous adjustment can be used as the target image for insertion. Similarly, the process of scaling up the image size of the image to be inserted is similar, and will not be detailed in this embodiment.

[0104] Optionally, in the practical application of some of the above embodiments, the image size of the image to be inserted can also be adjusted based on the comparison result between the text parameters in the text content contained in the image to be inserted and the critical value in the corresponding adjustment direction within the preset text parameter adjustment range, so as to reduce the number of times the image size is adjusted and improve processing efficiency.

[0105] Step S85: Display the target insertion image in the target insertion area.

[0106] As can be seen, in this embodiment of the application, when the image to be inserted is determined to be a text image, considering the readability of the text content, during the process of adjusting the image size of the image to be inserted, it is possible to detect in real time whether the text content of the adjusted image to be inserted meets the preset text requirements, that is, whether the reduced text is still readable. If it is readable but the text content display size can still be reduced, it can be considered that the preset text requirements are not met, and the image size of the image to be inserted can be further reduced so that the text in the image to be inserted continues to shrink. This adjustment is repeated until the text display size in the reduced image to be inserted reaches the minimum value that is readable, that is, it is determined that the text content of the adjusted image to be inserted meets the preset text requirements, the image size of the image to be inserted is adjusted, the target inserted image is obtained, the readability of the text content in the image is guaranteed and the image size is reduced to the minimum size, reducing the size occupied by the table display area.

[0107] Afterwards, using the image size of the target inserted image obtained by the above method, the cell size of the cell to be inserted in the current output table can be adjusted so that the cell size matches the image size of the target inserted image. In this way, when the target inserted image is inserted into the target insertion area, the image content can be displayed completely and clearly in the target insertion area without wasting display area.

[0108] In some embodiments of this application, when it is determined that the image to be inserted is a non-text image, text readability can be disregarded, and the original image to be inserted can be determined as the target image to be inserted. The cell size of the inserted cell is adjusted according to the original image size of the image to be inserted, so that the area size of the target insertion area matches the image size. In this way, during the display of the target image in the target insertion area, the display area of ​​the entire table can be scaled to display the full content of the target image to be inserted. Even if the original image size of the image to be inserted can be fully displayed in the current table application window, it is not necessary to manually adjust the area size of the table display area and the cell size of the inserted cell, which improves processing efficiency and the user's experience in inserting table content.

[0109] Reference Figure 9 This is a flowchart illustrating another optional example of the table content processing method proposed in this application. This embodiment can describe another optional refined implementation of the table content processing method proposed above, and can describe an optional refined implementation of the process for obtaining the image type of the image to be inserted in the above embodiment, but is not limited to the image type obtaining method described in this embodiment, such as... Figure 9 As shown, the method may include:

[0110] Step S91: In response to the insertion operation for the image to be inserted, obtain the area size of the display reference area for the image to be inserted in the table, and the image size of the image to be inserted;

[0111] The implementation process of step S91 can be referred to the description of the corresponding part above, and will not be repeated here in this embodiment.

[0112] Step S92: Perform text recognition on the image to be inserted to obtain the initial text content and line spacing ratio of the image to be inserted.

[0113] Step S93: Based on the initial text content and text line spacing ratio, obtain the target text content of the image to be inserted;

[0114] Step S94: Determine the image type to be inserted based on the target text content;

[0115] In practical applications, the types of images to be inserted into a table can be divided into text images and non-text images. Since the readability standards of different image types are different, in order to ensure that the content of the inserted image can be clearly read later, the image type of the image to be inserted can be detected before adjusting the image size.

[0116] Therefore, this application proposes to determine whether an image to be inserted is a text image by analyzing the text content in the image to be inserted. In order to accurately obtain the text content of the image to be inserted, text recognition algorithms and / or image processing algorithms can be used to perform text recognition on the image to be inserted. If it is determined that the image to be inserted contains text content, the area of ​​the text contained in the original image to be inserted can be determined. The ratio between the text area and the image area of ​​the image to be inserted is determined as the initial text content of the image to be inserted, but it is not limited to this method of obtaining the initial text content.

[0117] During the process of reading the text content of the image to be inserted, when the same text area displays text content with different line spacing, the number of characters that the area can display is different. That is, the text content of the same text area with different line spacing is different. In order to improve the accuracy of text content, during the text recognition process of the image to be inserted, the text line spacing ratio of each text content can also be obtained. The implementation process can be referred to the description of the corresponding part of the detailed embodiment below. This embodiment will not be described in detail here.

[0118] It should be understood that the larger the line spacing ratio, the lower the text density and the lower the text content. Therefore, this embodiment can determine the calibration coefficient for the initial text content of the image to be inserted based on the obtained line spacing ratio of the image to be inserted. Then, the initial text content can be calibrated using the calibration coefficient to obtain the target text content of the image to be inserted, but it is not limited to this implementation method.

[0119] This application allows for the pre-configuration of a text content threshold as a critical value between text images and non-text images. The target text content of the desired inserted image is compared to this threshold. If the target text content is greater than the threshold, the image to be inserted is determined to be a text image; otherwise, it is determined to be a non-text image. This application does not impose restrictions on the value of the text content threshold or its determination method, and it can be flexibly adjusted according to actual circumstances.

[0120] Step S95: If the image type is a text image, obtain the candidate image size of the image to be inserted when the text content contained in the image to be inserted meets the preset text requirements;

[0121] Following the above description, in the scenario where a user inserts an image into any of the output tables, if the user selects a display reference area in the table and determines that the image to be inserted is a text image, this application proposes to automatically adjust the image size of the image to be inserted, as well as the cell size of the inserted cell, based on the text content of the image to be inserted and the area size of the display reference area.

[0122] The electronic device can record the width w1 and height h1 of the selected display reference area. During the adjustment of the image size, in conjunction with the description of the corresponding part of the above embodiment, the image size of the image to be inserted is automatically adjusted so that the text in the adjusted image to be inserted meets the preset text requirements, such as the text size meeting the minimum font size requirement (i.e. the minimum font size while ensuring the readability of the text). The adjusted image size is recorded at this time. For example, the candidate image size of the adjusted image to be inserted can be width w2 and height h2.

[0123] In practical applications, when obtaining the aforementioned candidate image sizes, the image size of the image to be inserted can be adjusted and predicted according to the method described above. To this end, a prediction model representing the prediction and adjustment method described above can be pre-constructed; that is, a model used to predict the candidate image size when the text content of the image to be inserted meets the preset text requirements. In this way, the image to be inserted can be directly input into the model to obtain the aforementioned candidate image size, but this calculation method is not the only option.

[0124] Step S96: Compare the size of the candidate image with the size of the region to obtain the corresponding comparison result;

[0125] Step S97: Based on the comparison result, adjust the image size of the image to be inserted and the cell size of the insertion cell at the first preset position in the display reference area to obtain the target insertion image and the target insertion area;

[0126] Step S98: Display the target insertion image in the target insertion area.

[0127] Since the aforementioned display reference area is used to indicate the image size / display area size of the image to be inserted after insertion, after obtaining the candidate image size, in order to ensure the integrity of the content display of the image to be inserted, a minimum matching method can be used to automatically adjust the image size and the cell size of the inserted cell. Therefore, the aforementioned candidate image size can be compared with the area size of the display reference area, and the smaller size (e.g., smaller area) can be determined as the adjustment reference size. Then, according to this adjustment reference size, the image size of the image to be inserted and the cell size of the inserted cell at the first preset position in the display reference area can be adjusted.

[0128] As analyzed above, the dimensions of the display reference area can include: the width w1 and height h1 of the display reference area, and the dimensions of the candidate image include the width w2 and height h2 of the candidate inserted image (i.e., the adjusted image obtained when the original image to be inserted is adjusted according to the method described above so that its text content meets the preset text requirements). Then, the minimum value operation can be performed, selecting min(w1*h1, w2*h2), which is determined as the adjustment reference dimensions: width w and height h. The image size of the image to be inserted is adjusted to w and h, and the cell size of the insertion cell in the first row and first column of the display reference area is adjusted to w and h. The adjusted target insertion image is then inserted and displayed in the target insertion area.

[0129] In some embodiments, when the method described above determines that the image to be inserted is a non-text image, the cell size of the insertion cell in the selected display reference area can be adjusted to the area size of the display reference area to obtain the target insertion area. Then, to ensure the integrity of the image to be inserted and to avoid obscuring or interfering with the content displayed in other cells, the image size of the image to be inserted can be scaled proportionally according to the smaller side length of the display reference area, using a minimum matching method, to obtain a target insertion image with that smaller side length. It is evident that the image size of the target insertion image is less than or equal to the area size of the aforementioned display reference area. For details on how to adjust the image size of the image to be inserted according to the area size, please refer to the corresponding description above.

[0130] Reference Figure 10 This is a flowchart illustrating another optional example of the table content processing method proposed in this application. This embodiment can describe another optional refined implementation of the table content processing method proposed above, and can further refine the implementation process of the method for obtaining the image type of the image to be inserted described above. Other implementation steps of the table content processing method can be referred to the descriptions of the corresponding parts of the above embodiments, and will not be detailed here. Figure 10 As shown, the method for processing table content described in this embodiment may include:

[0131] Step S101: In response to the insertion operation for the image to be inserted, obtain the image size of the image to be inserted;

[0132] Step S102: Perform text recognition on the image to be inserted to obtain the text region contained in the image to be inserted;

[0133] Step S103: Divide the image to be inserted into the image horizontally and vertically according to the image pixel size to obtain the text coordinates of the text area, the line spacing of each character, the size of each character, and the image coordinates of the image to be inserted.

[0134] In the embodiments of this application, such as Figure 11 As shown, the image to be inserted can be decomposed according to its pixel size, divided into horizontal and vertical regions, and the text coordinates of the image to be inserted (e.g., width w1, w2, w3...; height h1, h2, h3...) can be calculated accordingly. Therefore, the unit length for this text coordinate can be the image pixel size. The width coordinate can be determined based on the unit length of the horizontal division, and the height coordinate can be determined based on the unit length of the vertical division. This application does not limit the numerical value of the image pixel size (i.e., unit length) for the horizontal and vertical divisions; it can be determined based on the text size in the image to be inserted to improve the accuracy of the calculated text coordinates. Similarly, this embodiment can also determine the image coordinates of the image to be inserted based on the horizontal and vertical division results, so that the image size, text area size, etc., of the image to be inserted can be calculated subsequently.

[0135] Based on the above description of the text content of the image to be inserted, in order to understand the text content of the image to be inserted, in addition to determining the text coordinates of the text content contained in the image to be inserted and the image coordinates of the image to be inserted, the text line spacing size lead of each text line constituting the text content, as well as the font size of each text, can also be determined during the text recognition process. The implementation process will not be described in detail in this embodiment.

[0136] Step S104: Use text coordinates to obtain the text area of ​​the text region, and use image coordinates to obtain the image area of ​​the image to be inserted.

[0137] Step S105: Determine the ratio of text area to image area as the initial text content;

[0138] To more accurately determine the text area of ​​the text region containing the text content in the image to be inserted, text recognition and segmentation can be performed on the image to accurately determine the text coordinates of the smallest region containing each text content. Based on this, the text area of ​​the corresponding text content region can be calculated. The text areas of each text content are then summed to obtain the total text area of ​​the text region in the image to be inserted, i.e., the total text area of ​​all text content. For example, text area = w1*h1 + w2*h2 + w3*h3...

[0139] Similarly, the coordinates of the image to be inserted can be used, such as determining the coordinates of each endpoint in the outline of the image to be inserted. From this, a difference calculation can be performed to obtain the required side length. Then, based on the area calculation method, the area of ​​the image to be inserted can be obtained, that is, the area of ​​the image region occupied by the image to be inserted. Afterwards, the value of text area / image area can be determined as the initial text content of the image to be inserted.

[0140] Step S106: Obtain the ratio between the line spacing size of each text and the size of each text in the corresponding line, and determine the average value of the ratio as the text line spacing ratio of the text area in the image to be inserted.

[0141] In this embodiment of the application, in order to calculate the text line spacing ratio in the image to be inserted, the average value of the ratio between the text line spacing size and the text size can be calculated to obtain the text line spacing ratio of the text area in the image to be inserted. Optionally, this application can implement step S106 according to, but is not limited to, the calculation method of text line spacing ratio = average((lead1 / upper font1+lead1 / lower font1) / 2,(lead2 / upper font2+lead2 / lower font2) / 2……). Wherein, average() represents the average value function, lead1, lead2, lead3, etc. can represent different text line spacing sizes; upper font can represent the size of the upper text that constitutes the corresponding text line spacing (i.e., the first line of text that constitutes the text line spacing); lower font can represent the size of the lower text that constitutes the corresponding text line spacing (i.e., the second line of text that constitutes the text line spacing).

[0142] As shown in the above calculation formula, this application can obtain a first ratio (e.g., lead1 / upperfont1) between the same line spacing size (e.g., lead1) and the size of the first line of text constituting the line spacing (e.g., upper font1) of the corresponding text line, and a second ratio (e.g., lead1 / lower font1) between the same line spacing size (e.g., lead1) and the size of the second line of text constituting the line spacing (e.g., lower font1). Then, the average of the first and second ratios can be determined as the undetermined text line spacing ratio of the corresponding text line spacing, such as (lead1 / upper font1 + lead1 / lower font1) / 2. Similarly, for the undetermined text line spacing ratios of each text line spacing in the text area contained in the image to be inserted, the average of the undetermined text line spacing ratios corresponding to each text line spacing is calculated, and this average is determined as the text line spacing ratio of the text area in the image to be inserted. It should be noted that the implementation method of the above step S106 includes, but is not limited to, the average calculation method described above, and can be adaptively adjusted according to the needs of the scenario.

[0143] Step S107: Determine the text density coefficient corresponding to the text line spacing ratio according to the preset text layout requirements;

[0144] In this application embodiment, the preset text layout requirements can characterize the correspondence between different line spacing ratio ranges and different text density coefficients. They can be determined according to, but are not limited to, the requirements or standards followed by the corresponding industries. This application does not limit the content of the preset text layout requirements.

[0145] For example, this application can use line spacing of 1.2 to 1.45. Therefore, if the line spacing ratio of each text in the text area is between 1.2 and 1.45, it can be determined that the text density in the text area is appropriate, and the corresponding text density coefficient (i.e., the calibration coefficient for the initial text content) α = 1. If the line spacing ratio is less than 1.2, it can be considered that the text in the text area has a dense text density, and the text density coefficient α = 1.2. If the line spacing ratio is greater than 1.45, it can be considered that the text in the text area has a sparse text density, and the text density coefficient α = 0.8. However, it is not limited to the line spacing ratio range listed in this embodiment, and the value of the text density coefficient corresponding to each line spacing ratio can be determined as appropriate.

[0146] Step S108: Using the initial text content and text density coefficient, obtain the target text content of the image to be inserted;

[0147] Following the above analysis, the target text content of the image to be inserted is equal to the initial text content * α, but it is not limited to this method of calculating the target text content.

[0148] Step S109: Detect whether the target text content is greater than the text content threshold. If yes, proceed to step S1010; otherwise, proceed to step S1011.

[0149] Step S1010: Determine that the image to be inserted is a text image;

[0150] Step S1011: Determine that the image to be inserted is a non-text image.

[0151] Optionally, the aforementioned text content threshold can be 50%, which can be set by the system or customized according to actual conditions. This application does not impose any restrictions on its value. In this way, when the target text content of the image to be inserted is determined to be greater than 50%, the image to be inserted can be determined to be a text image; conversely, if the target text content of the image to be inserted is less than or equal to 50%, the image to be inserted can be determined to be a non-text image.

[0152] Referring to the descriptions in the corresponding sections of the above embodiments, during the automatic adjustment of images to be inserted that are text images, in order to ensure the readability of the text in the inserted image, it is necessary to determine the readability of the text after enlarging or shrinking the image. Therefore, during the image size adjustment process, it can be achieved based on preset text display rules and preset text requirements. These preset text display rules can characterize the correspondence between the operator's viewing distance and the table, and the minimum text height required to determine readable text. The preset text display rules can be determined with reference to industry standards such as industrial product artistic design.

[0153] Optionally, referring to the preset text display rules shown in Table 1 below, when an operator inserts an image into a table, the viewing distance between the operator and the table is often less than 80 centimeters. To ensure the readability of the text area in the table where the image is to be inserted, the text height can be set to at least 2.3 millimeters, approximately equivalent to a 6-point font size. Figure 12 As shown, the image size of the image to be inserted can be automatically adjusted according to the minimum text height that meets the preset text requirements in the minimum preset text display rules, so as to obtain the candidate image size or the target inserted image. This can be determined according to the application scenarios described in the above embodiments. Then, the insertion cell in the table for the image to be inserted can be adjusted according to the image size of the target inserted image to achieve size matching between the two.

[0154] <80 2.3 80-900 4.3 900-1800 8.6 1800-3600 17.3 3600-6000 28.7

[0155] Table 1

[0156] Based on the table content processing methods described in the above embodiments, when responding to an insertion operation for an image to be inserted, it can first be determined whether a display reference area for the image to be inserted is detected, that is, whether the operator has selected a display reference area in the table. If so, if the operator does not care whether the text in the image is clear or readable, the cell size of the insertion cell at the first preset position in the display reference area can be automatically adjusted to the area size of the display reference area, and the image size of the image to be inserted can be proportionally scaled to the width w or height h of the area size. The resulting target inserted image is then displayed in the insertion cell with the adjusted cell size, ensuring the integrity of the image display. There is no need to calculate the text content of the image to be inserted, which greatly reduces the amount of information to be calculated. There is also no need to manually adjust the image and cell sizes, thus improving image processing efficiency.

[0157] Optionally, after determining the above-mentioned display reference area, the image type of the image to be inserted can be further determined, so as to realize the adaptive adjustment of the image to be inserted and the cell to be inserted according to the processing mechanism corresponding to different image types, ensuring the readability of the text of the image to be inserted and the integrity of the image display after adjustment. The specific implementation process can be referred to the description of the corresponding embodiment above, and will not be repeated here.

[0158] In some other embodiments, following the detection method described above, if it is determined that the operator has not selected a display reference area in the table, and the readability of the text in the image to be inserted needs to be adjusted, the image type of the image to be inserted can be detected according to the image type acquisition method described above. Then, according to the processing mechanism corresponding to the determined text image or non-text image, adaptive adjustment of the image to be inserted and the inserted cell can be achieved, ensuring that the text in the image to be inserted is readable after adjustment, the image is displayed completely and does not obscure the content of other cells, thus improving image processing efficiency and table user experience. The specific implementation process can be referred to the description of the corresponding embodiment above, and will not be repeated here.

[0159] In some other embodiments, after the operator performs operations such as cropping, copying, or cutting on any selected image to determine the image to be inserted and performs the insertion operation in the table, when the electronic device responds to the insertion operation, considering that the text is readable in real time, it can simultaneously determine whether a display reference area has been selected in the table and the image type of the image to be inserted. Then, according to the processing mechanism corresponding to the determined results, the image to be inserted and the inserted cell can be adaptively adjusted to ensure that the text in the inserted image is readable and will not affect the reading of the content of other cells in the table. Moreover, the whole process does not require manual adjustment of the image size and cell size, which greatly improves the efficiency of image processing.

[0160] Reference Figure 13 The diagram shows an optional example of the apparatus for processing table content proposed in this application. Figure 13 As shown, the device may include:

[0161] The information acquisition module 131 is used to respond to the insertion operation for the image to be inserted, and to obtain the image attributes of the image to be inserted and the insertion information in the table;

[0162] The image attributes include at least the image size, and the insertion information can characterize the cell in which the image to be inserted is inserted in the table.

[0163] The adjustment module 132 is used to adjust the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information, so as to obtain the target insertion image and the target insertion area;

[0164] Display module 133 is used to display the target insertion image in the target insertion area.

[0165] In some embodiments, the information acquisition module 131 may include:

[0166] The display reference area size determination unit is used to detect the display reference area in the table for the image to be inserted, and determine the area size of the display reference area;

[0167] The first determining unit is used to determine the cell at the first preset position in the display reference area as the insertion cell for the image to be inserted;

[0168] Based on this, the aforementioned adjustment module 132 may include:

[0169] The first adjustment unit is used to adjust the cell size of the inserted cell according to the area size to obtain the target insertion area;

[0170] The second adjustment unit is used to proportionally adjust the image size of the image to be inserted according to the area size to obtain the target inserted image; the image size of the target inserted image is less than or equal to the area size.

[0171] Optionally, the above image attributes may also include image type; based on this, the adjustment module 132 may further include:

[0172] The candidate image size acquisition unit is used to determine that the image type is a text image and to obtain the candidate image size of the image to be inserted when the text content contained in the image to be inserted meets the preset text requirements.

[0173] The third adjustment unit is used to adjust the image size of the image to be inserted and the cell size of the insertion cell based on the comparison result between the region size and the candidate image size, so as to obtain the target insertion image and the target insertion region.

[0174] In some other embodiments proposed in this application, the above-mentioned image attributes may further include image type. Based on this, the above-mentioned information acquisition module 131 may also include:

[0175] The second determining unit is used to determine the cell at the second preset position in the display area of ​​the table as the insertion cell for the image to be inserted if no display reference area for the image to be inserted is detected in the table.

[0176] Based on this, the aforementioned adjustment module 132 may include:

[0177] The fourth adjustment unit is used to determine that the image type is a text image, adjust the image size of the image to be inserted until the text content contained in the image to be inserted meets the preset text requirements, and obtain the target inserted image;

[0178] The fifth adjustment unit is used to adjust the cell size of the insertion cell according to the image size of the target inserted image, so as to obtain the target insertion area.

[0179] Based on the descriptions of the embodiments above, in some other embodiments, the information acquisition module 131 may include:

[0180] The first obtaining unit is used to perform text recognition on the image to be inserted to obtain the initial text content and text line spacing ratio of the image to be inserted.

[0181] The target text content obtaining unit is used to obtain the target text content of the image to be inserted based on the initial text content and the text line spacing ratio;

[0182] The third determining unit is used to determine the image type of the image to be inserted based on the target text content.

[0183] Optionally, the first obtaining unit mentioned above may include:

[0184] A text recognition unit is used to perform text recognition on the image to be inserted, and obtain the text region contained in the image to be inserted;

[0185] The segmentation unit is used to segment the image to be inserted horizontally and vertically according to the image pixel size, to obtain the text coordinates of the text region, the line spacing of each character, the size of each character, and the image coordinates of the image to be inserted;

[0186] An area acquisition unit is used to obtain the text area of ​​the text region using the text coordinates and to obtain the image area of ​​the image to be inserted using the image coordinates.

[0187] An initial text content determination unit is used to determine the ratio of the text area to the image area as the initial text content;

[0188] The text line spacing ratio determination unit is used to obtain the ratio between the line spacing size of each character and the size of each character in the corresponding line, and to determine the average value of the ratio as the text line spacing ratio of the text area.

[0189] Optionally, the above-mentioned text line spacing ratio determination unit may include:

[0190] The ratio acquisition unit is used to acquire a first ratio between the same text line spacing size and the size of the first line of text constituting the text line spacing, and a second ratio between the same text line spacing size and the size of the second line of text constituting the text line spacing;

[0191] The undetermined text line spacing ratio determination unit is used to determine the average ratio of the first ratio and the second ratio as the undetermined text line spacing ratio corresponding to the text line spacing.

[0192] The mean calculation unit is used to obtain the average value of the line spacing ratio of the text to be determined corresponding to the line spacing of each of the texts, and to determine it as the line spacing ratio of the text region.

[0193] Optionally, the target text content obtaining unit mentioned above may include:

[0194] The text density coefficient determination unit is used to determine the text density coefficient corresponding to the text line spacing ratio according to the preset text layout requirements; the preset text layout requirements can characterize the correspondence between different line spacing ratio ranges and different text density coefficients;

[0195] An initial text content calibration unit is used to obtain the target text content of the image to be inserted using the initial text content and the text density coefficient.

[0196] Based on this, the aforementioned third determining unit may include:

[0197] A comparison unit is used to compare the target text content with a preset text content threshold.

[0198] A text image determination unit is used to determine that the image to be inserted is a text image if the comparison result of the comparison unit is that the target text content is greater than the text content threshold.

[0199] The non-text image determination unit is used to determine that the image to be inserted is a non-text image if the comparison result of the comparison unit is that the target text content is less than or equal to the text content threshold.

[0200] Optionally, the adjustment unit described above, in order to determine whether the text content contained in the image to be inserted meets the preset text requirements, may include:

[0201] The minimum text height acquisition unit is used to acquire the minimum text height that meets the preset text requirements in the preset text display rules;

[0202] The sixth adjustment unit is used to adjust the image size of the image to be inserted according to the minimum text height, so as to obtain the candidate image size or the target image to be inserted.

[0203] It should be noted that the various modules and units in the above-mentioned device embodiments can all be stored in the memory as program modules. The processor executes the above-mentioned program modules stored in the memory to realize the corresponding functions. The functions realized by each program module and its combination, as well as the technical effects achieved, can be referred to the description of the corresponding part of the above-mentioned method embodiments. This embodiment will not repeat them here.

[0204] This application also provides a computer-readable storage medium on which a computer program can be stored, which can be called and loaded by a processor to implement the various steps of the table content processing method described in the above embodiments.

[0205] Reference Figure 14 This is a schematic diagram of the hardware structure of an electronic device for an optional example of the method for processing table content proposed in this application. The electronic device may include a display 141, a memory 142, and a processor 143, wherein:

[0206] The number of each of the display 141, memory 142 and processor 143 can be at least one, and they can be connected to the communication bus of the electronic device to realize data transmission between them and data interaction with other I / O devices connected to the communication bus.

[0207] The display 141 can be used to output a table of images to be inserted. The input operations performed by the operator in the table, such as the insertion operation of the image to be inserted, the display reference area selected for the image to be inserted, the inserted cell, and the image to be inserted in the inserted cell, can be displayed according to the display requirements of the table content processing method proposed in this application, including but not limited to the display contents listed in this embodiment.

[0208] In practical applications, the aforementioned display 141 can be a touch display with a touch sensing unit that senses touch events on the touch display panel. This allows the operator to directly perform touch input operations on the touch display to insert images into the table. Optionally, the display 141 can also be a non-touch display. In this case, the electronic device can use other input components such as a keyboard, mouse, camera, or microphone to insert images into the table. This application does not limit the implementation method of the input operation.

[0209] The images to be inserted into the table can come from other applications on this electronic device or from other electronic devices. Therefore, in order to obtain data such as the images to be inserted, the table application on the electronic device usually includes a communication module to enable the electronic device to use wireless communication networks to achieve data interaction, such as a WIFI module, a 5G / 6G (fifth-generation mobile communication network / sixth-generation mobile communication network) module, a GPRS module, etc., to achieve data transmission with other electronic devices. Of course, the communication module can also include communication interfaces that enable data interaction between internal components of the electronic device, such as USB interfaces, serial / parallel ports, I / O interfaces, etc. This application does not limit the specific content of the communication module and can be determined as appropriate.

[0210] The memory 142 can be used to store a program that implements the table content processing method described in the above method embodiments; the processor 143 can load and execute the program stored in the memory to implement each step of the table content processing method described in the above corresponding method embodiments. The specific implementation process can be referred to the description of the corresponding part of the above embodiments, and will not be repeated here.

[0211] In this embodiment, memory 142 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device. Processor 143 may be a central processing unit (CPU), application-specific integrated circuit (ASIC), digital signal processor (DSP), application-specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA), or other programmable logic devices. This application does not limit the structure and model of the memory 142 and processor 143 described above, and they can be flexibly adjusted according to actual needs.

[0212] In one possible implementation, the memory 142 may include a program storage area and a data storage area. The program storage area may store the operating system, as well as the application programs required for at least one function (such as text display function, image processing function), and the program for implementing the table content processing method proposed in this application. The data storage area may store data generated during the use of the electronic device, such as text information entered by the user, selected images to be inserted, selected display reference areas, etc.

[0213] It should be understood that, Figure 14 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of this application. In practical applications, the electronic device may include more than Figure 14The electronic device may include more or fewer components, or combinations of certain components, as shown. In some embodiments, the electronic device may also include at least one output component such as a speaker, vibration mechanism, or lamp; an antenna; a sensor module; a power supply module, etc. Figure 14 The input and output components listed are not shown. The hardware structure can be determined according to the type of electronic device and its functional requirements. They are not listed here.

[0214] Finally, it should be noted that, regarding the above embodiments, unless the context explicitly indicates an exception, the words "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, and these steps and elements do not constitute an exclusive list; the method or apparatus may also include other steps or elements. An element defined by the phrase "comprising an..." does not exclude the presence of other identical elements in the process, method, product, or apparatus that includes the element.

[0215] In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more.

[0216] The terms used in this application, such as "first" and "second," are for descriptive purposes only, used to distinguish one operation, unit, or module from another, and do not necessarily require or imply any such actual relationship or order between these units, operations, or modules. Furthermore, they should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature.

[0217] Furthermore, the various embodiments in this specification are described in a progressive or parallel manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses and electronic devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section.

[0218] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for processing table content, the method comprising: In response to an insertion operation on an image to be inserted, the system obtains the image attributes of the image to be inserted and its insertion information in a table; wherein the image attributes include at least the image size, and the insertion information indicates the cell in which the image to be inserted is inserted in the table; Based on the image attributes and / or the insertion information, adjust the image size of the image to be inserted and / or the cell size of the insertion cell to obtain the target insertion image and the target insertion area; The target insertion image is displayed in the target insertion area; Obtaining the insertion information of the image to be inserted in the table includes: A display reference area for the image to be inserted is detected in the table, the size of the display reference area is determined, and the cell at the first preset position in the display reference area is determined as the insertion cell for the image to be inserted; the display reference area includes multiple cells in the table; The step of adjusting the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information to obtain the target insertion image and the target insertion area includes: Adjust the cell size of the inserted cell according to the area size to obtain the target insertion area; The image size of the image to be inserted is adjusted proportionally according to the area size to obtain the target inserted image; the image size of the target inserted image is less than or equal to the area size. The image attributes also include image type. The step of adjusting the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information to obtain the target insertion image and the target insertion area further includes: The image type is determined to be a text image. The candidate image size of the image to be inserted is obtained when the text content contained in the image to be inserted meets the preset text requirements. The preset text requirements can indicate that the text content after the image size of the image to be inserted is readable. Based on the comparison between the region size and the candidate image size, the image size of the image to be inserted and the cell size of the insertion cell are adjusted to obtain the target insertion image and the target insertion region.

2. The method according to claim 1, wherein the image attribute further includes image type, and obtaining the insertion information of the image to be inserted in the table includes: If no display reference area for the image to be inserted is detected in the table, the cell at the second preset position in the display area of ​​the table is determined as the insertion cell for the image to be inserted. The step of adjusting the image size of the image to be inserted and / or the cell size of the insertion cell based on the image attributes and / or the insertion information to obtain the target insertion image and the target insertion area includes: Once the image type is determined to be a text image, the image size of the image to be inserted is adjusted until the text content contained in the image to be inserted meets the preset text requirements, thus obtaining the target inserted image; Adjust the cell size of the insertion cell according to the image size of the target image to obtain the target insertion area.

3. The method according to any one of claims 1-2, wherein obtaining the image attributes of the image to be inserted includes: Perform text recognition on the image to be inserted to obtain the initial text content and text line spacing ratio of the image to be inserted; Based on the initial text content and the text line spacing ratio, the target text content of the image to be inserted is obtained; Based on the target text content, the image type of the image to be inserted is determined.

4. The method according to claim 3, wherein performing text recognition on the image to be inserted to obtain the initial text content and line spacing ratio of the image to be inserted includes: Perform text recognition on the image to be inserted to obtain the text region contained in the image; The image to be inserted is divided into horizontal and vertical segments according to the image pixel size to obtain the text coordinates of the text region, the line spacing of each character, the size of each character, and the image coordinates of the image to be inserted. Using the text coordinates, the text area of ​​the text region is obtained; using the image coordinates, the image area of ​​the image to be inserted is obtained. The ratio of the text area to the image area is determined as the initial text content; Obtain the ratio between the line spacing size of each character and the size of each character in the corresponding line, and determine the average value of the ratio as the line spacing ratio of the text area.

5. The method according to claim 4, wherein determining the average value of the ratio as the text line spacing ratio of the text region comprises: Obtain a first ratio between the same line spacing size and the size of the first line of text constituting that line spacing, and a second ratio between the same line spacing size and the size of the second line of text constituting that line spacing; The average ratio of the first ratio and the second ratio is determined as the undetermined text line spacing ratio corresponding to the text line spacing. The average value of the line spacing ratio of the text to be determined corresponding to the line spacing of each of the texts is obtained and determined as the line spacing ratio of the text region.

6. The method according to claim 3, wherein obtaining the target text content of the image to be inserted based on the initial text content and the text line spacing ratio comprises: Determine the text density coefficient corresponding to the line spacing ratio of the text according to the preset text layout requirements; The preset text layout requirements can represent the correspondence between different line spacing ratios and different text density coefficients; The target text content of the image to be inserted is obtained using the initial text content and the text density coefficient. Determining the image type to be inserted based on the target text content includes: The target text content is compared with a preset text content threshold; If the target text content is greater than the text content threshold, the image to be inserted is determined to be a text image; If the target text content is less than or equal to the text content threshold, the image to be inserted is determined to be a non-text image.

7. The method according to claim 2, wherein the text content contained in the image to be inserted conforms to preset text requirements, including: Obtain the minimum text height that meets the preset text requirements from the preset text display rules, and adjust the image size of the image to be inserted according to the minimum text height to obtain the candidate image size or the target inserted image.

8. An electronic device, the electronic device comprising: monitor; A memory for storing a program that implements the method for processing table content as described in any one of claims 1-7; A processor for loading and executing a program stored in the memory to implement the method for processing table content as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Picture adjusting method and device, equipment and storage medium

    CN112784543A

  • Images associated with cells in spreadsheets

    US20170124040A1