Text processing method and device and electronic equipment

By obtaining the number of rows and columns merged in the web table and inserting spaces, the page crash problem when copying and pasting the web table in the rich text editor is solved, and the structural supplement and functional normality of the web table and the rich text table are realized.

CN118657131APending Publication Date: 2024-09-17GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410697205.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Existing rich text editors can easily cause page crashes when copying and pasting web tables with merged cells, and cannot effectively handle the DOM structure differences between web tables and rich text tables.

Method used

By obtaining the number of merged rows and columns in the web table, determine the position of the merged cells, and insert spaces in the rich text editing page to supplement the structure, repair the DOM structure differences, and ensure the normal display and editing of the table.

Benefits of technology

It effectively avoids page crashes, ensures that the merged table function after pasting is available normally, and improves the compatibility of web tables and rich text tables.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657131A
    Figure CN118657131A
Patent Text Reader

Abstract

The invention provides a text processing method and device and electronic equipment, the method is applied to the technical field of computers, and the method comprises the following steps: in response to a pasting instruction for a webpage table, obtaining the webpage table for pasting, and obtaining the row and column combination number of each cell in the webpage table; determining that merged target cells exist in the webpage table based on the row and column merging number; acquiring a row position and a column position of the target cell in the webpage table; according to the row and column combination number, the row position and the column position of the target cell, a new blank space is inserted into the target cell, and a target table after structure supplementation is obtained; and pasting the target table after structure supplementation to a rich text editing page. According to the method, the problem of page crash caused by editing the table after the webpage table with the merged cells is copied to the rich text editing page can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a text processing method, device and electronic device in the field of computer technology. Background Art

[0002] Currently, due to the complexity of web tables and compatibility issues between web pages and rich text editors, some rich text editors may not support direct copy and paste of web tables. For example, after copying a table with merged cells from a web page to the Editablejs rich text editor, clicking any part of the table with merged cells will cause the editing page to crash. Summary of the invention

[0003] The present application provides a text processing method, device and electronic device, which can solve the problem of page crash that occurs when editing a webpage table with merged cells after copying the table to a rich text editing page.

[0004] In a first aspect, a text processing method is provided, the method comprising: in response to a paste instruction for a web page table, obtaining a web page table for pasting, obtaining the number of row and column merges of each cell in the web page table; determining a target cell in the web page table where a merge exists based on the number of row and column merges; obtaining the row position and column position of the target cell in the web page table; inserting a new space into the target cell according to the number of row and column merges, the row position and the column position of the target cell to obtain a target table with a supplemented structure; and pasting the target table with a supplemented structure on a rich text editing page.

[0005] By adopting the above technical solution, by obtaining the web page table for pasting, and determining the presence of merged cells in the web page table according to the number of row and column merges of each cell in the web page table, it is possible to quickly determine whether the web page table has merged rows and columns, and accurately obtain the merged cells. According to the row position, column position and the number of row and column merges of the cell, new spaces are inserted in the column direction and the row direction of the cell, so that the structure of the web page table can be supplemented, and the supplemented table is obtained, which fixes the difference in DOM structure between the web page table and the rich text table. The table with the supplemented structure is pasted on the rich text editing page, avoiding the page crash when editing the table on the rich text page after copying the web page table with merged cells to the rich text editing page, and ensuring that the function of the pasted merged table is normal and available.

[0006] In combination with the first aspect, in some possible implementations, obtaining the webpage form for pasting includes: determining a copy interface based on the paste instruction; and extracting the webpage form for pasting from the copy interface.

[0007] By adopting the above technical solution, the copied webpage table can be extracted from any webpage, application or clipboard that supports the copy function and pasted in the rich text editor to enhance flexibility. By identifying and adapting the corresponding copy interface according to the paste instruction, it can ensure that the webpage table obtained from various sources is processed correctly, improving the compatibility of the system.

[0008] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, obtaining the number of row and column merges of each cell in the web page table includes: traversing each cell row in the web page table, and the cell columns in each cell row, to obtain the number of row and column merges of each cell, wherein the number of row and column merges includes the number of column merges and the number of row merges.

[0009] By adopting the above technical solution, by traversing all cell rows and cell columns in each cell row, it is possible to ensure that no cell is missed, thereby quickly obtaining the complete structural information of the entire web page table, which helps to accurately identify merged cells in the web page table.

[0010] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the target cell where a merge exists in the web page table is determined based on the number of row and column merges, including: if the number of column merges is greater than 1, the cell is determined as a target cell where a column merge exists; and / or, if the number of row merges is greater than 1, the cell is determined as a target cell where a row merge exists.

[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the new space is inserted into the target cell according to the number of row and column mergers of the target cell, the row position and the column position, including: if the target cell is a target cell with column mergers, the row position of the first new space is determined based on the row position of the target cell, and the row position of the first new space is consistent with the row position of the target cell; the number of the first new spaces is determined based on the number of column mergers of the target cell, and the number of the first new spaces is the number of column mergers minus one; the column position of the first new space is determined based on the column position of the target cell and the number of the first new spaces; and the first new space is inserted based on the row position and column position of the first new space.

[0012] By adopting the above technical solution, when only column merging exists in the target cell, the row position of the target cell is determined as the row position of the first newly added space, so that the row position of the first newly added space and the row position of the target cell can be kept in the same row, thereby ensuring the vertical alignment and continuity of the table. By subtracting one from the number of column merging of the target cell to determine the number of the first newly added spaces, the number of newly added spaces that need to be inserted can be determined. For merged columns in the target cell, it is helpful to insert a sufficient number of newly added spaces to fill the merged cells, thereby ensuring the accuracy of space insertion. By accurately determining the column position of the newly added space based on the column position of the target cell and the number of newly added spaces that need to be inserted, it is ensured that the newly added space can be correctly filled in the right position of the target cell, thereby ensuring that the target table after structural supplementation can be correctly displayed in the rich text editor, avoiding page crashes when editing the target table.

[0013] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the new space is inserted into the target cell according to the number of row and column mergers of the target cell, the row position and the column position, including: if the target cell is a target cell with row mergers, the column position of the second new space is determined based on the column position of the target cell, and the column position of the second new space is consistent with the column position of the target cell; the number of the second new spaces is determined based on the number of row mergers of the target cell, and the number of the second new spaces is the number of row mergers minus one; the row position of the second new space is determined based on the row position of the target cell and the number of the second new spaces; and the second new space is inserted based on the row position and column position of the second new space.

[0014] By adopting the above technical solution, when only row mergers exist in the target cell, the column position of the target cell is determined as the column position of the second newly added space, so that the column position of the second newly added space and the column position of the target cell can be kept in the same column, thereby ensuring the horizontal alignment and continuity of the table. By subtracting one from the number of row mergers of the target cell to determine the number of second newly added spaces, the number of newly added spaces that need to be inserted can be determined. For merged rows in the target cell, it is helpful to insert a sufficient number of newly added spaces to fill the merged cells, thereby ensuring the accuracy of space insertion. By accurately determining the row position of the newly added space based on the row position of the target cell and the number of newly added spaces that need to be inserted, it is ensured that the newly added space can be correctly filled in the position directly below the target cell, thereby ensuring that the target table after structural supplementation can be correctly displayed in the rich text editor, avoiding page crashes when editing the target table.

[0015] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, after inserting the first newly added space based on the row position and column position of the first newly added space, it also includes: if the target cell still has a row merge, the target cell and the first newly added space are determined as the basic cell; the column position of the basic cell is obtained, and the column position of the third newly added space is determined based on the column position of the basic cell, and the column position of the third newly added space is consistent with the column position of the basic cell; based on the row position of the target cell and the number of row merges, the row position of the third newly added space is determined; based on the row position and the number of row merges of the third newly added space, the third newly added space is inserted.

[0016] By adopting the above technical solution, when there is both column merging and row merging in the target cell, after inserting the first newly added space into the target cell, the target cell and the first newly added space are determined as the base cell, providing a basis for the subsequent insertion of the third newly added space. By determining the column position of the third newly added space based on the column position of the base cell, it is ensured that the newly added space is in the same column as the base cell. By combining the row position of the target cell and the number of row merging to determine the row position of the third newly added space, the third newly added space is inserted according to the row position and column position of the third newly added space, ensuring that the newly added space is inserted in the correct position.

[0017] In combination with the first aspect and the above implementations, in some possible implementations, after inserting the new space into the target cell, the method further includes: setting the new space to a hidden mode.

[0018] By adopting the above technical solution, by setting each newly inserted space to be invisible, the display effect of the target table after structural supplementation on the rich text page is consistent with the display effect of the web page table before copying.

[0019] In a second aspect, a text processing device is provided, the device comprising:

[0020] A first acquisition unit is used to acquire the webpage table for pasting in response to a paste instruction for the webpage table, and acquire the number of merged rows and columns of each cell in the webpage table;

[0021] A determination unit, configured to determine a target cell to be merged in the webpage table based on the number of row and column merges;

[0022] A second acquisition unit, used to acquire the row position and column position of the target cell in the webpage table;

[0023] An inserting unit, used to insert a new space into the target cell according to the number of row and column merges, the row position and the column position of the target cell, to obtain a target table after structural supplementation;

[0024] The pasting unit is used to paste the target table after the structure is supplemented into the rich text editing page.

[0025] In a third aspect, an electronic device is provided, comprising: a memory for storing executable program code; and a processor for calling and running the executable program code from the memory, so that the electronic device executes the method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0026] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.

[0027] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a system architecture diagram of a text processing method provided in an embodiment of the present application;

[0029] Figure 2 It is a flowchart of a text processing method provided in an embodiment of the present application;

[0030] Figure 3 It is a flowchart of a text processing method provided in an embodiment of the present application;

[0031] Figure 4 It is a flowchart of a text processing method provided in an embodiment of the present application;

[0032] Figure 5 is an example schematic diagram of a text processing method provided in an embodiment of the present application;

[0033] Figure 6 is a structural schematic diagram of a text processing device provided in an embodiment of the present application;

[0034] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0035] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0037] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0038] The background content and professional terminology that may be involved in the embodiments of this application are as follows:

[0039] A Multi-function Text Editor (MTE) is a WYSIWYG text editor that can be embedded in a browser. Unlike an ordinary text box, a rich text editor allows users to input content including but not limited to pictures, videos, bold text, etc., making the rich text content that can be presented more colorful. Among them, the rich text editor can be Editable.js, which is a package of the Node Package Manager (npm). You can install this package to implement rich text editing.

[0040] Document Object Model (DOM) is a standard programming interface recommended by W3C for processing extensible markup languages, such as HTML and XML. DOM is a platform- and language-independent application programming interface (API) that can dynamically access programs and scripts to update their content, structure, and style of documents.

[0041] In the DOM structure, table is an element used to represent a table. The table element is the root element of the table and can include all other elements that make up the table, such as th, tr, and td. Among them, th is used to represent the header cell; tr is used to represent the row element of the table; and td is used to represent the column element in each row of the table.

[0042] For ease of understanding, in the embodiment of the present application, the cells in the first row and the first column of the entire merged cell are referred to as first cells, and the other merged cells except the first cell are referred to as second cells.

[0043] In the DOM structure, colspan is used to represent the column attributes of the table. Its attribute value is a number, which is used to represent the number of column merges in the cell. For example, when colspan is 2, it means that the current column where the first cell is located and the next column are merged. In the web page, the cell of the merged column, that is, the second cell, will not have the column element and column attribute of the merged column in the DOM structure; in the rich text editor, the column element and column attribute of the merged column still exist in the DOM structure, but the second cell of the merged column is set to be a hidden cell.

[0044] In the DOM structure, rowspan is used to represent the row attributes of a table. Its attribute value is a number, which is used to represent the number of cell row merges. For example, when rowspan is 2, it means that the current row where the first cell is located and the next row are merged. In the web page, the cell of the merged row, that is, the second cell, will not have the row elements and row attributes of the merged row in the DOM structure; in the rich text editor, the row elements and row attributes of the merged row still exist in the DOM structure, but the second cell of the merged row is set to be a hidden cell.

[0045] Currently, after copying a web table with merged cells into the Editable.js rich text editor (hereinafter referred to as the rich text editor), the page crashes when editing the copied web table. The main reason for this problem is that the DOM structure of the web table is inconsistent with the DOM structure of the target table copied to the rich text editing page. The rich text editor defines the DOM structure of the table as having corresponding DOM for all cells, and the same DOM structure is produced even for the merged second cell. It's just that the second cell and other cells, such as the first cell and the unmerged cell, have different display styles on the page, that is, the merged second cell is hidden on the rich text editing page.

[0046] However, the DOM structure of the web table does not contain the DOM structure of the merged second cell. Therefore, after copying the web table with merged cells into the rich text editor, the DOM structure of the web table will fail to parse, making the functions unable to correspond, resulting in page crash when clicking the copied web table in the rich text editing page.

[0047] In order to solve the above problems, the present application embodiment proposes a text processing system. Figure 1 , Figure 1 : is a system architecture diagram of a text processing method provided in an embodiment of the present application. Figure 1As shown, the system is used to respond to a paste instruction for a web page table, obtain the web page table for pasting from a copy interface; supplement the table structure of the web page table for pasting to obtain a target table with supplemented structure; and paste the target table with supplemented structure into a rich text editing page.

[0048] More specifically, in the process of using the text processing system to supplement the table structure of a web page table, the file processing system is also specifically used to obtain the number of row and column mergers of each cell in the web page table; determine the target cell that has a merger in the web page table based on the number of row and column mergers; obtain the row position and column position of the target cell in the web page table; insert new spaces into the target cell according to the row position, column position and number of row and column mergers of the target cell, and obtain the target table after the result is supplemented.

[0049] The text processing system in the embodiment of the present application can quickly determine whether there are merged rows and columns in the web page table, and accurately obtain the merged cells by obtaining the web page table for pasting and determining the presence of merged cells in the web page table according to the number of merged rows and columns of each cell in the web page table. According to the row position, column position and number of merged rows and columns of the cell, new spaces are inserted in the column direction and row direction of the cell, so as to achieve the structural supplement of the web page table and obtain the supplemented table, fix the difference in DOM structure between the web page table and the rich text table, and paste the supplemented table on the rich text editing page, so as to avoid the page crash when editing the table of the rich text page after copying the web page table with merged cells to the rich text editing page, and ensure the normal availability of the function of the pasted merged table.

[0050] based on Figure 1 The system architecture shown below will be combined with Figure 2-Figure 5 , the text processing method provided in the embodiment of the present application is introduced in detail.

[0051] See also Figure 2 , which is a flowchart of a text processing method provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps S101-S103.

[0052] S101, in response to a paste instruction for a webpage table, obtaining a webpage table for pasting, and obtaining the number of merged rows and columns of each cell in the webpage table;

[0053] The method provided in the embodiment of the present application can be implemented by a computer program, which can be integrated in an application or run as an independent tool application. The method can be applied to a vehicle terminal, a user terminal or a server. The embodiment of the present application takes the application of the method to a user terminal as an example, and the user terminal can include but is not limited to a mobile phone, a personal computer, a tablet computer, a handheld device, a wearable device, a computing device or other processing devices connected to a wireless modem.

[0054] In some embodiments, when a user selects a web page table in a web page by operating a user terminal and copies the selected web page table, the web page table is stored in a copy interface so that when a paste instruction for the web page table is subsequently triggered, the web page table for pasting is obtained from the copy interface and pasted.

[0055] More specifically, the rich text editor can be installed as an application in the user terminal and run independently, or it can be embedded in the browser and run. When the rich text editor application is run in the user terminal, or the browser with the rich text editor embedded is started to perform rich text editing, when facing the web page table that needs to be copied, one or more of the copy function modules provided by the user terminal, the copy function modules provided by the browser, and the copy function modules provided by the application can be used to select the web page table that needs to be copied and copy the web page table. Afterwards, the copied web page table is stored in a specific copy interface, which can be a copy interface provided by the user terminal, a copy interface provided by the browser, or a copy interface provided by the rich text editor application.

[0056] According to some embodiments, when the user terminal triggers a paste instruction for the web page form, the web page form for pasting is obtained from a specific copy interface in response to the paste instruction. The method for obtaining the web page form for pasting may be, for example, to determine the copy interface corresponding to the web page form according to the paste instruction of the web page form, wherein the copy interface may be a copy interface provided by the user terminal, a copy interface provided by the browser, or a copy interface provided by an application of a rich text editor; and the web page form for pasting is extracted from the determined copy interface.

[0057] According to some embodiments, for the web page table obtained for pasting, the row and column merge numbers of each cell in the web page table are obtained. The row and column merge number refers to the number of cell rows and cell columns occupied by the entire cell, and the row and column merge number may include the row merge number and the column merge number.

[0058] According to some embodiments, a method for obtaining the number of merged rows and columns of each cell in a web page table may be, for example, to traverse each cell row in the web page table, and further, based on each cell row, traverse the cell columns in the cell row to obtain the DOM structure of each cell; based on the obtained DOM structure of each cell, extract the number of merged rows and columns of each cell.

[0059] S102, determining a target cell to be merged in the webpage table based on the number of row and column merges;

[0060] In some embodiments, based on the number of row and column merges of each cell in the webpage table, it is determined whether there are merged cells in the webpage table, the merged cells are acquired and determined as the target cells.

[0061] According to some embodiments, whether there is a row-column merge in a cell is determined based on the row-column merge number of the cell. For example, it may be determined whether the column merge number of the cell is greater than 1; when the column merge number of the cell is greater than 1, it indicates that the number of unit columns occupied by the cell is greater than 1, and the cell is determined to be a target cell with a column merge; when the column merge number of the cell is equal to 1, it indicates that the cell only occupies one unit column, and the cell is determined to be a cell without a column merge. When the row merge number of the cell is greater than 1, it indicates that the number of unit rows occupied by the cell is greater than 1, and the cell is determined to be a target cell with a row merge; when the row merge number of the cell is equal to 1, it indicates that the cell only occupies one unit row, and the cell is determined to be a cell without a row merge. If both the column merge number and the column merge number of the cell are greater than 1, it indicates that the cell is obtained by merging multiple unit rows and unit columns, and therefore, the cell is determined to be a target cell with a column merge and a row merge.

[0062] S103, obtaining the row position and column position of the target cell in the webpage table;

[0063] In some embodiments, for a target cell that has been merged, the row position and column position of the target cell in the webpage table are obtained. The row position refers to the row number of the cell in the webpage table, and the column position refers to the column number of the cell in the webpage table.

[0064] It should be noted that, for ease of understanding, the embodiment of the present application refers to the cells in the first row and first column of the entire target cell as first cells, and refers to the other merged cells except the first cell as second cells.

[0065] In some embodiments, since the merged cell in the webpage table, i.e., the second cell, does not have a DOM structure, in the webpage table, the cell of the first row and the first column in the target cell, i.e., the row position and the column position of the first cell, are usually used as the row position and the column position of the target cell. That is, the row position of the merged target cell refers to the row number of the first cell in the target cell in the entire webpage table; the column position of the merged target cell refers to the column number of the first cell in the target cell in the entire webpage table.

[0066] S104, inserting a new space into the target cell according to the number of row and column merges, the row position and the column position of the target cell, to obtain a target table after structural supplementation;

[0067] In some embodiments, the row merging situation and / or column merging situation of the target cell can be determined based on the row and column merging number of the target cell, so as to determine the number of cells that need to be supplemented in the row direction and / or column direction when the target cell is structurally supplemented. The specific position of the target cell in the web page table can be located based on the row position and column position of the target cell. By combining the row and column merging number of the target cell, that is, the number of newly added spaces that the target cell needs to supplement in the row direction and / or column direction, and the row position and column position of the target cell, the row position and column position of each newly added space supplemented in the row direction and / or column direction can be determined. The newly added spaces are inserted correspondingly based on the row position and column position of each newly added space to obtain the target table after structural supplementation.

[0068] In some embodiments, if the target cell is a target cell with column merging, that is, the target cell only has column merging, first determine the row position of the first newly added space according to the row position of the target cell, wherein the row position of the first newly added space is consistent with the row position of the target cell. That is, the number of rows of the target cell in the webpage table is determined as the number of rows of the first newly added space in the webpage table. Then, subtract one from the number of column merging of the target cell to determine the number of first newly added spaces; determine the column position of the first newly added space according to the number of first newly added spaces and the column position of the target cell. More specifically, based on the row position of the first newly added space, traverse the number of column merging on the right side of the column position of the target cell and subtract it once to obtain the column position of each first newly added space. According to the determined row position and column position of each first newly added space, the first newly added space is inserted accordingly to obtain the target table after the structure is supplemented.

[0069] In some embodiments, if the target cell is a target cell with row merging, that is, the target cell only has row merging, first determine the column position of the second newly added space according to the column position of the target cell, wherein the column position of the second newly added space is consistent with the column position of the target cell. That is, the number of columns of the target cell in the webpage table is determined as the number of columns of the second newly added space in the webpage table. Then, subtract one from the number of row merging of the target cell to determine the number of second newly added spaces; determine the row position of the second newly added space according to the number of the second newly added spaces and the row position of the target cell. More specifically, based on the column position of the second newly added space, traverse the number of row merging just below the row position of the target cell and subtract it once to obtain the row position of each second newly added space. According to the determined row position and column position of each second newly added space, the second newly added space is inserted accordingly to obtain the target table after the structure is supplemented.

[0070] In some embodiments, if the target cell is a target cell with row and column merging, that is, when the target cell has column merging and row merging, the row position of the target cell is determined as the row position of the first newly added space; the number of column merging of the target cell is subtracted by one to determine the number of the first newly added spaces; the column position of the first newly added space is determined according to the number of the first newly added spaces and the column position of the target cell; according to the row position and column position of the first newly added space, after inserting the first newly added space, the target cell and the first newly added space are determined as the basic cell, and the basic cell is used as the basis for inserting the newly added space in the row direction. Then, the column position of each basic cell is obtained, and the column position of the third newly added space is determined according to the column position of each basic cell, wherein the column position of the third newly added space is consistent with the column position of each basic cell. That is, the number of columns of each basic cell in the webpage table is determined to be the number of columns of the third newly added space in the webpage table. Afterwards, the row position of the third newly added space is determined according to the row position of the target cell and the number of row merging. More specifically, based on the column position of each third newly added space, the row position of each third newly added space can be obtained by traversing the row merge number directly below the row position of the target cell minus one. According to the determined row position and column position of each third newly added space, the third newly added space is correspondingly inserted to obtain the target table after the structure is supplemented.

[0071] S105, pasting the target table after the structure supplementation into the rich text editing page.

[0072] In some embodiments, after the webpage table is structurally supplemented, a target table with the structural supplement is obtained, and the target table with the structural supplement is pasted into the rich text editing page.

[0073] The embodiment of the present application obtains a web page table for pasting, and determines the presence of merged cells in the web page table according to the number of row and column merges of each cell in the web page table. This can quickly determine whether the web page table has merged rows and columns, and accurately obtain the merged cells. According to the row position, column position and number of row and column merges of the cell, new spaces are inserted in the column direction and row direction of the cell, so as to achieve structural supplementation of the web page table, obtain the supplemented table, fix the difference in DOM structure between the web page table and the rich text table, paste the supplemented table on the rich text editing page, avoid the page crash when editing the table on the rich text page after copying the web page table with merged cells to the rich text editing page, and ensure that the function of the pasted merged table is normal and available.

[0074] See also Figure 3 , which is a flowchart of a text processing method provided in an embodiment of the present application. Figure 3 As shown, the method of the embodiment of the present application may include the following steps S201-S217.

[0075] S201, in response to a paste instruction for a webpage form, determining a copy interface based on the paste instruction;

[0076] S202, extracting a webpage table for pasting from the copy interface;

[0077] In some embodiments, when a user terminal triggers a paste instruction for a webpage form, the webpage form for pasting is obtained from a specific copy interface in response to the paste instruction. The method of extracting the webpage form for pasting may be, for example, determining the copy interface corresponding to the webpage form according to the paste instruction of the webpage form, wherein the copy interface may be one or more of a copy interface provided by the user terminal, a copy interface provided by a browser, or a copy interface provided by an application of a rich text editor; and extracting the webpage form for pasting from the determined copy interface.

[0078] Through the above steps, you can extract the copied web table from any web page, application or clipboard that supports the copy function and paste it in the rich text editor to enhance flexibility. By identifying and adapting the corresponding copy interface according to the paste instruction, you can ensure that the web table obtained from various sources is processed correctly, improving the compatibility of the system.

[0079] S203, traversing each cell row in the webpage table and each cell column in the cell row to obtain the row and column merging number of each cell, wherein the row and column merging number includes the column merging number and the row merging number;

[0080] In some embodiments, for a webpage table obtained for pasting, the row and column merge number of each cell in the webpage table is obtained, and the row and column merge number refers to the number of cell rows and cell columns occupied by the entire cell. More specifically, each cell row in the webpage table is traversed, and based on each cell row, the cell columns in the cell row are traversed to obtain the DOM structure of each cell; based on the obtained DOM structure of each cell, the row and column merge number of each cell is extracted, and the row and column merge number may include the row merge number and the column merge number.

[0081] By traversing all cell rows and cell columns in each cell row, it is possible to ensure that no cell is missed, thereby quickly obtaining the complete structural information of the entire web page table, which helps to accurately identify merged cells in the web page table.

[0082] S204, if the column merging number is greater than 1, determining the cell as a target cell for column merging;

[0083] In some embodiments, in the process of determining whether there is a target cell for merging in a web page table based on the number of row and column merges, if the column merge number of a cell is greater than 1, it means that the number of cell columns occupied by the cell is greater than 1, and the cell is determined to be a target cell for merging columns.

[0084] S205, obtaining the row position and column position of the target cell in the webpage table;

[0085] Specifically, the specific process of step S205 can be found in the description of step S103 in the above embodiment, which will not be repeated here.

[0086] S206, determining a row position of a first newly added space based on the row position of the target cell, wherein the row position of the first newly added space is consistent with the row position of the target cell;

[0087] In some embodiments, if the target cell is a target cell with column merging, that is, the target cell only has column merging, the row position of the first newly added space is determined according to the row position of the target cell, wherein the row position of the first newly added space is consistent with the row position of the target cell. That is, the number of rows of the target cell in the webpage table is determined as the number of rows of the first newly added space in the webpage table.

[0088] S207, determining the number of the first newly added spaces based on the number of merged columns of the target cell, the number of the first newly added spaces being the number of merged columns minus one;

[0089] S208, determining the column position of the first newly added space based on the column position of the target cell and the number of the first newly added spaces;

[0090] S209, inserting the first newly added space based on the row position and column position of the first newly added space;

[0091] In some embodiments, the number of first newly added spaces is determined by subtracting one from the number of column merges of the target cell; the column position of the first newly added space is determined based on the number of the first newly added spaces and the column position of the target cell. More specifically, based on the row position of the first newly added space, the column position of each first newly added space is obtained by traversing the column merge number on the right side of the column position of the target cell and subtracting it once. The first newly added space is inserted accordingly based on the determined row position and column position of each first newly added space.

[0092] Through the above steps, specifically by determining the row position of the target cell as the row position of the first newly added space when only column merging exists in the target cell, so that the row position of the first newly added space and the row position of the target cell can be kept in the same row, the vertical alignment and continuity of the table are ensured. By subtracting one from the number of column merging of the target cell as the number of the first newly added spaces, the number of newly added spaces that need to be inserted can be determined. For merged columns in the target cell, it is helpful to insert a sufficient number of newly added spaces to fill the merged cells, ensuring the accuracy of space insertion. By accurately determining the column position of the newly added space based on the column position of the target cell and the number of newly added spaces that need to be inserted, it is ensured that the newly added space can be correctly filled in the right position of the target cell, thereby ensuring that the target table after structural supplementation can be correctly displayed in the rich text editor, avoiding page crashes when editing the target table.

[0093] Optionally, the process of determining the target cell to be merged in the webpage table based on the number of row and column merges may further include:

[0094] S210, if the row merge number is greater than 1, determining the cell as a target cell for row merging;

[0095] In some embodiments, in the process of determining whether a target cell with a merge exists in a web page table based on the number of row and column merges, if the row merge number of a cell is greater than 1, indicating that the number of cell rows occupied by the cell is greater than 1, the cell is determined to be a target cell with a row merge.

[0096] S211, obtaining the row position and column position of the target cell in the webpage table;

[0097] Specifically, the specific process of step S211 can be found in the description of step S103 in the above embodiment, which will not be repeated here.

[0098] S212, if the cell is a target cell with a row merge, determining the column position of a second newly added space based on the column position of the target cell, the column position of the second newly added space being consistent with the column position of the target cell;

[0099] In some embodiments, if the target cell is a target cell with a row merge, that is, the target cell only has a row merge, the column position of the second newly added space is determined according to the column position of the target cell, wherein the column position of the second newly added space is consistent with the column position of the target cell. That is, the number of columns of the target cell in the webpage table is determined as the number of columns of the second newly added space in the webpage table.

[0100] S213, determining the number of the second newly added spaces based on the number of merged rows of the target cell, where the number of the second newly added spaces is the number of merged rows minus one;

[0101] S214, determining the row position of the second newly added space based on the row position of the target cell and the number of the second newly added spaces;

[0102] S215, inserting the second newly added space based on the row position and column position of the second newly added space;

[0103] In some embodiments, the number of row merges of the target cell is subtracted by one to determine the number of second newly added spaces; the row position of the second newly added space is determined based on the number of second newly added spaces and the row position of the target cell. More specifically, based on the column position of the second newly added space, the row merge number is traversed directly below the row position of the target cell and subtracted once to obtain the row position of each second newly added space. The second newly added space is inserted accordingly based on the determined row position and column position of each second newly added space.

[0104] S216, setting the newly added space to a hidden mode to obtain a target table after the structure is supplemented;

[0105] In some embodiments, after inserting the new space, the new space is set to hidden mode to obtain the target table after structural supplementation. That is, after inserting the first new space, the second new space and / or the third new space, each of the inserted new spaces is set to be invisible, so that the display effect of the target table after structural supplementation on the rich text page is consistent with the display effect of the webpage table before copying.

[0106] S217, pasting the target table after the structure supplementation into the rich text editing page.

[0107] In some embodiments, after obtaining the target table after structural supplementation, the target table after structural supplementation is pasted into the rich text editing page.

[0108] The embodiment of the present application, through the above steps, specifically, when there is only a row merge in the target cell, determines the column position of the target cell as the column position of the second newly added space, so that the column position of the second newly added space and the column position of the target cell can be kept in the same column, thereby ensuring the horizontal alignment and consistency of the table. By determining the number of second newly added spaces as the number of row merges of the target cell minus one, the number of newly added spaces that need to be inserted can be determined. For merged rows in the target cell, it is helpful to insert a sufficient number of newly added spaces to fill the merged cells, thereby ensuring the accuracy of space insertion. By accurately determining the row position of the newly added space based on the row position of the target cell and the number of newly added spaces that need to be inserted, it is ensured that the newly added space can be correctly filled in the position directly below in the target cell, thereby ensuring that the target table after the structure supplement can be correctly displayed in the rich text editor, avoiding the situation where the page crashes when editing the target table.

[0109] See also Figure 4 , which is a flowchart of a text processing method provided in an embodiment of the present application. Figure 4 As shown, the method of the embodiment of the present application may include the following steps S301-S315.

[0110] S301, in response to a paste instruction for a webpage form, determining a copy interface based on the paste instruction;

[0111] S302, extracting a webpage table for pasting from the copy interface;

[0112] S303, traversing each cell row in the webpage table and each cell column in the cell row to obtain the row and column merging number of each cell, wherein the row and column merging number includes the column merging number and the row merging number;

[0113] Specifically, for the specific process of step S301 to step S303, please refer to the description of step S201 to step S203 in the above embodiment, which will not be repeated here.

[0114] S304, if the column merging number and the row merging number are both greater than 1, determining the cell as a target cell for column merging and row merging;

[0115] In some embodiments, if the column merging number and the row merging number of the cell are both greater than 1, indicating that the cell is obtained by merging multiple cell rows and cell columns, the cell is determined as a target cell with column merging and row merging.

[0116] S305, obtaining the row position and column position of the target cell in the webpage table;

[0117] Specifically, the specific process of step S305 can be found in the description of step S103 in the above embodiment, which will not be repeated here.

[0118] S306, determining a row position of a first newly added space based on the row position of the target cell, wherein the row position of the first newly added space is consistent with the row position of the target cell;

[0119] S307, determining the number of the first newly added spaces based on the number of merged columns of the target cell, where the number of the first newly added spaces is the number of merged columns minus one;

[0120] S308, determining the column position of the first newly added space based on the column position of the target cell and the number of the first newly added spaces;

[0121] S309, inserting the first newly added space based on the row position and column position of the first newly added space;

[0122] Specifically, for the specific process of step S305 to step S308, please refer to the description of step S205 to step S208 in the above embodiment, which will not be repeated here.

[0123] S310, determining the target cell and the first newly added space as basic cells;

[0124] S311, obtaining the column position of the basic cell, and determining the column position of the third newly added space based on the column position of the basic cell, wherein the column position of the third newly added space is consistent with the column position of the basic cell;

[0125] S312, determining the row position of the third newly added space based on the row position of the target cell and the number of row merges;

[0126] S313: insert the third newly added space based on the row position and column position of the third newly added space.

[0127] In some embodiments, after inserting the first newly added space, the target cell and the first newly added space are determined as basic cells, and the basic cells are used as the basis for inserting the newly added space in the row direction. The column position of each basic cell is obtained, and the column position of the third newly added space is determined according to the column position of each basic cell, wherein the column position of the third newly added space is consistent with the column position of each basic cell. That is, the number of columns of each basic cell in the webpage table is determined to be the number of columns of the third newly added space in the webpage table. Afterwards, the row position of the third newly added space is determined according to the row position and the number of row merges of the target cell. More specifically, based on the column position of each third newly added space, the row position of each third newly added space is obtained by traversing the number of row merges directly below the row position of the target cell and subtracting it once. According to the determined row position and column position of each third newly added space, the third newly added space is correspondingly inserted.

[0128] S314, setting the first newly added space and the third newly added space to a hidden mode to obtain a target table after the structure is supplemented;

[0129] S315, pasting the target table after the structure supplementation into the rich text editing page.

[0130] In some embodiments, after inserting the first and third newly added spaces, each of the inserted newly added spaces is set to a hidden mode, so that the display effect of the target table after structural supplementation on the rich text page is consistent with the display effect of the webpage table before copying. Afterwards, the target table after structural supplementation is pasted in the rich text editing page.

[0131] For example, Figure 5 As shown, a webpage table used for pasting in a copy interface has 4 rows and 6 columns. From the DOM structure of the webpage table, we can see that the cell in the 2nd row and 3rd column of the webpage table has a column merge number colspan=3 and a row merge number rowspan=3. Therefore, we can know that the cell in the 2nd row and 3rd column is a 3*3 target cell with row and column merges.

[0132] For ease of understanding, this example refers to the cell in the first row and first column of the 3*3 target cells as the first cell, and the other merged cells except the first cell as the second cell. From the DOM structure of the webpage table, it can be seen that from the 2nd row to the 4th row of the webpage table, there is no DOM structure for each merged second cell.

[0133] However, the rich text editor defines the DOM structure of the table as all cells have corresponding DOM. Even for the merged second cell, the same DOM structure will be produced, but the second cell is displayed in hidden mode on the rich text editing page.

[0134] Therefore, in the process of copying a web table with row and column merges to a rich text editing page, in order to avoid page crashes when editing the web table after the web table is copied, when the paste instruction for the web table is triggered, the web table is extracted from the corresponding copy interface, and the number of row and column merges of each cell is obtained after traversing each cell row and each cell column in the web table. According to the number of column merges and row merges of the cell in the 2nd row and 3rd column of the web table, the cell in the 2nd row and 3rd column is determined as the target cell with row and column merges.

[0135] Get the row position and column position of the target cell in the web table. Since the merged cell in the web table, i.e. the second cell, does not have a DOM structure, the row position and column position of the first cell in the first row and first column of the target cell, i.e. the first cell, is usually used as the row position and column position of the target cell in the web table.

[0136] The row position of the target cell is determined as the row position of the first newly added space; the number of column merging of the target cell is subtracted by one to determine the number of the first newly added spaces; the column position of the first newly added space is determined based on the number of the first newly added spaces and the column position of the target cell; the first newly added space is inserted based on the row position and column position of the first newly added space.

[0137] Determine the target cell and the first added space as the basic cells, obtain the column position of each basic cell; determine the column position of each basic cell as the column position of the third added space; based on the column position of each third added space, traverse the number of row merges directly below the row position of the target cell minus one, to obtain the row position of each third added space. According to the determined row position and column position of each third added space, insert the third added space accordingly.

[0138] The inserted first and third newly added spaces are set to hidden mode, so that the display effect of the target table after structural supplementation on the rich text page is consistent with the display effect of the webpage table before copying. Afterwards, the target table after structural supplementation is pasted in the rich text editing page.

[0139] In the embodiment of the present application, if the target cell has both column merging and row merging, after inserting the first newly added space for the target cell, the target cell and the first newly added space are determined as the base cell, providing a basis for the subsequent insertion of the third newly added space. By determining the column position of the third newly added space based on the column position of the base cell, it is ensured that the newly added space is on the same column as the base cell. By combining the row position of the target cell and the number of row merging to determine the row position of the third newly added space, the third newly added space is inserted according to the row position and column position of the third newly added space, ensuring that the newly added space is inserted in the correct position.

[0140] based on Figure 1 The system architecture will be combined with the attached Figure 6 , the text processing device provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Figure 6 The text processing device in the present application is used to execute Figure 2-Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2-Figure 5 The embodiment shown.

[0141] See also Figure 6 , which shows a schematic diagram of the structure of a text processing device provided by an exemplary embodiment of the present specification. The text processing device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 at least includes a first acquisition unit 10, a determination unit 20, a second acquisition unit 30, an insertion unit 40 and a pasting unit 50.

[0142] A first acquisition unit 10 is used to acquire a webpage table for pasting in response to a pasting instruction for the webpage table, and acquire the number of merged rows and columns of each cell in the webpage table;

[0143] A determination unit 20, configured to determine a target cell to be merged in the webpage table based on the number of row and column merges;

[0144] A second acquisition unit 30 is used to acquire the row position and column position of the target cell in the webpage table;

[0145] An inserting unit 40, configured to insert a new space into the target cell according to the number of row and column merges, the row position and the column position of the target cell, to obtain a target table after structural supplementation;

[0146] The pasting unit 50 is used to paste the target table after the structure is supplemented on the rich text editing page.

[0147] According to some embodiments, the first acquisition unit 10 may further include an interface determination subunit 101 and a table extraction subunit 102, wherein the first acquisition unit 10 is used to acquire a webpage table for pasting:

[0148] An interface determination subunit 101, configured to determine a copy interface based on the paste instruction;

[0149] The table extraction subunit 102 is used to extract a webpage table for pasting from the copy interface.

[0150] According to some embodiments, the first acquisition unit 10 may further include a merge number determination subunit 104, wherein the first acquisition unit 10 is used to acquire the row and column merge numbers of each cell in the webpage table:

[0151] The merge number determination subunit 104 is used to traverse each cell row in the webpage table and each cell column in the cell row to obtain the row and column merge number of each cell, wherein the row and column merge number includes the column merge number and the row merge number.

[0152] According to some embodiments, the determination unit 20 may further include a column merging determination subunit 201 and a row merging determination subunit 202, wherein the determination unit 20 is configured to determine whether there is a merged target cell in the webpage table based on the number of row and column merging:

[0153] A column merging determination subunit 201 is used to determine the cell as a target cell for column merging if the column merging number is greater than 1;

[0154] The row merge determination subunit 202 is used to determine the cell as a target cell for row merging if the row merge number is greater than 1.

[0155] According to some embodiments, the insertion unit 40 may further include: a first row position determining subunit 401, a first quantity determining subunit 402, a first column position determining subunit 403, and a first space inserting subunit 404, wherein the insertion unit 40 is configured to insert a new space into the target cell according to the row and column merge number, the row position, and the column position of the target cell:

[0156] A first row position determining subunit 401 is configured to determine the row position of a first newly added space based on the row position of the target cell if the target cell is a target cell with a merged column, wherein the row position of the first newly added space is consistent with the row position of the target cell;

[0157] A first quantity determination subunit 402 is used to determine the number of the first newly added spaces based on the number of merged columns of the target cell, where the number of the first newly added spaces is the number of merged columns minus one;

[0158] A first column position determining subunit 403, configured to determine the column position of the first newly added space based on the column position of the target cell and the number of the first newly added spaces;

[0159] The first space inserting subunit 404 is configured to insert the first newly added space based on the row position and column position of the first newly added space.

[0160] According to some embodiments, the insertion unit 40 may further include: a second column position determining subunit 405, a second number determining subunit 406, a second row position determining subunit 407, and a second space inserting subunit 408, wherein the insertion unit 40 is configured to insert a new space into the target cell according to the number of row and column merges, the row position, and the column position of the target cell:

[0161] A second column position determination subunit 405 is configured to determine the column position of a second newly added space based on the column position of the target cell if the target cell is a target cell with a merged row, and the column position of the second newly added space is consistent with the column position of the target cell;

[0162] A second number determination subunit 406 is used to determine the number of the second newly added spaces based on the number of merged rows of the target cell, where the number of the second newly added spaces is the number of merged rows minus one;

[0163] A second row position determining subunit 407, configured to determine the row position of the second newly added space based on the row position of the target cell and the number of the second newly added spaces;

[0164] The second space inserting subunit 408 is used to insert the second newly added space based on the row position and column position of the second newly added space.

[0165] According to some embodiments, the inserting unit 40 may further include: a base determination subunit 409, a third column position determination subunit 410, a third row position determination subunit 411, and a third space insertion subunit 412, wherein the first space insertion subunit 404 is configured to insert, based on the row position and column position of the first newly added space, after the first newly added space:

[0166] A base determination subunit 409 is configured to determine the target cell and the first newly added space as base cells if there is a row merge in the target cell;

[0167] A third column position determination subunit 410 is used to obtain the column position of the basic cell, and determine the column position of the third newly added space based on the column position of the basic cell, wherein the column position of the third newly added space is consistent with the column position of the basic cell;

[0168] A third row position determining subunit 411 is used to determine the row position of the third newly added space based on the row position of the target cell and the number of row merges;

[0169] The third space inserting subunit 412 is used to insert the third newly added space based on the row position and column position of the third newly added space.

[0170] According to some embodiments, the apparatus 1 may further include a hiding unit 60, wherein after the inserting unit 40 is configured to insert a new space into the target cell:

[0171] The hiding unit 60 is used to set the newly added space to a hidden mode.

[0172] The embodiment of the present application obtains a web page table for pasting, and determines the presence of merged cells in the web page table according to the number of row and column merges of each cell in the web page table. This can quickly determine whether the web page table has merged rows and columns, and accurately obtain the merged cells. According to the row position, column position and number of row and column merges of the cell, new spaces are inserted in the column direction and row direction of the cell, so as to achieve structural supplementation of the web page table, obtain the supplemented table, fix the difference in DOM structure between the web page table and the rich text table, paste the supplemented table on the rich text editing page, avoid the page crash when editing the table on the rich text page after copying the web page table with merged cells to the rich text editing page, and ensure that the function of the pasted merged table is normal and available.

[0173] See also Figure 7 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 500 includes a processor 501 and a memory 502. The processor 501 is electrically connected to the memory 502.

[0174] The processor 501 is the control center of the electronic device 500 and may include one or more processing cores. The processor 501 uses various interfaces and lines to connect the various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or calling the computer program stored in the memory 502, and calling the data stored in the memory 502, so as to control the electronic device as a whole. Optionally, the processor 501 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 501 can integrate one or a combination of CPU, graphics processing unit (GPU), modem, etc. Among them, the CPU mainly processes the operating system, user pages and applications, etc.; the GPU is responsible for rendering and drawing the display content; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 501, but implemented separately through a communication chip.

[0175] The memory 502 can be used to store software programs and modules, and the processor 501 executes various functional applications and data processing by running the computer programs and modules stored in the memory 502. The memory 502 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, a computer program required for at least one function, etc.; the data storage area can store data created according to the use of the electronic device, etc.

[0176] In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.

[0177] In this embodiment, the processor 501 in the electronic device 500 loads instructions corresponding to the processes of one or more computer programs into the memory 502 according to the following steps, and the processor 501 runs the computer program stored in the memory 502 to implement various functions, as follows:

[0178] In response to a paste instruction for a webpage table, obtaining a webpage table for pasting, and obtaining the number of merged rows and columns of each cell in the webpage table;

[0179] Determine a target cell to be merged in the webpage table based on the number of row and column merges;

[0180] Obtaining the row position and column position of the target cell in the webpage table;

[0181] Inserting new spaces into the target cell according to the number of row and column merges, the row position and the column position of the target cell to obtain a target table with a supplemented structure;

[0182] Paste the target table with the supplemented structure into the rich text editing page.

[0183] Optionally, when executing to obtain the webpage table for pasting, the processor 501 specifically executes:

[0184] Determining a copy interface based on the paste instruction;

[0185] A web page table for pasting is extracted from the copy interface.

[0186] Optionally, when the processor 501 executes the step of obtaining the number of merged rows and columns of each cell in the webpage table, the processor 501 specifically executes:

[0187] Each unit row in the webpage table and each unit column in the unit row are traversed to obtain the row and column merging number of each cell, wherein the row and column merging number includes the column merging number and the row merging number.

[0188] Optionally, when the processor 501 determines whether there is a target cell to be merged in the webpage table based on the number of merged rows and columns, the processor 501 specifically performs:

[0189] If the column merging number is greater than 1, the cell is determined as a target cell where a column merging exists; and / or,

[0190] If the row merging number is greater than 1, the cell is determined as a target cell where row merging exists.

[0191] Optionally, when the processor 501 inserts a new space into the target cell according to the number of row and column merges, the row position, and the column position of the target cell, the processor 501 specifically executes:

[0192] If the target cell is a target cell with a merged column, the row position of the first newly added space is determined based on the row position of the target cell, and the row position of the first newly added space is consistent with the row position of the target cell;

[0193] Determine the number of the first newly added spaces based on the number of merged columns of the target cell, where the number of the first newly added spaces is the number of merged columns minus one;

[0194] Determining the column position of the first newly added space based on the column position of the target cell and the number of the first newly added spaces;

[0195] The first newly added space is inserted based on the row position and the column position of the first newly added space.

[0196] Optionally, when the processor 501 inserts a new space into the target cell according to the number of row and column merges, the row position, and the column position of the target cell, the processor 501 specifically executes:

[0197] If the target cell is a target cell with a merged row, the column position of the second newly added space is determined based on the column position of the target cell, and the column position of the second newly added space is consistent with the column position of the target cell;

[0198] Determine the number of the second newly added spaces based on the number of merged rows of the target cell, where the number of the second newly added spaces is the number of merged rows minus one;

[0199] Determining the row position of the second newly added space based on the row position of the target cell and the number of the second newly added spaces;

[0200] The second newly added space is inserted based on the row position and the column position of the second newly added space.

[0201] Optionally, after inserting the first newly added space based on the row position and column position of the first newly added space, the processor 501 may further execute:

[0202] If the target cell still has a row merge, the target cell and the first newly added space are determined as basic cells;

[0203] Acquire the column position of the basic cell, and determine the column position of the third newly added space based on the column position of the basic cell, wherein the column position of the third newly added space is consistent with the column position of the basic cell;

[0204] Determine the row position of the third newly added space based on the row position of the target cell and the number of row merges;

[0205] The third newly added space is inserted based on the row position and the column position of the third newly added space.

[0206] Optionally, after inserting a new space into the target cell, the processor 501 may further execute:

[0207] Set the newly added space to hidden mode.

[0208] See also Figure 8, is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 500 includes: a processor 501, a memory 502, a display screen 503, a camera component 504, an audio circuit 505, a sensor 506 and a power supply 507. The processor 501 is electrically connected to the display 503, the camera component 504, the audio circuit 505, the sensor 506 and the power supply 507 respectively.

[0209] The display screen 503 may be used to display information input by a user or information provided to a user and various graphical user interfaces of the electronic device. These graphical user interfaces may be composed of images, texts, icons, videos and any combination thereof.

[0210] The camera assembly 504 may include an image processing circuit, which may be implemented using hardware and / or software components and may include various processing units that define an image signal processing pipeline. The image processing circuit may include at least: multiple cameras, an image signal processor (ISP processor), a control logic, and an image memory, etc. Each camera may include at least one or more lenses and an image sensor. The image sensor may include a color filter array (such as a Bayer filter). The image sensor may obtain light intensity and wavelength information captured by each imaging pixel of the image sensor, and provide a set of raw image data that can be processed by an image signal processor.

[0211] The audio circuit 505 can be used to provide an audio interface between a user and an electronic device through a speaker and a microphone. The audio circuit 505 includes a microphone. The microphone is electrically connected to the processor 501. The microphone is used to receive voice information input by the user.

[0212] The sensor 506 is used to collect information of the electronic device itself, the user's information, or the external environment information. For example, the sensor 506 may include one or more of a vibration sensor, a temperature sensor, a distance sensor, a magnetic field sensor, a light sensor, an acceleration sensor, a fingerprint sensor, a Hall sensor, a position sensor, a gyroscope, an inertial sensor, a posture sensor, a barometer, a heart rate sensor, and the like.

[0213] The power supply 507 is used to supply power to various components of the electronic device 500. In some embodiments, the power supply 507 may be logically connected to the processor 501 through a power management system, so that the power management system can manage charging, discharging, power consumption, and other functions.

[0214] It should be understood that the device provided in the embodiment of the present application is used to execute the above-mentioned text processing method, and thus can achieve the same effect as the above-mentioned implementation method.

[0215] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to an electronic device, the processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device in executing related program codes, etc.

[0216] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.

[0217] In addition, the device provided in the embodiment of the present application can specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a text processing method provided in the above embodiment.

[0218] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement a text processing method provided in the above-mentioned embodiment.

[0219] This embodiment also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement a text processing method provided by the above embodiment.

[0220] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.

[0221] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0222] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0223] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A text processing method, characterized in that: The method comprises: In response to a paste instruction for a webpage table, obtaining a webpage table for pasting, and obtaining the number of merged rows and columns of each cell in the webpage table; Determine a target cell to be merged in the webpage table based on the number of row and column merges; Obtaining the row position and column position of the target cell in the webpage table; Inserting new spaces into the target cell according to the number of row and column merges, the row position and the column position of the target cell to obtain a target table with a supplemented structure; Paste the target table with the supplemented structure into the rich text editing page.

2. The method according to claim 1, characterized in that The step of obtaining the number of merged rows and columns of each cell in the webpage table includes: Each unit row in the webpage table and each unit column in the unit row are traversed to obtain the row and column merging number of each cell, wherein the row and column merging number includes the column merging number and the row merging number.

3. The method according to claim 2, characterized in that The determining, based on the number of row and column merges, that there is a target cell to be merged in the webpage table includes: If the column merging number is greater than 1, the cell is determined as a target cell where a column merging exists; and / or, If the row merging number is greater than 1, the cell is determined as a target cell for row merging.

4. The method according to claim 3, characterized in that The inserting a new space into the target cell according to the number of row and column merges of the target cell, the row position, and the column position includes: If the target cell is a target cell with a merged column, the row position of the first newly added space is determined based on the row position of the target cell, and the row position of the first newly added space is consistent with the row position of the target cell; Determine the number of the first newly added spaces based on the number of merged columns of the target cell, where the number of the first newly added spaces is the number of merged columns minus one; Determining the column position of the first newly added space based on the column position of the target cell and the number of the first newly added spaces; The first newly added space is inserted based on the row position and the column position of the first newly added space.

5. The method according to claim 3, characterized in that: The inserting a new space into the target cell according to the number of row and column merges of the target cell, the row position, and the column position includes: If the target cell is a target cell with a merged row, the column position of the second newly added space is determined based on the column position of the target cell, and the column position of the second newly added space is consistent with the column position of the target cell; Determine the number of the second newly added spaces based on the number of merged rows of the target cell, where the number of the second newly added spaces is the number of merged rows minus one; Determining the row position of the second newly added space based on the row position of the target cell and the number of the second newly added spaces; The second newly added space is inserted based on the row position and the column position of the second newly added space.

6. The method according to claim 4, characterized in that The method further comprises: inserting the first newly added space based on the row position and the column position of the first newly added space, and further comprising: If the target cell still has a row merge, the target cell and the first newly added space are determined as basic cells; Acquire the column position of the basic cell, and determine the column position of the third newly added space based on the column position of the basic cell, wherein the column position of the third newly added space is consistent with the column position of the basic cell; Determine the row position of the third newly added space based on the row position of the target cell and the number of row merges; The third newly added space is inserted based on the row position and the column position of the third newly added space.

7. The method according to claim 1, characterized in that The step of obtaining a webpage form for pasting includes: Determining a copy interface based on the paste instruction; A web page table for pasting is extracted from the copy interface.

8. The method according to claim 1, characterized in that: After inserting the new space into the target cell, the method further includes: Set the newly added space to hidden mode.

9. A text processing device, characterized in that: The device comprises: A first acquisition unit is used to acquire the webpage table for pasting in response to a paste instruction for the webpage table, and acquire the number of merged rows and columns of each cell in the webpage table; A determination unit, configured to determine a target cell to be merged in the webpage table based on the number of row and column merges; A second acquisition unit, used to acquire the row position and column position of the target cell in the webpage table; An inserting unit, used to insert a new space into the target cell according to the number of row and column merges, the row position and the column position of the target cell, to obtain a target table after structural supplementation; The pasting unit is used to paste the target table after the structure is supplemented into the rich text editing page.

10. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the electronic device executes the method according to any one of claims 1 to 8.