Data processing method, data processing device, electronic equipment and storage medium

By detecting and adding missing cells, the integrity of table data is ensured, the problem of incomplete cells when copying table data is solved, and the integrity of table data and user experience after pasting are improved.

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

Patent Information

Application Number
CN202410697024.0
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

During the process of copying table data, cells are copied incompletely, resulting in incomplete cell display when pasting table data, affecting user experience and work efficiency.

Method used

By detecting whether the data to be pasted contains table data, determine the target number of columns, and traverse the table data row by row to identify and add missing cells, ensuring that the total number of columns in each row is equal to the target number of columns, thereby ensuring the integrity of the table data when pasting sex.

Benefits of technology

It effectively solves the problem of incomplete cells when pasting table data, improves the accuracy and user experience of data processing, and ensures the integrity of table data after pasting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657130A
    Figure CN118657130A
Patent Text Reader

Abstract

The invention provides a data processing method, a data processing device, electronic equipment and a storage medium, and the method comprises the following steps: if it is detected that to-be-pasted data comprises table data, determining a target column number of the table data; on the basis of the target column number, traversing the table data line by line, and determining whether target lines with missing cells exist in the table data or not; if a target row with missing table cells exists in the table data, newly adding empty table cells in the target row to obtain updated table data; wherein the total column number of each row in the updated table data is equal to the target column number; and pasting the updated table data to the target editor. The method can ensure the integrity of the cells in the pasted table data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and more specifically, to a data processing method, a data processing device, an electronic device and a storage medium. Background Art

[0002] With the continuous development of digital technology, people will use tables to organize various information to improve the convenience of data organization in work or life.

[0003] Currently, due to incomplete cell copying during the process of copying table data, the cells are not displayed completely when the copied table data is pasted into a presentation document. Therefore, how to ensure the integrity of the cells in the pasted table data becomes an urgent problem to be solved. Summary of the invention

[0004] The present application provides a data processing method, a data processing device, an electronic device and a storage medium, which can ensure the integrity of cells in pasted table data.

[0005] In a first aspect, a data processing method is provided, the method comprising: if it is detected that the data to be pasted includes table data, determining a target number of columns of the table data; based on the target number of columns, traversing the table data row by row to determine whether there is a target row with missing cells in the table data; if there is a target row with missing cells in the table data, adding empty cells to the target row to obtain updated table data; wherein the total number of columns in each row of the updated table data is equal to the target number of columns; and pasting the updated table data into a target editor.

[0006] The above technical scheme, if it is detected that the data to be pasted includes table data, determines whether there is a target row with missing cells in the table data by traversing the table data row by row, and if there is a target row with missing cells in the table data, adds empty cells in the target row, and pastes the obtained updated table data into the target editor; since the table data is traversed row by row, empty cells are added to the target row with missing cells in the table data, so that the total number of columns in each row of the updated table data is equal to the target number of columns, thereby ensuring the integrity of the cells in the table data pasted into the target editor.

[0007] In combination with the first aspect, in some possible implementations, the method further includes: based on the total number of columns in each row of the table data, selecting the one with the largest value as the target number of columns; or, using the total number of columns in the first row of the table data as the target number of columns.

[0008] The above technical solution selects the one with the largest value as the target number of columns based on the total number of columns in each row of the table data; since the target number of columns is the maximum number of columns, the target number of columns is used as reference data for adding empty cells to the table data, which can ensure the integrity of the pasted table data; or, by using the total number of columns in the first row of the table data as the target number of columns, the rate of determining the target number of columns can be increased, thereby improving the efficiency of data processing.

[0009] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method also includes: traversing the table data row by row to obtain the total number of columns of each row in the table data; determining whether the total number of columns of the candidate row is less than the target number of columns; wherein the candidate row is any row of the table data; if the total number of columns of the candidate row is less than the target number of columns, determining the candidate row as the target row.

[0010] The above technical scheme determines whether the total number of columns of the candidate row is less than the target number of columns. If the total number of columns of the candidate row is less than the target number of columns, the candidate row is determined to be the target row; since any row of the candidate behavior table data can quickly determine the target row with missing cells by comparing the total number of columns of the candidate row with the target number of columns, the data processing rate is improved.

[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method also includes: if there is a target row with missing cells in the table data, taking the difference between the target number of columns and the total number of columns of the target row as the target number of missing cells in the target row; based on the target number, adding the empty cell after the last column of the target row to obtain the updated table data.

[0012] The above technical solution, when there is a target row with missing cells in the table data, adds empty cells to the target row by using the difference between the target number of columns and the total number of columns in the target row. This can ensure that the total number of columns in each row in the updated table data is equal to the target number of columns, ensure the integrity of the pasted table data, and thus improve user convenience.

[0013] In combination with the first aspect and the above-mentioned implementation manner, in some possible implementation manners, the method further includes: if it is detected that the data to be pasted includes a separator of the table data, determining that the data to be pasted includes the table data; or, if it is detected that the data to be pasted includes a label of the table data, determining that the data to be pasted includes the table data.

[0014] The above technical solution determines that the data to be pasted includes table data if it is detected that the data to be pasted includes a separator of table data; or determines that the data to be pasted includes table data if it is detected that the data to be pasted includes a label of table data; thereby quickly detecting the data to be pasted to determine whether the data to be pasted includes table data, thereby improving the accuracy of detecting the data to be pasted and the speed of detecting the data to be pasted.

[0015] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method also includes: detecting whether the table data includes an end flag code of the table data; if it is detected that the table data does not include the end flag code of the table data, determining the target number of columns of the table data.

[0016] The above technical solution determines the target number of columns of the table data when it is detected that the data to be pasted includes table data and the table data does not include the end marker code of the table data, which can improve data processing efficiency and thus improve user experience.

[0017] In combination with the first aspect and the above-mentioned implementation manner, in some possible implementation manners, the target editor is a rich text editor; the method further includes: if a paste instruction in the rich text editor is detected, obtaining the data to be pasted.

[0018] In a second aspect, a data processing device is provided, which includes: a detection module, for determining a target number of columns of the table data if it is detected that the data to be pasted includes table data; a determination module, for traversing the table data row by row based on the target number of columns to determine whether there is a target row with missing cells in the table data; an update module, for adding empty cells to the target row to obtain updated table data if there is a target row with missing cells in the table data; wherein the total number of columns in each row of the updated table data is equal to the target number of columns; and a pasting module, for pasting the updated table data into a target editor.

[0019] In a third aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store executable program code; the processor is used to call and run the executable program code from the memory, so that the electronic device executes the prompt method in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0020] In a fourth 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 data processing method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0021] In a fifth aspect, a computer program product is provided, which includes: a computer program code, which, when executed on a computer, enables the computer to execute the data processing method in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a schematic diagram of an application scenario of a data processing method provided in an embodiment of the present application;

[0023] Figure 2 is a schematic flow chart of a data processing method provided in an embodiment of the present application;

[0024] Figure 3 is a schematic flow chart of another data processing method provided in an embodiment of the present application;

[0025] Figure 4 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;

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

[0027] 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.

[0028] 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.

[0029] Figure 1 It is a schematic diagram of an application scenario of a data processing method provided in an embodiment of the present application.

[0030] For example, Figure 1 (a) in the figure shows a schematic diagram of the table data in the web page. Figure 1 (b) in the figure is a schematic diagram showing the data to be pasted into the rich text editor. Figure 1 (c) is a schematic diagram showing the updated table data pasted into the rich text editor.

[0031] For example, Figure 1 As shown in (a) Figure 1 As shown in (b), the table data in the webpage includes 2 rows and 3 columns. Since the 2nd row and 3rd column are empty cells, the empty cells are easily lost during the data copying process. Furthermore, the empty cells are lost during the data copying process, which will cause the lost empty cells to not be displayed when the data to be pasted is pasted into the rich text editor, resulting in incomplete display of cells in the pasted table data.

[0032] Since the cells in the pasted table data are not displayed completely, the user may need to spend extra time to process the table data, that is, to complete the cells in the table data, which brings inconvenience to the user.

[0033] For example, Figure 1 As shown in (c), when the data to be pasted includes table data, the table data is detected. If there is a target row with missing cells in the table data, empty cells are added to the table data to obtain updated table data, thereby ensuring the integrity of the cells in the updated table data.

[0034] Exemplarily, if a paste instruction in a rich text editor is detected, the data to be pasted is obtained, and it is detected whether the data to be pasted includes table data. If the data to be pasted includes table data, the target number of columns of the table data is determined, and the target number of columns is used to determine whether there are missing cells in the table data. Based on the target number of columns, the table data is traversed row by row to determine whether there are target rows with missing cells in the table data.

[0035] Furthermore, based on the target number of columns, the table data is traversed row by row to obtain the total number of columns in each row of the table data, and the total number of columns in the candidate row is detected to see if it is less than the target number of columns. The candidate row is any row of the table data; if the total number of columns in the candidate row is less than the target number of columns, the candidate row is determined to be the target row. If there is a target row with missing cells in the table data, an empty cell is added to the target row to obtain updated table data, and the updated table data is pasted into the rich text editor.

[0036] Specifically, if there is a target row with missing cells in the table data, determine the difference between the target number of columns and the total number of columns in the target row, use the difference as the target number of missing cells in the target row, and based on the target number, add empty cells after the last column of the target row to obtain updated table data.

[0037] Optionally, whether the data to be pasted includes table data can be determined by detecting whether the data to be pasted includes a delimiter of table data, that is, when it is detected that the data to be pasted includes a delimiter of table data, it is determined that the data to be pasted includes table data; or, it can be determined by detecting whether the data to be pasted includes a label of table data, that is, when it is detected that the data to be pasted includes a label of table data, it is determined that the data to be pasted includes table data.

[0038] Optionally, the total number of columns of each row in the table data is obtained, and the total number of columns of multiple rows in the table data with the largest value is used as the target number of columns; or the total number of columns of the first row in the table data is used as the target number of columns.

[0039] For example, the data to be pasted includes table data, the table data includes 2 rows, the 1st row of data includes 3 columns, and the 2nd row of data includes 1 column. The target number of columns is determined to be 3, and the target row is further determined to be the 2nd row. The target number of missing cells is determined based on the difference between the target number of columns and the total number of columns in the 2nd row. The target number is 2. New empty cells are added to the 2nd and 3rd columns of the 2nd row to obtain updated table data, and the updated table data is pasted into the rich text editor to ensure the integrity of the cells in the updated table data pasted into the rich text editor.

[0040] Exemplarily, when the data to be pasted includes table data, it is possible to further detect whether the table data includes the end marker code of the table data. If the table data includes the end marker code of the table data, the table data is pasted into the rich text editor; if the table data does not include the end marker code of the table data, the table data is processed to obtain updated table data, and the updated table data is pasted into the rich text editor.

[0041] It should be noted that due to incomplete data copying during the process of copying table data, the table display is incomplete when the copied table data is pasted into the presentation document. In view of this, the present application provides a data processing method, a data processing device, an electronic device and a storage medium, which can ensure the integrity of cells in the pasted table data.

[0042] Figure 2 It is a schematic flow chart of a data processing method provided in an embodiment of the present application.

[0043] For example, Figure 2 As shown, the method 200 includes the following processes:

[0044] S210: If it is detected that the data to be pasted includes table data, determine the target number of columns of the table data.

[0045] Exemplarily, by detecting data content contained in the data to be pasted, it is determined whether the data to be pasted includes table data. Specifically, if it is detected that the data to be pasted includes a separator of table data, it is determined that the data to be pasted includes table data; or if it is detected that the data to be pasted includes a label of table data, it is determined that the data to be pasted includes table data.

[0046] For example, by detecting the data to be pasted, if the data to be pasted contains,

[0047]

[0048]

[0049] , then it is determined that the data to be pasted includes table data. Alternatively, if the data to be detected contains a tabulation character (\t), then it is determined that the data to be pasted includes table data. The above scheme determines that the data to be pasted includes table data by detecting that the data to be pasted includes a delimiter of table data; or, if it is detected that the data to be pasted includes a label of table data, then it is determined that the data to be pasted includes table data; thereby quickly detecting the data to be pasted to determine whether the data to be pasted includes table data, thereby improving the accuracy of detecting the data to be pasted and the rate of detecting the data to be pasted. It is understandable that the integrity of the cells in the pasted table data is ensured, and empty cells are added to the table data of the missing cells. In order to further improve the data processing efficiency, when it is detected that the data to be pasted includes table data, it is detected whether the table data includes the end flag code of the table data. When it is detected that the table data does not include the end flag code of the table data, the target number of columns of the table data is determined; when it is detected that the table data includes the end flag code of the table data, the table data is pasted into the target editor. For example, when it is detected that the table data does not include (end mark code of table data), determine the target number of columns of table data; when the table data is detected, paste the table data into the target editor.

[0050] The above scheme determines the target number of columns of the table data when it is detected that the data to be pasted includes table data and the table data does not include an end marker of the table data, which can improve data processing efficiency and thus improve user experience.

[0051] It should be noted that the target editor is installed on the target device, and the data processing method can be executed by the target device.

[0052] Optionally, the target editor may be a rich text editor, an HTML editor, or the like.

[0053] Optionally, the target device may be a laptop computer, a conference tablet, or the like.

[0054] Exemplarily, if the target editor is a rich text editor, when a paste instruction in the rich text editor is detected, the data to be pasted is obtained, and when it is detected that the data to be pasted includes table data, the target number of columns of the table data is determined.

[0055] For example, if the target editor is Editablejs (rich text editor), when a paste instruction in the rich text editor is detected, the copied DOM element (data to be pasted) is obtained through the data acquisition interface inside Editablejs.

[0056] It should be noted that Editablejs is a rich text editor. Editablejs is a package in npm (Node Package Manager). A package in npm is used to indicate a module containing a specific function or library, which can be installed and implement a specific function. The target device can implement rich text editing by installing this package. The DOM (Document Object Modal) structure is the document object model that constitutes the page elements.

[0057] Exemplarily, when it is detected that the data to be pasted includes table data, the target number of columns of the table data is determined. In one example, based on the total number of columns in each row of the table data, the one with the largest value is selected as the target number of columns. In another example, the total number of columns in the first row of the table data is used as the target number of columns.

[0058] The above scheme selects the one with the largest value as the target number of columns based on the total number of columns in each row of the table data; since the target number of columns is the maximum number of columns, the target number of columns is used as reference data for adding empty cells to the table data, which can ensure the integrity of the pasted table data; or, by using the total number of columns in the first row of the table data as the target number of columns, the rate of determining the target number of columns can be increased, thereby improving the efficiency of data processing.

[0059] Exemplarily, the table data is traversed to determine the total number of columns in each row of the table data, and multiple total column numbers determined in the table data are compared to determine the maximum value of the multiple total column numbers, and the maximum value of the multiple total column numbers is determined as the target column number of the table data.

[0060] For example, if the table data has 5 rows, the total number of columns in the first row is 3, the total number of columns in the second row is 4, the total number of columns in the third row is 3, the total number of columns in the fourth row is 3, and the total number of columns in the fourth row is 3. Then the target number of columns for the table data is determined to be 4.

[0061] It is understandable that during the data copying process, if the table data includes multiple rows of data, there will be no missing cells in the first row of data. Specifically, the total number of rows of the table data is obtained, and when the total number of rows is greater than 1, the total number of columns in the first row of the table data is used as the target number of columns. For example, if the table data has 5 rows, and the total number of columns in the first row (row 1) is determined to be 5, then the target number of columns is determined to be 5.

[0062] S220 , based on the target number of columns, traverse the table data row by row to determine whether there is a target row with missing cells in the table data.

[0063] Exemplarily, the table data is traversed row by row to obtain the total number of columns in each row of the table data; whether the total number of columns of the candidate row is less than the target number of columns is determined, and the candidate row is any row of the table data; if the total number of columns of the candidate row is less than the target number of columns, the candidate row is determined to be the target row.

[0064] Exemplarily, the table data is traversed row by row to obtain the total number of columns of each row in the table data, and the total number of columns of each row in the table data is compared with the target number of columns to determine whether there is a target row with missing cells. Specifically, the comparison is performed in an ascending manner according to the number of rows of the table data, that is, the first row of the table data is taken as a candidate row, and the total number of columns of the candidate row is compared with the target number of columns to determine whether the total number of columns of the candidate row is less than the target number of columns. In the case where the total number of columns of the candidate row is less than the target number of columns, the candidate row is taken as the target row. Furthermore, in the case where the number of rows of the table data is greater than 1, the second row of the table data is taken as a candidate row, and the determination of whether the total number of columns of the candidate row is less than the target number of columns is continued until the traversal of the total number of columns of each row in the table data is completed.

[0065] For example, the target number of columns is 3, the total number of columns of the table data is 3, and the table data is traversed row by row to obtain the total number of columns of the first row of the table data is 3, the total number of columns of the second row is 3, and the total number of columns of the third row is 2. Then, the total number of columns of each row in the table data is compared with the target number of columns 3, and the third row is determined to be the target row.

[0066] The above scheme determines whether the total number of columns of the candidate row is less than the target number of columns. If the total number of columns of the candidate row is less than the target number of columns, the candidate row is determined to be the target row; since any row of the candidate row table data can quickly determine the target row with missing cells by comparing the total number of columns of the candidate row with the target number of columns, the data processing rate is improved.

[0067] S230: If there is a target row with missing cells in the table data, add empty cells to the target row to obtain updated table data.

[0068] It should be noted that the total number of columns in each row of the updated table data is equal to the target number of columns. By processing the data to be pasted, the integrity of the table data pasted into the target editor can be ensured.

[0069] Exemplarily, if there is a target row with missing cells in the table data, the difference between the target number of columns and the total number of columns in the target row is used as the target number of missing cells in the target row; based on the target number, new empty cells are added after the last column of the target row to obtain updated table data.

[0070] For example, if the table data has 2 rows and the target number of columns is 4, the total number of columns in the first row of the table data is 4, and the total number of columns in the second row is 2, the second row is determined as the target row. The difference between the target number of columns and the total number of columns in the target row is used as the target number of missing cells in the target row, that is, the difference between the target number of columns 4 and the total number of columns 2 in the second row is used as the target number. The target number is 2, and empty cells are added to the third and fourth columns of the second row to obtain updated table data.

[0071] It can be understood that by adding empty cells to the target row where there are missing cells in the table data, the positions of the missing cells in the table data can be supplemented, thereby obtaining complete updated table data.

[0072] In the above scheme, when there is a target row with missing cells in the table data, empty cells are added to the target row by using the difference between the target number of columns and the total number of columns in the target row. This can ensure that the total number of columns in each row of the updated table data is equal to the target number of columns, ensure the integrity of the pasted table data, and thus improve user convenience.

[0073] S240, pasting the updated table data into the target editor.

[0074] Optionally, the target editor may be a rich text editor, an HTML editor, or the like.

[0075] Exemplarily, when the data to be pasted includes table data, the data to be pasted is processed to obtain updated table data. Since the total number of columns in each row of the updated table data is equal to the target number of columns, the integrity of the cells in the updated table data can be ensured.

[0076] Exemplarily, the target editor is a rich text editor, the updated table data is pasted into the rich text editor, and the original cells in the updated table data are displayed in a first preset format by default, and the newly added empty cells are displayed in a second preset format. The original cells are used to represent the cells in the table data, so that the user can clearly determine the location and number of the newly added empty cells, thereby improving user convenience.

[0077] It should be noted that the total number of columns in each row in the above table data is the product of the number of merged cells in each row and the number of columns spanned by the merged cells, plus the number of unmerged cells in each row, as the total number of columns in each row.

[0078] The above technical scheme, if it is detected that the data to be pasted includes table data, determines whether there is a target row with missing cells in the table data by traversing the table data row by row, and if there is a target row with missing cells in the table data, adds empty cells in the target row, and pastes the obtained updated table data into the target editor; since the table data is traversed row by row, empty cells are added to the target row with missing cells in the table data, so that the total number of columns in each row of the updated table data is equal to the target number of columns, thereby ensuring the integrity of the cells in the table data pasted into the target editor.

[0079] Figure 3 It is a schematic flow chart of another data processing method provided in an embodiment of the present application.

[0080] For example, Figure 3As shown, the method 300 includes the following processes:

[0081] S301, copying data to be pasted from a web page.

[0082] Exemplarily, the data to be pasted is copied from the web page, and the data to be pasted is a DOM element. The DOM (DocumentObject Modal) structure is a document object model that constitutes the page elements.

[0083] S302, detecting whether the data to be pasted includes table data; if so, executing S303.

[0084] It can be understood that the data to be pasted is copied from the web page, and the data to be pasted is detected in the rich text editor, and the data to be pasted is processed to obtain updated table data, and the cells in the updated table data have integrity.

[0085] Exemplarily, when a paste instruction in Editablejs (rich text editor) is detected, the copied DOM element (data to be pasted) is obtained through a data acquisition interface inside Editablejs.

[0086] It should be noted that Editablejs is a rich text editor. Editablejs is a package in npm (Node Package Manager). A package in npm is used to indicate a module that contains a specific function or library and can be installed to implement a specific function. The target device can implement rich text editing by installing this package.

[0087] In addition, the elements used to represent table data in DOM are ; The row element used to represent the table data in DOM is ; The column elements used to represent the rows in the table in DOM are .

[0088] Exemplarily, by detecting data content contained in the data to be pasted, it is determined whether the data to be pasted includes table data. Specifically, if it is detected that the data to be pasted includes a separator of table data, it is determined that the data to be pasted includes table data; or if it is detected that the data to be pasted includes a label of table data, it is determined that the data to be pasted includes table data.

[0089] For example, by detecting the data to be pasted, if the data to be pasted contains 、

[0090]

[0091]

[0092]

[0093]

[0094]

[0095]

[0096]

[0097]

[0098]

[0099]

[0100]

[0101]

[0102]

[0103]

[0104]

[0105]

[0106]

[0107]

[0108]

[0109]

[0110]

[0111]

[0112]

[0113]

[0114]

[0115]

[0116]

[0117] Figures 1 to 3 Figure 4 Figure 5

[0118] Figure 4

[0119] Figure 4

[0120]

[0121]

[0122]

[0123]

[0124]

[0125]

[0126]

[0127]

[0128]

[0129]

[0130]

[0131]

[0132]

[0133]

[0134]

[0135]

[0136]

[0137]

[0138]

[0139]

[0140]

[0141] Figure 5

[0142] Figure 5

[0143]

[0144]

[0145]

[0146]

[0147]

[0148]

[0149]

[0150]

[0151]

[0152]

[0153]

[0154]

[0155] , then it is determined that the data to be pasted includes table data. Alternatively, if the data to be detected contains a tabulation character (\t), then it is determined that the data to be pasted includes table data. S303, traverse the table data row by row to determine whether the current row is the first row; if so, execute S304; if not, execute S305. Exemplarily, traverse the table data row by row, obtain the index of each row, and determine whether the current row is the first row based on the index of each row. S304, take the total number of columns in the first row as the target number of columns. Exemplarily, when the current row is the first row, obtain the total number of columns in the first row, and take the total number of columns in the first row as the target number of columns. It should be noted that in the process of determining the total number of columns in the first row, the colspan (number of columns spanned) of the first row is obtained, so as to determine the target number of columns based on the number of columns spanned. Specifically, the first value is determined based on the number of merged cells in the first row and the number of columns spanned by the merged cells; the second value is determined based on the number of unmerged cells in the first row, and the sum of the first value and the second value is taken as the target number of columns. For example, there are 2 merged cells in the first row, the number of columns spanned is 2, and the number of unmerged cells in the first row is 3, then the first value is determined to be 4, the second value is 3, and the target number of columns is 7. It is understandable that during the data copying process, if the table data includes multiple rows of data, there will be no missing cells in the first row of data. Specifically, the total number of rows of the table data is obtained, and when the total number of rows is greater than 1, the total number of columns in the first row of the table data is used as the target number of columns. For example, the table data has 5 rows, and the total number of columns in the first row (row 1) is determined to be 5 columns, then the target number of columns is determined to be 5 columns. S305, obtain the total number of columns for each row in the table data. Exemplarily, when the current row is not the first row, the total number of columns for each row in the table data is obtained row by row. It should be noted that in the process of determining the total number of columns for each row, the number of columns spanned by each row is obtained to determine the total number of columns for each row. Specifically, a third value is determined according to the number of merged cells in each row and the number of columns spanned by the merged cells; a fourth value is determined according to the number of unmerged cells in each row, and the sum of the third value and the fourth value is used as the total number of columns in each row. S306, determine whether the total number of columns of the candidate row is less than the target number of columns; if so, execute S307. It should be noted that the candidate row is any row in the table data. Exemplarily, the total number of columns of each row in the table data is obtained to determine whether the total number of columns of the candidate row is less than the target number of columns. If the total number of columns of the candidate row is less than the target number of columns, the candidate row is determined to be the target row. Exemplarily, the total number of columns of each row in the table data is obtained, and the total number of columns of each row in the table data is compared with the target number of columns to determine whether there is a target row with missing cells. Specifically, the total number of columns of the candidate row is compared with the target number of columns row by row, so as to determine whether the total number of columns of the candidate row is less than the target number of columns. S307, determine the target row of the candidate row. Exemplarily, when the total number of columns of the candidate row is less than the target number of columns, the candidate row is used as the target row.For example, the target number of columns is 3, the total number of columns of the table data is 3, and the table data is traversed row by row to obtain that the total number of columns in the first row of the table data is 3, the total number of columns in the second row is 3, and the total number of columns in the third row is 2. Then the total number of columns in each row of the table data is compared with the target number of columns 3, and the third row is determined to be the target row. Optionally, the target row may be 1, or may be greater than 1. The number of target rows is determined according to actual conditions and is not specifically limited here. S308, the difference between the target number of columns and the total number of columns of the target row is used as the target number of missing cells in the target row. Exemplarily, if there is a target row with missing cells in the table data, the difference between the target number of columns and the total number of columns of the target row is used as the target number of missing cells in the target row. For example, the table data is 2 rows, the target number of columns is 4 columns, the total number of columns in the first row of the table data is 4 columns, and the total number of columns in the second row is 2 columns, and the second row is determined to be the target row. The difference between the target number of columns and the total number of columns of the target row is used as the target number of missing cells in the target row, that is, the difference between the target number of columns 4 and the total number of columns 2 in the second row is used as the target number, and the target number is 2. S309, based on the target number, add empty cells after the last column of the target row to obtain updated table data. Exemplarily, add the target number of empty cells after the last column of the target row to obtain updated table data. For example, the table data is 2 rows, the target number of columns is 4 columns, the total number of columns in the first row of the table data is 4 columns, and the total number of columns in the second row is 2 columns, and the second row is determined to be the target row. The difference between the target number of columns and the total number of columns in the target row is used as the target number of missing cells in the target row, that is, the difference between the target number of columns 4 and the total number of columns 2 in the second row is used as the target number, and the target number is 2, then add empty cells in the third and fourth columns of the second row, thereby obtaining updated table data. Exemplarily, when the number of target rows is greater than 1, the difference between the target number of columns and the total number of columns of the target row is used as the target number of missing cells in the corresponding target row, and based on the target number, an empty cell is added after the last column of the target row. It should be noted that the total number of columns in each row of the updated table data is equal to the target number of columns. By adding empty cells to the target row with missing cells in the table data, the position of the missing cells in the table data can be supplemented, thereby obtaining complete updated table data. S310, paste the updated table data into a rich text editor. Exemplarily, when the data to be pasted includes table data, the pasted data is processed to obtain updated table data. Since the total number of columns in each row of the updated table data is equal to the target number of columns, the integrity of the cells in the updated table data can be ensured. It should be understood that the above examples are intended to help those skilled in the art understand the embodiments of the present application, rather than to limit the embodiments of the present application to the specific numerical values ​​or specific scenarios illustrated. According to the above examples given, it is obvious that various equivalent modifications or changes can be made by those skilled in the art, and such modifications or changes also fall within the scope of the embodiments of the present application.The above is combined with a detailed description of the data processing method provided by the embodiment of the present application; the following will be combined with a detailed description of the device embodiment of the present application. It should be understood that the device in the embodiment of the present application can execute the various methods of the aforementioned embodiments of the present application, that is, the specific working process of the following various products can refer to the corresponding process in the aforementioned method embodiment. It is a structural schematic diagram of a data processing device provided by an embodiment of the present application. Exemplarily, as shown, the data processing device 400 includes: a detection module 410: for determining the target number of columns of the table data if it is detected that the data to be pasted includes table data; a determination module 420: for traversing the table data row by row based on the target number of columns to determine whether there is a target row with missing cells in the table data; an update module 430: for adding empty cells to the target row if there is a target row with missing cells in the table data, and obtaining updated table data; wherein the total number of columns in each row of the updated table data is equal to the target number of columns; a paste module 440: for pasting the updated table data into the target editor. Optionally, as an embodiment, the detection module 410 is specifically used to: based on the total number of columns in each row of the table data, select the one with the largest value as the target number of columns; or, the total number of columns in the first row of the table data is used as the target number of columns. Optionally, as an embodiment, the prediction module 410 is specifically used to: traverse the table data row by row to obtain the total number of columns in each row of the table data; determine whether the total number of columns in the candidate row is less than the target number of columns; wherein the candidate row is any row of the table data; if the total number of columns in the candidate row is less than the target number of columns, determine the candidate row as the target row. Optionally, as an embodiment, the update module 430 is specifically used to: if there is a target row with missing cells in the table data, use the difference between the target number of columns and the total number of columns in the target row as the target number of missing cells in the target row; based on the target number, add an empty cell after the last column of the target row to obtain updated table data. Optionally, as an embodiment, the detection module 410 is specifically used to: if it is detected that the data to be pasted includes a separator of table data, determine that the data to be pasted includes table data; or, if it is detected that the data to be pasted includes a label of table data, determine that the data to be pasted includes table data. Optionally, as an embodiment, the data processing device 400 further includes a confirmation module, which is specifically used to: detect whether the table data includes an end flag code of the table data; the detection module 410 is specifically used to: if it is detected that the table data does not include an end flag code of the table data, determine the target number of columns of the table data. Optionally, as an embodiment, the target editor is a rich text editor; the data processing device 400 is also used to: if a paste instruction in the rich text editor is detected, obtain the data to be pasted. It should be noted that the above-mentioned data processing device 400 is embodied in the form of a functional unit. The term "module" here can be implemented in software and / or hardware form, and there is no specific limitation on this. For example, a "module" can be a software program, a hardware circuit, or a combination of the two that implements the above-mentioned functions.The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a proprietary processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a merged logic circuit, and / or other suitable components that support the described functions. Therefore, the units of each example described in the embodiments of the present application can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application. It is a structural diagram of an electronic device provided in an embodiment of the present application. Exemplarily, as shown, the electronic device 500 includes: a memory 510 and a processor 520, wherein an executable program code 530 is stored in the memory 510, and the processor 520 is used to call and execute the executable program code 530 to perform a data processing method. Exemplarily, the memory 510 can be used to store the relevant program of the data processing method provided in the embodiment of the present application; the processor 520 can call the relevant program of the data processing method stored in the memory 510 to execute the data processing method of the embodiment of the present application; for example, if it is detected that the data to be pasted includes table data, the target number of columns of the table data is determined; based on the target number of columns, the table data is traversed row by row to determine whether there is a target row with missing cells in the table data; if there is a target row with missing cells in the table data, an empty cell is added to the target row to obtain updated table data; wherein the total number of columns per row in the updated table data is equal to the target number of columns; the updated table data is pasted to the target editor. In this embodiment, the functional modules of the device can be divided according to the above method example, for example, corresponding to each functional module, or two or more functions can be integrated into one processing module, and the above integrated module can be implemented in the form of hardware. It should be noted that the division of the modules in this embodiment is schematic, which is only a logical function division, and there may be other division methods in actual implementation. In the case of dividing each functional module corresponding to each function, the device may also include a detection module, a determination module, an update module, and a paste module. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here. It should be understood that the device provided in this embodiment is used to perform the above data processing method, so it can achieve the same effect as the above implementation method. In the case of an integrated unit, the device may include a processing module and a storage module.Among them, the processing module can be a processor or a controller, which can implement or execute various exemplary logic boxes, modules and circuits shown in combination with the content disclosed in this application. The processor can 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 can be a memory. In addition, the device provided in the embodiments of the present application can be specifically a chip, a component or a module, and the chip may include a connected processor and a memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a data processing method provided in the above embodiment. The present application also provides a computer-readable storage medium, in which a computer program code is stored, and when the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a data processing method provided in the above embodiment. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a digital video disc (DVD), a compact disc read-only memory (CD-ROM), a microdrive, and a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a dynamic random access memory (DRAM), a video random access memory (VRAM), a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data. The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the above-mentioned related steps to implement a data processing method provided in the above-mentioned embodiment. Among them, the present application provides computer-readable storage media, computer program products or chips for executing the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.Through the description of the above implementation mode, the technicians 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 practical applications, the above-mentioned function distribution can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In the embodiments provided in the present application, it should be understood that the disclosed device and method 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. The above content is only a specific implementation mode 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 replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A data processing method, It is characterized in that The method comprises: If it is detected that the data to be pasted includes table data, determining the target number of columns of the table data; Based on the target number of columns, traverse the table data row by row to determine whether there is a target row with missing cells in the table data; If the target row with missing cells exists in the table data, an empty cell is added to the target row to obtain updated table data; wherein the total number of columns in each row of the updated table data is equal to the target number of columns; Paste the updated table data into the target editor.

2. The method according to claim 1, It is characterized in that The determining of the target number of columns of the table data includes: Based on the total number of columns in each row of the table data, select the one with the largest value as the target number of columns; or, The total number of columns in the first row of the table data is used as the target number of columns.

3. The method according to claim 1, It is characterized in that The step of traversing the table data row by row based on the target number of columns to determine whether there is a target row with missing cells in the table data comprises: Traversing the table data row by row to obtain the total number of columns in each row of the table data; Determine whether the total number of columns of the candidate row is less than the target number of columns; wherein the candidate row is any row of the table data; If the total number of columns of the candidate row is less than the target number of columns, the candidate row is determined to be the target row.

4. The method according to claim 1, It is characterized in that If the target row of the table data has missing cells, adding empty cells to the target row to obtain updated table data includes: If the target row has missing cells in the table data, the difference between the target number of columns and the total number of columns in the target row is used as the target number of missing cells in the target row; Based on the target quantity, the empty cell is added after the last column of the target row to obtain the updated table data.

5. The method according to claim 1, It is characterized in that If it is detected that the data to be pasted includes table data, the method includes: If it is detected that the data to be pasted includes the separator of the table data, it is determined that the data to be pasted includes the table data; or, If it is detected that the data to be pasted includes a tag of the table data, it is determined that the data to be pasted includes the table data.

6. The method according to claim 1, It is characterized in that The method further comprises: Detecting whether the table data includes an end flag code of the table data; The determining of the target number of columns of the table data includes: If it is detected that the table data does not include the end marker code of the table data, the target number of columns of the table data is determined.

7. The method according to claim 1, It is characterized in that The target editor is a rich text editor; the method further includes: If a paste instruction in the rich text editor is detected, the data to be pasted is obtained.

8. A data processing device, It is characterized in that The device comprises: A detection module, configured to determine the target number of columns of the table data if it is detected that the data to be pasted includes table data; A determination module, configured to traverse the table data row by row based on the target number of columns to determine whether there is a target row with missing cells in the table data; An updating module, configured to add empty cells to the target row if there is a target row with missing cells in the table data, so as to obtain updated table data; wherein the total number of columns in each row of the updated table data is equal to the target number of columns; The pasting module is used to paste the updated table data into the target editor.

9. An electronic device, It is 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 data processing method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed, the data processing method according to any one of claims 1 to 7 is implemented.