Table content generation method, apparatus and device
By obtaining the column width of the first column of the target table and generating the second column of the corresponding column width in the rich text editor, the problem of table content display distortion in the rich text editor is solved, and accurate table content is achieved show.
Patent Information
- Application Number
- CN202410800729.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-10-11
AI Technical Summary
In the rich text editor, the table content cannot be displayed accurately, resulting in distortion of the table content and the original table.
By obtaining the column width of the first column in the target table and generating the corresponding second column in the rich text editor, ensure that the column width of the second column is consistent with the first column, so that when the column width is appropriate The table contents are displayed in the second column.
It effectively avoids the distortion problem of table content display in the rich text editor and ensures that the table content is accurately displayed under the appropriate column width.
Smart Images

Figure CN118761392A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of web pages, and more specifically, to a method, device, and apparatus for generating table content in the field of web pages. Background Art
[0002] With the development of information technology, the application of websites is becoming more and more extensive. Hypertext Markup Language (HTML) has cross-platform characteristics. It can run on different operating systems and devices and is an indispensable part of web page development.
[0003] When using web page content, it is usually necessary to copy the table content in the web page into a rich text editor. However, when the table content is displayed in the rich text editor, distortion occurs and the table content cannot be accurately displayed. Summary of the invention
[0004] The present application provides a method, device, and equipment for generating table content. The method can display the table content in a second column table with appropriate column width, thereby avoiding the problem of distortion between the table content in the second column table and the table content in the first column table in a rich text editor.
[0005] In a first aspect, a method for generating table content is provided, the method comprising: in response to a selection operation triggered by a user, obtaining a target table selected by the selection operation in a global table; obtaining a first column table currently traversed in the target table, and obtaining a first column width of the first column table; determining a second column table corresponding to the first column table in a rich text editor, and determining a second column width of the second column table based on the first column width of the first column table; generating a second column table in the rich text editor based on the second column width, and adding the table content of the first column table to the second column table.
[0006] By adopting the above scheme, the second column width of the second column table in the rich text editor is determined based on the first column width of the first column table, and then the second column table corresponding to the first column table is generated in the rich text editor based on the second column width. Since the second column width of the second column table generated in the rich text editor corresponds to the first column width of the first column table, when the table content of the first column table is added to the second column table of the rich text editor, the table content can be displayed in the second column table with appropriate column width, thereby avoiding the problem of distortion between the table content of the second column table in the rich text editor and the table content of the first column table.
[0007] In combination with the first aspect, in some possible implementations, obtaining the first column table currently traversed in the target table includes: determining the target column table corresponding to the currently traversed value in the target table; and determining the target column table as the first column table currently traversed.
[0008] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, determining the target column table corresponding to the current traversal value in the target table includes: if the current traversal value is the initial traversal value, obtaining the column attribute of the third column table pointed to by the current traversal value in the target table; if the column attribute is a non-merged attribute, determining the third column table as the target column table corresponding to the current traversal value; if the column attribute is a merged attribute, determining the merged value corresponding to the merged attribute, determining the column sequence value of the third column table in the merged table corresponding to the merged attribute, and determining the target column table corresponding to the current traversal value based on the merged value, the column sequence value, and the number of the first column of the target table.
[0009] By adopting the above scheme, when the current traversal value is the initial traversal value, the target column table corresponding to the current traversal value is determined by the column attributes of the third column table pointed to by the current traversal value, and then the target column table is determined as the first column table. Thus, a number of first column tables corresponding to the column attributes of the third column table can be generated in the rich text editor, without the need to determine the first column tables one by one, thereby improving the efficiency of generating the second column table corresponding to the first column table in the rich text editor.
[0010] In combination with the first aspect, in some possible implementations, determining the column sequence value of the third column table in the merged table corresponding to the merge attribute includes: determining the starting column table of the merged table in the global table, determining the number of interval columns between the starting column table and the third column table; and determining the column sequence value of the third column table in the merged table based on the number of interval columns.
[0011] By adopting the above solution, the column sequence value of the third column table in the merged table is determined based on the number of interval columns between the starting column table and the third column table of the merged table, thereby accurately determining the number of the second columns of the merged table in the target table.
[0012] In combination with the first aspect and the above implementations, in some possible implementations, determining the target table corresponding to the current traversal value based on the merged value, the column sequence value, and the number of the first column of the target table includes: determining the number of the second column of the merged table in the target table based on the column sequence value and the merged value; if the number of the second column is less than the number of the first column, determining the fourth column of the merged table in the target table as the target table;
[0013] If the second column quantity is greater than or equal to the first column quantity, the fifth column of the target table is determined to be the target column table.
[0014] By adopting the above scheme, the target column table is determined by the number of the first columns of the target table and the number of the second columns of the merged table in the target table. Thus, the merged table belonging to the same column attribute in the target table can be determined as the target column table at one time, and there is no need to traverse the merged table with the same column attribute multiple times. After the target column table is determined as the first column table, the second column table corresponding to the first column table can be generated in the rich text editor, which improves the efficiency of generating the second column table corresponding to the first column table in the rich text editor.
[0015] In combination with the first aspect, in some possible implementations, determining the target column table corresponding to the current traversal value in the target table includes: if the current traversal value is not the initial traversal value, obtaining the column attribute of the third column table pointed to by the current traversal value in the target table; if the column attribute is a non-merged attribute, determining that the third column table is the target column table corresponding to the current traversal value; if the column attribute is a merged attribute, determining the merged value corresponding to the merged attribute, and determining the target column table corresponding to the current traversal value based on the merged value, the current traversal value, and the number of the first column of the target table.
[0016] By adopting the above scheme, when the current traversal value is not the initial traversal value, the target column table corresponding to the current traversal value is determined by the column attributes of the third column table pointed to by the current traversal value, and then the target column table is determined as the first column table. Thus, a number of first column tables corresponding to the column attributes of the third column table can be generated in the rich text editor, without the need to determine the first column tables one by one, thereby improving the efficiency of generating the second column table corresponding to the first column table in the rich text editor.
[0017] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the target column table corresponding to the current traversal value is determined based on the merged value, the current traversal value, and the number of first columns of the target table, including: determining the number of remaining columns of the target table based on the number of first columns and the current traversal value; if the merged value is less than the number of remaining columns, determining the fourth column table of the merged table in the target table as the target column table; if the merged value is greater than or equal to the number of remaining columns, determining the column table corresponding to the remaining number of columns as the target column table.
[0018] By adopting the above scheme, through the merged value, the current traversal value, and the number of the first columns of the target table, when the current traversal value is not the initial traversal value, the merged table belonging to the same column attribute in the target table can be determined as the target column table through one traversal, and there is no need to traverse the merged table with the same column attribute multiple times. After the target column table is determined as the first column table, the second column table corresponding to the first column table can be generated in the rich text editor, which improves the efficiency of generating the second column table corresponding to the first column table in the rich text editor.
[0019] In combination with the first aspect and the above implementations, in some possible implementations, after determining the target column table as the first column table currently traversed, the method further includes: updating the current traversal value based on the number of the third column of the target column table and the current traversal value.
[0020] By adopting the above scheme, the current traversal value is updated by the number of the third column of the target table and the current traversal value, thereby accurately locating the first column of the table that needs to be copied to the rich text editor, thereby improving the accuracy of determining the first column of the table.
[0021] In a second aspect, a device for generating table content is provided, the device comprising:
[0022] A response unit, used for obtaining a target table selected by the selection operation in the global table in response to the selection operation triggered by the user;
[0023] An acquisition unit is used to acquire the first column of the table currently traversed in the target table and acquire the first column width of the first column of the table;
[0024] A determining unit, configured to determine, in the rich text editor, a second column table corresponding to the first column table, and determine a second column width of the second column table based on a first column width of the first column table;
[0025] The generating unit is used to generate a second column table in the rich text editor based on the second column width, and add the table content of the first column table to the second column table.
[0026] According to a third aspect, an electronic device is provided, comprising:
[0027] A memory for storing executable program codes;
[0028] A processor is used to call and run executable program code from a memory, so that the device executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0029] 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.
[0030] 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
[0031] Figure 1AThis is a schematic diagram of a scenario of obtaining table contents using a traditional solution provided in an embodiment of the present application;
[0032] Figure 1B It is a scenario diagram of a method for generating table content provided in an embodiment of the present application;
[0033] Figure 2 It is a flowchart of a method for generating table content provided in an embodiment of the present application;
[0034] Figure 3 It is a flowchart of a method for generating table content provided in an embodiment of the present application;
[0035] Figure 4 It is a scenario diagram of a method for generating table content provided in an embodiment of the present application;
[0036] Figure 5 It is a flowchart of a method for generating table content provided in an embodiment of the present application;
[0037] Figure 6 It is a scenario diagram of a method for generating table content provided in an embodiment of the present application;
[0038] Figure 7 It is a flowchart of a method for generating table content provided in an embodiment of the present application;
[0039] Figure 8 It is a structural schematic diagram of a device for generating table content provided in an embodiment of the present application;
[0040] Fig. 9 It is a structural schematic diagram of a device for generating table content provided in an embodiment of the present application;
[0041] Fig.10 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0042] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] 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.
[0044] 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.
[0045] Figure 1A It is a schematic diagram of a scenario of obtaining table contents using a traditional solution provided in an embodiment of the present application.
[0046] exist Figure 1A In the example, the target table (Table 1) with the colgroup attribute is extracted from the web page, and Table 2 corresponding to the target table is generated in the rich text editor. Since the width information of the target table with the colgroup attribute is not taken into account when Table 2 is generated based on the extracted target table in the rich text editor, the table contents displayed in Table 2 are displayed in the same column after the target table is copied to the rich text editor.
[0047] See also Figure 1B , Figure 1B It is a scene diagram of a method for generating table content provided by an embodiment of the present application. In the embodiment of the present application, when it is detected that the user triggers a selection operation by clicking the mouse, the target table selected in the global table is obtained, and then the first column table currently traversed (the first column in Table 1) is determined in the target table, and the second column table corresponding to the first column table (the first column in Table 2) is determined in the rich text editor, and the second column width of the second column table is determined according to the first column width of the first column table. Exemplarily, the first column width can be 100 pixels (px), and the second column width of the table B1 is determined to be 100 pixels (px). Then, the second column table is generated in the rich text editor according to the second column width, and the table content in the first column table is added to the second column table, and then the above steps are repeated until the second column table corresponding to all the first column tables contained in the target table is generated in the rich text editor.
[0048] In an embodiment of the present application, the second column width of the second column table in the rich text editor is determined based on the first column width of the first column table, and then a second column table corresponding to the first column table is generated in the rich text editor based on the second column width. Since the second column width of the second column table generated in the rich text editor corresponds to the first column width of the first column table, when the table content of the first column table is added to the second column table of the rich text editor, the table content can be displayed in the second column table having the corresponding column width of the first column table, thereby avoiding the problem of deviation between the table content of the second column table in the rich text editor and the table content of the first column table.
[0049] based on Figure 1A , Figure 1B The scene shown is shown below. Figure 2-Figure 6 , a method for generating table content provided in an embodiment of the present application is introduced in detail.
[0050] See also Figure 2 , which is a flow chart of a method for generating table content 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-S104.
[0051] S101, in response to a selection operation triggered by a user, obtaining a target table selected by the selection operation in a global table;
[0052] In one embodiment, the global table may be a table including multiple rows and columns, and the target table may be a table selected by a user's selection operation in the global table. The selection operation is triggered by a click operation or a drag operation.
[0053] In one embodiment, the method of detecting that the user has triggered the selection operation may be: if it is determined that the user has selected two different cells in the global table by using a mouse or clicking on a touch screen within a preset time of 0.5 seconds, it is determined that the user has triggered the selection operation. Then, based on the row and column where the cell hit by the first click is located, and the cells included between the row and column where the cell hit by the second click is located, it is determined as the target table selected by the selection operation.
[0054] In another embodiment, the method of detecting that the user triggers the selection operation can also be: if it is detected that the user holds down the left mouse button and drags the mouse to the right, downward, upward or left, it is determined that the user has triggered the selection operation. Then, the cells contained in the rectangular area formed based on the cell hit when the drag operation starts as the starting point and the cell hit when the drag operation ends as the end point are determined as the target table selected by the selection operation.
[0055] S102, obtaining the first column of the table currently traversed in the target table, and obtaining the first column width of the first column of the table;
[0056] In one embodiment, after the target table is obtained, the first column table currently being traversed is obtained, and the first column width of the first column table is obtained. It can be understood that the first column table can be the currently traversed column table in the selected target table. In the embodiment of the present application, each column table in the target table can be used as the currently traversed first column table in order from left to right.
[0057] It can be understood that in the present application, when it is detected that the user triggers a selection operation and obtains the target table selected by the selection operation in the global table, a third-party tool is used to obtain the column width of the target table, and then the first column width of the first column of the currently traversed table is obtained according to the traversal value. For example, the first column width can be 100px.
[0058] S103, determining a second column table corresponding to the first column table in the rich text editor, and determining a second column width of the second column table based on the first column width of the first column table;
[0059] In one embodiment, after determining the first column width of the first column table, determine the second column table corresponding to the first column table in the rich text editor, and then determine the second column width of the second column table in the rich text editor based on the first column width of the first column table.
[0060] It can be understood that the generation order of the second column tables generated in the rich text editor is determined according to the order of the first column tables currently traversed in the target table. Therefore, in an embodiment of the present application, the second column tables are generated in the rich text editor according to the order of the first column tables currently traversed, which can ensure that the arrangement order of each second column table generated in the rich text editor is the same as the arrangement order of the first column tables in the target table.
[0061] On the basis of ensuring that the arrangement order of the second column table in the rich text editor is the same as the arrangement order of the first column table in the target table, it is necessary to further determine the second column width of the second column table in the rich text editor based on the first column width of the first column table in the target table to ensure the similarity between the first column table and the second column table. For example, in the embodiment of the present application, when it is determined that the first column width of the currently traversed first column table is 100px, it can be determined that the second column width of the second column table is 100px.
[0062] S104 , generating a second column table in the rich text editor based on the second column width, and adding the table content of the first column table to the second column table.
[0063] In one embodiment, a second column table corresponding to the first column table is generated in the rich text editor according to the second column width, and the table content of the first column table is added to the second column table.
[0064] Specifically, when adding the table contents of the first column table to the second column table in the rich text editor, since the second column width of the second column table is determined based on the first column width of the first column table, the table contents can be added to the second column table in sequence according to their positions in the first column table. It is understandable that in the embodiment of the present application, when obtaining the target table selected by the selection operation, in addition to obtaining the first column width of the first column table contained in the target table through a third-party tool, the column attributes of the first column table, the merged values corresponding to the column attributes, and the style of the table contents of the first column table, such as table borders, fill colors, fonts, etc., can also be obtained. Then, the table contents of the same style are added to the second column table in the second column table.
[0065] In an embodiment of the present application, the second column width of the second column table in the rich text editor is determined based on the first column width of the first column table, and then a second column table corresponding to the first column table is generated in the rich text editor based on the second column width. Since the second column width of the second column table generated in the rich text editor corresponds to the first column width of the first column table, when the table content of the first column table is added to the second column table of the rich text editor, the table content can be displayed in the second column table having the corresponding column width of the first column table, thereby avoiding the problem of deviation between the table content of the second column table in the rich text editor and the table content of the first column table.
[0066] See also Figure 3 , which is a flow chart of a method for generating table content 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-S207.
[0067] S201, in response to a selection operation triggered by a user, obtaining a target table selected by the selection operation in a global table;
[0068] For details, please refer to the description of step S101 in the above embodiment of the specification, which will not be elaborated here.
[0069] S202, if the current traversal value is the initial traversal value, obtaining the column attribute of the third column table pointed to by the current traversal value in the target table;
[0070] In one embodiment, the current traversal value may be the traversal value corresponding to the first column table currently traversed; the initial traversal value may be the traversal value pointing to the first column table in the target table. In the embodiment of the present application, when the current traversal value is the initial traversal value, it means that the first column table in the target table is currently traversed, and it is used as the third column table, and the column attributes of the third column table are obtained. In the embodiment of the present application, the column attributes include merged attributes and non-merged attributes.
[0071] S203, if the column attribute is a non-merge attribute, determining the third column table as the target column table corresponding to the current traversal value;
[0072] Specifically, when it is determined that the column attribute is a non-merge attribute, the third column table pointed to by the current traversal value is determined to be the target column table corresponding to the current traversal value. It can be understood that when the column attribute is a non-merge attribute, it is determined that the third column table pointed to by the current traversal value has no other table merged with it, and then the third column table is determined to be the target column table corresponding to the current traversal value.
[0073] S204, if the column attribute is a merge attribute, determine a merge value corresponding to the merge attribute, determine a column sequence value of the third column table in the merged table corresponding to the merge attribute, and determine a target column table corresponding to the current traversal value based on the merge value, the column sequence value, and the number of the first column of the target table;
[0074] In one embodiment, the merge value may be the number of merged columns in the merged table. For example, when the span value is 5, it means that the number of merged columns in the merged table is 5. The column sequence value may be the ranking value of the third column in the merged table. For example, if the column sequence value is 3, the third column in the merged table is determined. When the column attribute is determined to be a merge attribute, the merge value corresponding to the merge attribute is determined, and then the column sequence value of the third column in the merged table is determined based on the merge value. The merge value corresponding to the merge attribute can be obtained through a third-party tool.
[0075] Specifically, the method for determining the column sequence value of the third column table in the merged table corresponding to the merged attribute can be: first determine the starting column table of the merged table where the third column table of the merged attribute is located in the global table, then determine the number of interval columns between the starting column table and the third column table, and finally determine the column sequence value of the third column table in the merged table based on the number of interval columns.
[0076] See also Figure 4 , Figure 4 A schematic diagram of a scenario of a method for generating table content provided in an embodiment of the present application.
[0077] exist Figure 4, the third column table pointed to by the current traversal value in the target table is the table under the "A3" column, which is the first table in the target table, that is, the current traversal value is the initial traversal value, and the column attribute of the third column table is a merge attribute, then the merged table to which the third column table belongs is determined in the global table. Exemplarily, the merged table to which the third column table belongs can be determined in the global table according to the merge value through a third-party tool. In an embodiment of the present application, the merged table to which the third column table belongs is determined to start from the "A1" column and end at the "A4" column, thereby further determining that the number of interval columns between the starting column table "A1" of the merged table and the "A3" column of the third column table is 1, then the column sequence value of the third column table in the merged table is determined to be "3".
[0078] Further, after obtaining the column sequence value of the third column table in the merged table, the target column table corresponding to the current traversal value is determined based on the merged value, the column sequence value, and the number of the first column of the target table.
[0079] Specifically, the number of the second column of the merged table in the target table is determined based on the column sequence value and the merge value. If the number of the second column is less than the number of the first column, the fourth column of the merged table in the target table is determined to be the target column. If the number of the second column is greater than or equal to the number of the first column, the fifth column of the target table is determined to be the target column.
[0080] Please continue to see Figure 4 , when the merge value is 4 and the column sequence value is 3, the second column quantity of the merged table in the target table can be determined to be 2 based on the merge value and the column sequence value. The first quantity of the target table is 5, that is, the second quantity is less than the first quantity, then the fourth column of the merged table in the target table is determined to be the target column table, that is, the table under the "A3" column and the "A4" column of the table is the fourth column table, which is determined to be the target column table; optionally, in another case, if the merge value is 8 and the column sequence value is 3, the fifth column of the merged table is determined to be the target column table, that is, the table under the "A3" column, the "A4" column, the "A5" column, the "A6" column, and the "A7" column of the table is the fifth column table, and then the fifth column table is determined to be the target column table.
[0081] S205, determining the target column table as the first column table currently traversed, and obtaining the first column width of the first column table;
[0082] S206, determining a second column table corresponding to the first column table in the rich text editor, and determining a second column width of the second column table based on the first column width of the first column table;
[0083] In one embodiment, after the target column table is obtained, the target column table is determined as the first column table currently traversed, and the first column width of the first column table is obtained, and then the second column width of the second column table is determined based on the first column width of the first column table.
[0084] In one implementation, if the number of the first column table is 1, the first column width of the first column table is determined to be the second column width of the second column table.
[0085] In another embodiment, if the number of first-column tables is greater than 1, the largest first column width among the multiple first column widths is determined as the target column width, and then the second column width of the second table is determined as the target column width. It can be understood that in the rich text editor, the second-column tables correspond to the first-column tables, so when the number of first-column tables is multiple, the number of second-column tables is also multiple, that is, the number of first-column tables is the same as the number of second-column tables, and the second column widths of the multiple second-column tables are determined as the target column width.
[0086] S207 , generating a second column table in the rich text editor based on the second column width, and adding the table content of the first column table to the second column table.
[0087] In an embodiment of the present application, when the current traversal value is the initial traversal value, the target column table corresponding to the current traversal value is determined by the column attributes of the third column table pointed to by the current traversal value, and then the target column table is determined as the first column table, thereby enabling the generation of the first column table corresponding to the number of column attributes of the third column table in the rich text editor, without the need to determine the first column tables one by one, thereby improving the efficiency of generating the second column table corresponding to the first column table in the rich text editor; and determining the column sequence value of the third column table in the merged table based on the number of interval columns between the starting column table and the third column table of the merged table, thereby accurately determining the number of second columns of the merged table in the target table; and then determining the target column table based on the number of first columns of the target table and the number of second columns of the merged table in the target table, thereby enabling the merged table belonging to the same column attribute in the target table to be determined as the target column table at one time, without the need to traverse the merged table with the same column attribute multiple times, and after determining the target column table as the first column table, the second column table corresponding to the first column table can be generated in the rich text editor, thereby improving the efficiency of generating the second column table corresponding to the first column table in the rich text editor.
[0088] See also Figure 5 , which is a flow chart of a method for generating table content provided in an embodiment of the present application. Figure 5 As shown, the method of the embodiment of the present application may include the following steps S301-S307.
[0089] S301, in response to a selection operation triggered by a user, obtaining a target table selected by the selection operation in a global table;
[0090] For details, please refer to the description of step S101 in the above embodiment of the specification, which will not be elaborated here.
[0091] S302, if the current traversal value is not the initial traversal value, obtaining the column attribute of the third column table pointed to by the current traversal value in the target table;
[0092] In one embodiment, the current traversal value is the traversal value corresponding to the first column table currently traversed; the non-initial traversal value may be a traversal value pointing to other columns in the target table except the first-ranked column table. In the embodiment of the present application, when the current traversal value is a non-initial traversal value, it means that the current traversal is other columns in the target table except the first-ranked column table, which is used as the third column table, and the column attributes of the third column table are obtained. In the embodiment of the present application, the column attributes include merged attributes and non-merged attributes.
[0093] S303, if the column attribute is a non-merge attribute, determining the third column table as the target column table corresponding to the current traversal value;
[0094] In one embodiment, when it is determined that the column attribute is a non-merge attribute, the third column table pointed to by the current traversal value is determined to be the target column table corresponding to the current traversal value. It can be understood that when the column attribute is a non-merge attribute, it is determined that the third column table pointed to by the current traversal value has no other table merged with it, and then the third column table is determined to be the target column table corresponding to the current traversal value.
[0095] S304, if the column attribute is a merge attribute, determining a merge value corresponding to the merge attribute, and determining a target column table corresponding to the current traversal value based on the merge value, the current traversal value, and the number of the first column of the target table;
[0096] See also Figure 6 , Figure 6 A schematic diagram of a scenario of a method for generating table content provided in an embodiment of the present application.
[0097] exist Figure 6 In the target table, the third column of the table pointed to by the current traversal value (coindex=3, when coindex is the initial traversal value, it is 0) is the table under the "A6" column, and the current traversal value coindex=3, that is, the current traversal value is not the initial traversal value, and the column attribute of the third column of the table is a merge attribute.
[0098] Further, a merge value corresponding to the merge attribute is determined. Exemplarily, the merge value may be 4. Then, based on the merge value, the current traversal value, and the number of the first column of the target table, the target table corresponding to the current traversal value is determined.
[0099] Specifically, the number of remaining columns of the target table is determined based on the number of the first column and the current traversal value. If the merged value is less than the number of remaining columns, the fourth column table of the merged table in the target table is determined to be the target column table. If the merged value is greater than or equal to the number of remaining columns, the column table corresponding to the remaining number of columns is determined to be the target column table. The number of remaining columns is the number of column tables in the target table whose table contents have not been copied to the rich text editor, including the third column table pointed to by the current traversal value.
[0100] Please continue to see Figure 6 , when the number of the first column is 5 and the current traversal value is 3, the number of remaining columns of the target table can be determined to be 2 based on the number of the first column and the current traversal value, that is, the table under the "A6" column and the "A7" column is the table corresponding to the remaining number of columns of the target table. If the merge value of the third column table whose column attribute is the merge attribute is 4, that is, the merge value is greater than the number of remaining columns, then the table corresponding to the remaining number of columns is determined to be the target column table, that is, the table under the "A6" column and the "A7" column is the target column table; if the merge value of the third column table whose column attribute is the merge attribute is 1, that is, the merge value is less than the number of remaining columns, then the fourth column table of the merged table in the target table is determined to be the target column table, that is, the table under the "A6" column is the target column table.
[0101] Further, after the target table is determined as the first table, the current traversal value is updated based on the number of the third column of the target table and the current traversal value. Exemplarily, if the current traversal value coindex=0, the number of the third column of the target table is 2, then the updated current traversal value coindex=2 is determined; if the current traversal value coindex=3, the number of the third column of the target table is 2, and the updated current traversal value exceeds the number of the first column of the target table, then a prompt message "The target table has been traversed" is output.
[0102] S305, determining the target column table as the first column table currently traversed, and obtaining the first column width of the first column table;
[0103] S306, determining a second column table corresponding to the first column table in the rich text editor, and determining a second column width of the second column table based on the first column width of the first column table;
[0104] In one embodiment, after the target column table is obtained, the target column table is determined as the first column table currently traversed, and the first column width of the first column table is obtained, and then the second column width of the second column table is determined based on the first column width of the first column table.
[0105] In one implementation, if the number of the first column table is 1, the first column width of the first column table is determined to be the second column width of the second column table.
[0106] In another embodiment, if the number of first-column tables is greater than 1, the largest first column width among the multiple first column widths is determined as the target column width, and then the second column width of the second table is determined as the target column width. It can be understood that in the rich text editor, the second-column tables correspond to the first-column tables, so when the number of first-column tables is multiple, the number of second-column tables is also multiple, that is, the number of first-column tables is the same as the number of second-column tables, and the second column widths of the multiple second-column tables are determined as the target column width.
[0107] S307 , generating a second column table in the rich text editor based on the second column width, and adding the table content of the first column table to the second column table.
[0108] In an embodiment of the present application, when the current traversal value is not the initial traversal value, the target column table corresponding to the current traversal value is determined by the column attributes of the third column table pointed to by the current traversal value, and then the target column table is determined as the first column table, thereby enabling the generation of a first column table corresponding to the number of column attributes of the third column table in the rich text editor, without the need to determine the first column tables one by one, thereby improving the efficiency of generating the second column table corresponding to the first column table in the rich text editor; and based on the merged value, the current traversal value, and the number of first columns of the target table, when the current traversal value is not the initial traversal value, One traversal can determine the merged table belonging to the same column attribute in the target table as the target column table, and there is no need to traverse the merged table with the same column attribute multiple times. After the target column table is determined as the first column table, the second column table corresponding to the first column table can be generated in the rich text editor, which improves the efficiency of generating the second column table corresponding to the first column table in the rich text editor; then, based on the number of the third column of the target table and the current traversal value, the current traversal value is updated, thereby accurately locating the first column table that needs to be copied to the rich text editor, which improves the accuracy of the determined first column table.
[0109] The following will be combined Figure 7 The method for generating the table content provided in the embodiment of the present application is described in detail with reference to a specific example.
[0110] S1, in response to a selection operation, obtain the target table selected by the selection operation; S2, if the current traversal value is the initial traversal value, obtain the column attribute of the third column table pointed to by the current traversal value in the target table; S3, if the column attribute is a non-merged attribute, determine that the third column table is the target column table corresponding to the current traversal value; S4, if the column attribute is a merged attribute, determine the merged value corresponding to the merged attribute, and determine the column sequence value of the third column table in the merged table corresponding to the merged attribute; S5, determine the target column table corresponding to the current traversal value based on the merged value, the column sequence value, and the number of the first column of the target table; S6, if the current traversal value is not the initial traversal value, obtain the column attribute of the third column table pointed to by the current traversal value in the target table; S7, If the column attribute is a non-merged attribute, determine that the third column table is the target column table corresponding to the current traversal value; S8, if the column attribute is a merged attribute, determine the merged value corresponding to the merged attribute; S9, determine the target column table corresponding to the current traversal value based on the merged value, the current traversal value, and the number of the first column of the target table; S10, determine the target column table as the first column table currently traversed; S11, obtain the first column width of the first column table; S12, determine the second column table corresponding to the first column table in the rich text editor, and determine the second column width of the second column table based on the first column width of the first column table; S13, generate a second column table in the rich text editor based on the second column width, and add the table content of the first column table to the second column table.
[0111] In an embodiment of the present application, the second column width of the second column table in the rich text editor is determined based on the first column width of the first column table, and then a second column table corresponding to the first column table is generated in the rich text editor based on the second column width. Since the second column width of the second column table generated in the rich text editor corresponds to the first column width of the first column table, when the table content of the first column table is added to the second column table of the rich text editor, the table content can be displayed in the second column table with appropriate column width, thereby avoiding the problem of deviation between the table content of the second column table in the rich text editor and the table content of the first column table.
[0112] Based on the scenario diagram in Figure 1, the following will be combined Figure 8-Figure 9 , the table content generation device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 8-Figure 9 A device for generating table contents in the table, used to execute the present application Figure 2-Figure 7 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 7 The embodiment shown.
[0113] like Figure 8The device for generating table content shown includes: a responding unit 11, an acquiring unit 12, a determining unit 13 and a generating unit 14.
[0114] A response unit 11 is used for obtaining a target table selected by the selection operation in the global table in response to the selection operation triggered by the user;
[0115] An acquisition unit 12 is used to acquire the first column of the table currently traversed in the target table and acquire the first column width of the first column of the table;
[0116] A determining unit 13, configured to determine, in the rich text editor, a second column table corresponding to the first column table, and determine a second column width of the second column table based on the first column width of the first column table;
[0117] The generating unit 14 is configured to generate a second column table in the rich text editor based on the second column width, and add the table content of the first column table to the second column table.
[0118] Optionally, the acquiring unit 12 includes: a first determining subunit 121 and a second determining subunit 122 .
[0119] The first determining subunit 121 is used to determine the target table corresponding to the current traversal value in the target table;
[0120] The second determining subunit 122 is configured to determine the target column table as the first column table currently traversed.
[0121] Optionally, the first determining subunit 121 is specifically configured to:
[0122] If the current traversal value is the initial traversal value, then obtain the column attributes of the third column of the table pointed to by the current traversal value in the target table;
[0123] If the column attribute is a non-merged attribute, the third column table is determined to be the target column table corresponding to the current traversal value;
[0124] If the column attribute is a merge attribute, determine the merge value corresponding to the merge attribute, determine the column sequence value of the third column table in the merged table corresponding to the merge attribute, and determine the target column table corresponding to the current traversal value based on the merge value, the column sequence value, and the number of the first column of the target table.
[0125] Optionally, the first determining subunit 121 is specifically configured to:
[0126] Determine the starting column of the merged table in the global table, and determine the number of interval columns between the starting column and the third column;
[0127] The column sequence value of the third column in the merged table is determined based on the number of interval columns.
[0128] Optionally, the first determining subunit 121 is specifically configured to:
[0129] Determine the number of the second column of the merged table in the target table based on the column sequence value and the merge value;
[0130] If the number of the second column is less than the number of the first column, determining the fourth column table of the merged table in the target table as the target column table;
[0131] If the second column quantity is greater than or equal to the first column quantity, the fifth column of the target table is determined to be the target column table.
[0132] Optionally, the first determining subunit 121 is specifically configured to:
[0133] If the current traversal value is not the initial traversal value, then the column attributes of the third column table pointed to by the current traversal value in the target table are obtained;
[0134] If the column attribute is a non-merged attribute, the third column table is determined to be the target column table corresponding to the current traversal value;
[0135] If the column attribute is a merge attribute, a merge value corresponding to the merge attribute is determined, and a target column table corresponding to the current traversal value is determined based on the merge value, the current traversal value, and the number of the first column of the target table.
[0136] Optionally, the first determining subunit 121 is specifically configured to:
[0137] Determine the number of remaining columns of the target table based on the first column number and the current traversal value;
[0138] If the merged value is less than the number of remaining columns, the fourth column of the merged table in the target table is determined as the target column table;
[0139] If the merge value is greater than or equal to the number of remaining columns, the column table corresponding to the number of remaining columns is determined as the target column table.
[0140] like Fig. 9 The device for generating table content shown includes: a responding unit 11, an acquiring unit 12, a determining unit 13, a generating unit 14, and an updating unit 15.
[0141] The updating unit 15 is used to update the current traversal value based on the third column quantity of the target column table and the current traversal value.
[0142] See also Fig.10 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.10 As shown, the electronic device 500 includes a processor 501 and a memory 502. The processor 501 is electrically connected to the memory 502.
[0143] 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 various parts of the entire electronic device 500, and executes various functions and processes data of the electronic device 500 by running or calling computer programs stored in the memory 502, and calling data stored in the memory 502, so as to control the electronic device 500 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; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 501, but may be implemented separately through a communication chip.
[0144] 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 500, etc.
[0145] 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.
[0146] 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:
[0147] In response to a selection operation triggered by a user, obtaining a target table selected by the selection operation in the global table;
[0148] Get the first column of the table currently traversed in the target table, and get the first column width of the first column of the table;
[0149] Determine a second column table corresponding to the first column table in the rich text editor, and determine a second column width of the second column table based on the first column width of the first column table;
[0150] A second column table is generated in the rich text editor based on the second column width, and the table content of the first column table is added to the second column table.
[0151] Optionally, when executing to obtain the first column of the table currently traversed in the target table, the processor 501 specifically executes:
[0152] Determine the target table corresponding to the current traversal value in the target table;
[0153] The target column table is determined as the first column table currently traversed.
[0154] Optionally, when the processor 501 determines the target table corresponding to the current traversal value in the target table, it specifically executes:
[0155] If the current traversal value is the initial traversal value, then obtain the column attributes of the third column of the table pointed to by the current traversal value in the target table;
[0156] If the column attribute is a non-merged attribute, the third column table is determined to be the target column table corresponding to the current traversal value;
[0157] If the column attribute is a merge attribute, determine the merge value corresponding to the merge attribute, determine the column sequence value of the third column table in the merged table corresponding to the merge attribute, and determine the target column table corresponding to the current traversal value based on the merge value, the column sequence value, and the number of the first column of the target table.
[0158] Optionally, when determining the column sequence value of the third column in the merged table corresponding to the merged attribute, the processor 501 specifically performs:
[0159] Determine the starting column of the merged table in the global table, and determine the number of interval columns between the starting column and the third column;
[0160] The column sequence value of the third column in the merged table is determined based on the number of interval columns.
[0161] Optionally, when the processor 501 determines the target table corresponding to the current traversal value based on the merge value, the column sequence value, and the number of the first column of the target table, it specifically executes:
[0162] Determine the number of the second column of the merged table in the target table based on the column sequence value and the merge value;
[0163] If the number of the second column is less than the number of the first column, determining the fourth column table of the merged table in the target table as the target column table;
[0164] If the second column quantity is greater than or equal to the first column quantity, the fifth column of the target table is determined to be the target column table.
[0165] Optionally, when the processor 501 determines the target table corresponding to the current traversal value in the target table, it specifically executes:
[0166] If the current traversal value is not the initial traversal value, then the column attributes of the third column table pointed to by the current traversal value in the target table are obtained;
[0167] If the column attribute is a non-merged attribute, the third column table is determined to be the target column table corresponding to the current traversal value;
[0168] If the column attribute is a merge attribute, a merge value corresponding to the merge attribute is determined, and a target column table corresponding to the current traversal value is determined based on the merge value, the current traversal value, and the number of the first column of the target table.
[0169] Optionally, when the processor 501 determines the target table corresponding to the current traversal value based on the merge value, the current traversal value, and the number of the first column of the target table, it specifically performs:
[0170] Determine the number of remaining columns of the target table based on the first column number and the current traversal value;
[0171] If the merged value is less than the number of remaining columns, the fourth column of the merged table in the target table is determined as the target column table;
[0172] If the merge value is greater than or equal to the number of remaining columns, the column table corresponding to the number of remaining columns is determined as the target column table.
[0173] Optionally, after determining the target list table as the first list table currently traversed, the processor 501 may further execute:
[0174] Update the current traversal value based on the third column quantity of the target column table and the current traversal value.
[0175] In an embodiment of the present application, the second column width of the second column table in the rich text editor is determined based on the first column width of the first column table, and then a second column table corresponding to the first column table is generated in the rich text editor based on the second column width. Since the second column width of the second column table generated in the rich text editor corresponds to the first column width of the first column table, when the table content of the first column table is added to the second column table of the rich text editor, the table content can be displayed in the second column table with appropriate column width, thereby avoiding the problem of distortion between the table content of the second column table in the rich text editor and the table content of the first column table.
[0176] See also Fig.11 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.11 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.
[0177] 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 500 . These graphical user interfaces may be composed of images, texts, icons, videos and any combination thereof.
[0178] 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.
[0179] The audio circuit 505 can be used to provide an audio interface between the user and the electronic device 500 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.
[0180] The sensor 506 is used to collect information of the electronic device 500 itself, information of the user, or external environment information. For example, the sensor 506 may include one or more sensors such as 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, and a heart rate sensor.
[0181] 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.
[0182] It should be understood that the device provided in the embodiment of the present application is used to execute the above-mentioned method for generating table content, and thus can achieve the same effect as the above-mentioned implementation method.
[0183] 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.
[0184] 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.
[0185] 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 method for generating table content provided in the above embodiment.
[0186] 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 method for generating table content provided in the above embodiment.
[0187] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement a method for generating table content provided in the above embodiment.
[0188] 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.
[0189] 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.
[0190] 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.
[0191] 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 method for generating table content, characterized in that: The method comprises: In response to a selection operation triggered by a user, obtaining a target table selected by the selection operation in a global table; Get the first column of the table currently traversed in the target table, and get the first column width of the first column of the table; Determine, in a rich text editor, a second column table corresponding to the first column table, and determine a second column width of the second column table based on a first column width of the first column table; The second column table is generated in the rich text editor based on the second column width, and the table content of the first column table is added to the second column table.
2. The method according to claim 1, characterized in that The step of obtaining the first column of the table currently traversed in the target table includes: Determine the target table corresponding to the current traversal value in the target table; The target column table is determined as the first column table currently traversed.
3. The method according to claim 2, characterized in that The step of determining the target table corresponding to the current traversal value in the target table includes: If the current traversal value is an initial traversal value, obtaining the column attribute of the third column table pointed to by the current traversal value in the target table; If the column attribute is a non-merge attribute, determining the third column table as the target column table corresponding to the current traversal value; If the column attribute is a merge attribute, determine the merge value corresponding to the merge attribute, determine the column sequence value of the third column table in the merged table corresponding to the merge attribute, and determine the target column table corresponding to the current traversal value based on the merge value, the column sequence value, and the number of the first column of the target table.
4. The method according to claim 3, characterized in that The determining the column sequence value of the third column in the merged table corresponding to the merged attribute includes: Determine a starting column table of the merged table in the global table, and determine the number of interval columns between the starting column table and the third column table; The column sequence value of the third column table in the merged table is determined based on the number of interval columns.
5. The method according to claim 3, characterized in that: The determining the target table corresponding to the current traversal value based on the merge value, the column sequence value, and the number of the first column of the target table includes: Determine the number of the second column of the merged table in the target table based on the column sequence value and the merge value; If the number of the second columns is less than the number of the first columns, determining the fourth column of the merged table in the target table as the target column; If the second column quantity is greater than or equal to the first column quantity, the fifth column of the target table is determined to be the target column table.
6. The method according to claim 2, characterized in that The step of determining the target table corresponding to the current traversal value in the target table includes: If the current traversal value is not the initial traversal value, obtaining the column attribute of the third column table pointed to by the current traversal value in the target table; If the column attribute is a non-merge attribute, determining the third column table as the target column table corresponding to the current traversal value; If the column attribute is a merge attribute, a merge value corresponding to the merge attribute is determined, and a target column table corresponding to the current traversal value is determined based on the merge value, the current traversal value, and the first column quantity of the target table.
7. The method according to claim 6, characterized in that The determining the target table corresponding to the current traversal value based on the merged value, the current traversal value, and the number of the first column of the target table includes: determining the number of remaining columns of the target table based on the first number of columns and the current traversal value; If the merge value is less than the number of remaining columns, determining the fourth column table of the merged table in the target table as the target column table; If the combined value is greater than or equal to the number of remaining columns, the column table corresponding to the number of remaining columns is determined as the target column table.
8. The method according to claim 2, characterized in that: After determining the target list table as the first list table currently traversed, the method further includes: The current traversal value is updated based on the third column quantity of the target column table and the current traversal value.
9. A device for generating table content, characterized in that: The device comprises: A response unit, configured to respond to a selection operation triggered by a user and obtain a target table selected by the selection operation in the global table; An acquiring unit, used for acquiring a first column table currently traversed in the target table, and acquiring a first column width of the first column table; a determining unit, configured to determine, in the rich text editor, a second column table corresponding to the first column table, and determine a second column width of the second column table based on the first column width of the first column table; A generating unit is used to generate the second column table in the rich text editor based on the second column width, and add the table content of the first column table to the second column table.
10. An electronic device, characterized in that: The 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 device executes the method according to any one of claims 1 to 8.
