An online form processing method and apparatus
By generating and sending a single message body to handle editing operations on multiple cells, the problem of inconsistency between online table content and user operations is solved, improving server-side processing efficiency and data transmission efficiency, and ensuring the consistency of online table content.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-22
- Publication Date
- 2026-03-13
AI Technical Summary
When multiple users edit online forms, inconsistencies can easily arise between the content displayed in the online form and the user's actions, especially during batch editing operations.
By obtaining the editing data from multiple cells in the editing area corresponding to the editing operation, a message body is generated and sent to the server, reducing the number of message bodies processed by the server. The target array and property manager are used to carry and process the editing data, simplifying the data volume and improving efficiency.
It improved server-side processing efficiency, ensured consistency between the content displayed in online forms and user operations, reduced data transmission volume, and improved message delivery efficiency.
Smart Images

Figure CN116227447B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an online form processing method and apparatus. Background Technology
[0002] Online spreadsheets are becoming increasingly widely used due to their ability to support collaborative editing by multiple users. Currently, once a user edits an online spreadsheet, the server can synchronize the edits to all other users.
[0003] Currently, when multiple users edit online forms, there is a problem where the content displayed in the online form is inconsistent with the user's actions. Therefore, there is an urgent need for a solution to resolve this issue. Summary of the Invention
[0004] To solve, or at least partially solve, the above-mentioned technical problems, this application provides an online form processing method and apparatus.
[0005] In a first aspect, embodiments of this application provide an online form processing method, the method comprising:
[0006] In response to an editing operation triggered on an online table, the editing area corresponding to the editing operation is obtained, and the editing area includes multiple cells;
[0007] Obtain the edit data corresponding to the plurality of cells, wherein the edit data includes attribute values edited for each cell in the plurality of cells respectively;
[0008] The message body is obtained based on the edited data;
[0009] Send the message body to the server.
[0010] Optionally, obtaining the edit data corresponding to the plurality of cells includes:
[0011] The edit data is obtained by traversing each cell in the edit area.
[0012] Optionally, the message body is obtained based on the edited data, including:
[0013] Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0014] Based on the target array corresponding to each cell, a message body including the target array corresponding to each cell is obtained.
[0015] Optionally, the target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the first cell.
[0016] Optionally, the target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute.
[0017] Optionally, obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes:
[0018] Get the attribute value of the first attribute corresponding to the first cell;
[0019] The identifier is obtained based on the attribute value of the first attribute;
[0020] Based on the identifier, the target array corresponding to the first cell is obtained.
[0021] Optionally, obtaining the identifier based on the attribute value of the first attribute includes:
[0022] Use the attribute value of the first attribute to query the attribute manager corresponding to the first attribute;
[0023] If the attribute manager includes a correspondence between the attribute value and the corresponding identifier, then the identifier is obtained from the attribute manager;
[0024] If the attribute value is not included in the attribute manager, then the identifier is generated, and the correspondence between the attribute value and the identifier is stored in the attribute manager.
[0025] Optionally, the method further includes:
[0026] Send the attribute manager of the first attribute to the server.
[0027] Optionally, obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes:
[0028] Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained;
[0029] If the values from the nth element to the last element in the initial array are all empty, then delete the nth element to the last element in the initial array to obtain the target array.
[0030] Optionally, the target array corresponding to the first cell includes a third element. The value of the third element is used to determine the operation type of the target cell attribute. The target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell. The operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
[0031] Secondly, embodiments of this application provide an online form processing method, the method comprising:
[0032] Receive message body, which is obtained based on the edit data corresponding to multiple cells in an online table, and the edit data includes attribute values edited for each cell in the multiple cells respectively;
[0033] Based on the message body, obtain the attribute values that are edited for each cell in the plurality of cells respectively;
[0034] The online table is updated based on the attribute values edited for each cell in the plurality of cells.
[0035] Optionally, the message body includes a target array corresponding to each cell. The target array corresponding to each cell is obtained by editing the attribute values of each cell in the plurality of cells, including a first cell. The target array corresponding to the first cell includes at least one element, each element corresponding to a cell attribute, and the value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0036] Optionally, the target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the cell.
[0037] Optionally, the target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute.
[0038] Optionally, the method further includes:
[0039] The attribute manager receives the first attribute, and the attribute manager of the first attribute includes the correspondence between the attribute value of the first attribute and the identifier.
[0040] Optionally, obtaining the attribute values edited for each cell in the plurality of cells according to the message body includes:
[0041] Based on the value of the second element and the attribute manager, determine the attribute value of the first attribute corresponding to the first cell.
[0042] Optionally, the last element of the target array is not empty, and the length of the target array is less than a preset length.
[0043] Optionally, the target array corresponding to the first cell includes a third element. The value of the third element is used to determine the operation type of the target cell attribute. The target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell. The operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
[0044] Optionally, obtaining the attribute values edited for each cell in the plurality of cells according to the message body includes:
[0045] Based on the value of the third element, determine the operation type corresponding to the target cell attribute;
[0046] If the operation type corresponding to the target cell is to modify the attribute value of the target cell to empty, then the attribute value of the target cell is determined to be empty.
[0047] Thirdly, embodiments of this application provide an online form processing apparatus, the apparatus comprising:
[0048] The first acquisition unit is configured to, in response to an editing operation triggered on an online table, acquire the editing area corresponding to the editing operation, wherein the editing area includes multiple cells;
[0049] The second acquisition unit is used to acquire the edit data corresponding to the plurality of cells, wherein the edit data includes attribute values edited for each cell in the plurality of cells respectively;
[0050] The processing unit is used to obtain the message body based on the edited data;
[0051] The first sending unit is used to send the message body to the server.
[0052] Optionally, the second acquisition unit is used for:
[0053] The edit data is obtained by traversing each cell in the edit area.
[0054] Optionally, the processing unit is used for:
[0055] Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0056] Based on the target array corresponding to each cell, a message body including the target array corresponding to each cell is obtained.
[0057] Optionally, the target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the first cell.
[0058] Optionally, the target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute.
[0059] Optionally, obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes:
[0060] Get the attribute value of the first attribute corresponding to the first cell;
[0061] The identifier is obtained based on the attribute value of the first attribute;
[0062] Based on the identifier, the target array corresponding to the first cell is obtained.
[0063] Optionally, obtaining the identifier based on the attribute value of the first attribute includes:
[0064] Use the attribute value of the first attribute to query the attribute manager corresponding to the first attribute;
[0065] If the attribute manager includes a correspondence between the attribute value and the corresponding identifier, then the identifier is obtained from the attribute manager;
[0066] If the attribute value is not included in the attribute manager, then the identifier is generated, and the correspondence between the attribute value and the identifier is stored in the attribute manager.
[0067] Optionally, the device further includes:
[0068] The second sending unit is used to send the attribute manager of the first attribute to the server.
[0069] Optionally, obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes:
[0070] Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained;
[0071] If the values from the nth element to the last element in the initial array are all empty, then delete the nth element to the last element in the initial array to obtain the target array.
[0072] Optionally, the target array corresponding to the first cell includes a third element. The value of the third element is used to determine the operation type of the target cell attribute. The target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell. The operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
[0073] Fourthly, embodiments of this application provide an online form processing apparatus, the apparatus comprising:
[0074] The first receiving unit is used to receive a message body, which is obtained based on the edit data corresponding to multiple cells in an online table. The edit data includes attribute values edited for each cell in the multiple cells.
[0075] The acquisition unit is used to acquire, based on the message body, the attribute values edited for each cell in the plurality of cells respectively;
[0076] The update unit is used to update the online table based on the attribute values edited for each cell in the plurality of cells.
[0077] Optionally, the message body includes a target array corresponding to each cell. The target array corresponding to each cell is obtained by editing the attribute values of each cell in the plurality of cells, including a first cell. The target array corresponding to the first cell includes at least one element, each element corresponding to a cell attribute, and the value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0078] Optionally, the target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the cell.
[0079] Optionally, the target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute.
[0080] Optionally, the device further includes:
[0081] The second receiving unit is used to receive the attribute manager of the first attribute, wherein the attribute manager of the first attribute includes the correspondence between the attribute value of the first attribute and the identifier.
[0082] Optionally, the acquisition unit is used for:
[0083] Based on the value of the second element and the attribute manager, determine the attribute value of the first attribute corresponding to the first cell.
[0084] Optionally, the last element of the target array is not empty, and the length of the target array is less than a preset length.
[0085] Optionally, the target array corresponding to the first cell includes a third element. The value of the third element is used to determine the operation type of the target cell attribute. The target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell. The operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
[0086] Optionally, the acquisition unit is used for:
[0087] Based on the value of the third element, determine the operation type corresponding to the target cell attribute;
[0088] If the operation type corresponding to the target cell is to modify the attribute value of the target cell to empty, then the attribute value of the target cell is determined to be empty.
[0089] Fifthly, embodiments of this application provide an apparatus, the apparatus including a processor and a memory;
[0090] The processor is configured to execute instructions stored in the memory to cause the device to perform the method described in any of the first aspects above, or to cause the device to perform the method described in any of the second aspects above.
[0091] In a sixth aspect, embodiments of this application provide a computer-readable storage medium including instructions that instruct a device to perform the method described in any of the first aspects above, or that instruct a device to perform the method described in any of the second aspects above.
[0092] In a seventh aspect, embodiments of this application provide a computer program product that, when run on a computer, causes the computer to perform the method described in any of the first aspects above, or causes the computer to perform the method described in any of the second aspects above.
[0093] Compared with the prior art, the embodiments of this application have the following advantages:
[0094] This application provides a method for processing online tables, including: in response to an editing operation triggered on the online table, obtaining an editing area corresponding to the editing operation, the editing area including multiple cells; obtaining editing data corresponding to the multiple cells, the editing data including attribute values edited for each cell in the multiple cells; after obtaining the editing data, obtaining a message body based on the editing data, and sending the message body to a server. Therefore, using this solution, even if an editing operation is triggered for multiple cells, only one message body needs to be sent to the server, thereby reducing the number of message bodies processed by the server and improving the server's processing efficiency. Consequently, the content displayed in the online table can be consistent with the user's operation. Attached Figure Description
[0095] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0096] Figure 1 A flowchart illustrating an online form processing method provided in an embodiment of this application;
[0097] Figure 2 A schematic diagram of an online form provided in an embodiment of this application;
[0098] Figure 3 A flowchart illustrating yet another online form processing method provided in this application embodiment;
[0099] Figure 4 This is a schematic diagram of the structure of an online form processing device provided in an embodiment of this application;
[0100] Figure 5 This is a schematic diagram of the structure of another online form processing device provided in the embodiments of this application. Detailed Implementation
[0101] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0102] The inventors of this application have discovered that, currently, when a user edits an online table, the server can synchronize the editing results to other users. Specifically, after a first user edits the online table through a first client, the first client can generate a message body corresponding to each edited cell and send the message bodies corresponding to each cell to the server. The server processes the message bodies corresponding to each cell, thereby updating the online table and synchronizing the updated online table to the clients of other users.
[0103] If a second user edits the online table using a second client while the server is processing the message bodies for each cell, or while the client is sending the message bodies for each cell to the server, inconsistencies may arise between the content displayed in the online table and the user's actions. This discrepancy is particularly pronounced when a user performs batch editing on multiple cells in the online table.
[0104] For example:
[0105] User A modified the values of 10 cells in an online spreadsheet using client A. Then, client A sent the message body corresponding to these 10 cells to the server. While the server was processing the message body sent from client A, user B cleared the contents of these 10 cells using client B. Correspondingly, client B could then send the message body corresponding to these 10 cells to the server. In one scenario:
[0106] After user B clears the contents of these 10 cells using client B, these 10 cells displayed locally on the client are cleared. After the server processes the message body from client A, it synchronizes the updated online table to client B, causing the contents of the aforementioned 10 cells in the online table displayed on client B to be the values modified by user A. Further, after the server processes the message body from client B, it synchronizes the updated online table to client B, at which point the contents of the aforementioned 10 cells in the online table displayed on client B are cleared.
[0107] If the data processing efficiency of the server can be improved, for example, by effectively shortening the time required for the server to process the message body from client A, the above problems can be effectively avoided.
[0108] Therefore, embodiments of this application provide an online form processing method and apparatus.
[0109] The various non-limiting embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0110] Exemplary methods
[0111] See Figure 1 This figure is a schematic flowchart of an online table processing method provided in an embodiment of this application. In one example, Figure 1 The method shown can be executed by the client, for example, by a client that supports online form functionality.
[0112] In this embodiment, the method may include, for example, the following steps: S101-S104.
[0113] S101: In response to an editing operation triggered for an online table, obtain the editing area corresponding to the editing operation, wherein the editing area includes multiple cells.
[0114] In this embodiment, the editing area corresponding to the editing operation can correspond to a rectangular area in an online document, which includes multiple cells. In one example, the editing area can be represented by four parameters: starting row, starting column, number of rows, and number of columns.
[0115] S102: Obtain the edit data corresponding to the plurality of cells, wherein the edit data includes the attribute values edited for each cell in the plurality of cells respectively.
[0116] After determining the editing area, the attribute values edited for each cell in the plurality of cells can be obtained, thereby obtaining the edited data. In one example, the cells in the editing area can be traversed to obtain the attribute values edited for each cell, thereby obtaining the edited data.
[0117] In this embodiment, a cell may include multiple cell attributes, such as cell value, cell style, formula, data validation, etc. The attribute value mentioned here can be the value of a cell attribute. When editing an online table, the values of one or more cell attributes can be set (or modified).
[0118] S103: Obtain the message body based on the edited data.
[0119] In this embodiment of the application, in order to reduce the number of message bodies processed by the server and thus improve the data processing efficiency of the server, a message body can be obtained based on the edited data, instead of generating a corresponding message body for each cell separately.
[0120] In one example, a message body containing the attribute values edited for each cell in the plurality of cells can be obtained directly from the attribute values edited for each cell in the plurality of cells.
[0121] In yet another example, in order to reduce the amount of data included in the message body and thus improve the efficiency of sending the message body to the server, S103 can also be achieved through the following steps A1-A2.
[0122] Step A1: Based on the attribute values edited for each cell in the plurality of cells, obtain the target array corresponding to each cell. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0123] In this embodiment, for the first cell, the attribute values edited for each cell can be carried through the target array corresponding to the first cell. Carrying the attribute values edited for the first cell through an array reduces the amount of data compared to using objects to describe the attribute values edited for each cell in traditional techniques. For example:
[0124] In traditional techniques, the attribute value edited for the first cell can be described using an object, specifically: {attribute1: value1; attribute2, value2; attribute3, value3}. However, the attribute values edited for each cell can be carried using a target array corresponding to the first cell, which is: {value1; value2; value3}. Here, the first element of the target array indicates the attribute value of attribute1, the second element indicates the attribute value of attribute2, and the third element indicates the attribute value of attribute3.
[0125] In this embodiment of the application, the target array corresponding to the first cell includes at least one element, each element corresponds to a cell attribute, and the value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0126] In one example, the value of each element can be the attribute value of the cell property corresponding to that element.
[0127] In yet another example, in order to reduce the amount of data in the target array, the value of an element in the target data can be determined based on the cell attribute corresponding to that element.
[0128] As an example, if the target array corresponding to the first cell includes a first element, and the cell attribute corresponding to the first element is the value of the cell, then the value of the first element can be the value of the first cell.
[0129] As another example, the target array corresponding to the first cell includes a second element, and the cell attribute corresponding to the second element is a first attribute. The first attribute is not the cell value; in other words, the first attribute can be any cell attribute other than the cell's own attribute. Therefore, the value of the second element can be an identifier of the attribute value of the first attribute, rather than the attribute value itself. Generally, the data size of the attribute value of the first attribute is larger than the data size of the identifier. Therefore, using this method can reduce the data size of the target array for the first cell.
[0130] When the value of the second element is the identifier of the attribute value of the first attribute, in the specific implementation of step A1, the attribute value of the first attribute corresponding to the first cell can be obtained, and the identifier can be obtained based on the attribute value of the first attribute, thereby obtaining the target array of the first cell based on the identifier.
[0131] In the embodiments of this application, the identification obtained based on the attribute value of the first attribute can be implemented in various ways.
[0132] In one implementation, the attribute value of the first attribute can be calculated, for example, by performing a hash calculation, to obtain the identifier.
[0133] In another implementation, the identifier can be determined by combining the attribute manager corresponding to the first attribute. The attribute manager corresponding to the first attribute can be used to manage the attribute values of the first attribute and the identifiers corresponding to each attribute value. In a specific example, the attribute value of the first attribute can be used to query the attribute manager corresponding to the first attribute. If the attribute manager includes the correspondence between the attribute value of the first attribute and the identifier corresponding to the attribute value, then the identifier is obtained from the attribute manager. If the attribute manager does not include the attribute value, then the identifier is generated, and the correspondence between the attribute value and the identifier is stored in the attribute manager. This application does not specifically limit the specific implementation method for generating the identifier. In one example, the identifier can be generated according to a preset algorithm. The preset algorithm can be a hash algorithm or other algorithms. For example, the identifier can be generated by sequential numbering. Example:
[0134] Initially, if the content in the property manager corresponding to the first attribute is empty, then the identifier of the attribute value of the first attribute corresponding to the first cell can be 0;
[0135] If the attribute manager of the first attribute includes a correspondence between the value A and the identifier 0, and the attribute value of the first attribute is not A, then the identifier of the generated attribute value of the first attribute can be 1.
[0136] In one example, if the identifier of the attribute value of the first attribute is obtained through the attribute manager of the first attribute, the attribute manager of the first attribute can also be sent to the server so that the server can determine the attribute value of the first attribute corresponding to the first cell based on the attribute manager of the first attribute and the value of the second element corresponding to the first cell.
[0137] In one example, considering that a user might not modify all cell attributes when editing a cell, the values of the elements corresponding to unmodified cell attributes in the array corresponding to that cell are empty (NULL). To further reduce the amount of data in the target array, in one example, step A1 can be implemented through the following steps A11-A12.
[0138] Step A11: Based on the attribute values edited for each cell in the plurality of cells, obtain the initial array corresponding to each cell.
[0139] Step A12: If the values from the nth element to the last element in the initial array are all empty, then delete the nth element to the last element in the initial array to obtain the target array.
[0140] In this embodiment of the application, the initial array may include multiple elements, each element corresponding to a cell attribute, and the value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0141] The initial array may include a first element and a second element. For the values of the first element and the second element, please refer to the relevant description above. The description will not be repeated here.
[0142] In this embodiment, if the values from the nth element to the last element in the initial array are all empty, then to reduce the data size of the array, the values from the nth element to the last element in the initial array can be deleted to obtain the target array. Assuming the value of n is 1, the target array can be empty.
[0143] As mentioned earlier, for a cell, the value of the element corresponding to the unmodified cell attribute in the array corresponding to that cell is NULL. Users can also set the value of a cell attribute to NULL. Therefore, when the value of an element in the array is NULL, it is impossible to distinguish the specific meaning of NULL, that is, it is impossible to distinguish the type of operation the user performed on the cell attribute corresponding to that element. For ease of description, the cell attribute corresponding to the element with an NULL value in the array is called the "target cell attribute." The operation type of the target cell attribute can be: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to NULL.
[0144] In this embodiment, to determine the operation type corresponding to the target cell attribute, the target array corresponding to the first cell may include a third element. For example, the first element in the target data may be a third element. The value of the third element can be used to determine the operation type of the target cell attribute. In one example, the length of the value of the third element may be M bits, where M is the total number of cell attributes. When the operation type of the target cell attribute is to modify the attribute value of the target cell attribute to empty, the bit corresponding to the target cell attribute in the M bits is set (e.g., set to 1). When the operation type of the target cell attribute is not to modify the target cell attribute, the value of the bit corresponding to the target cell attribute in the M bits is a default value (e.g., 0). In this case, before obtaining the target array, the value of the third element can be obtained according to the operation type of the target cell attribute, and then the target array can be obtained according to the value of the third element. In a specific example, if n equals 1, the target array may include only one element, which is the third element.
[0145] Step A2: Based on the target array corresponding to each cell, obtain the message body including the target array corresponding to each cell.
[0146] After obtaining the target arrays corresponding to each cell, a message body including the target arrays corresponding to each cell can be obtained based on these target arrays. In one example, the property manager corresponding to the aforementioned first attribute can also be part of the message body. In this case, step A2 can be implemented as follows: obtaining the message body based on the target arrays corresponding to each cell and the property managers corresponding to each first attribute.
[0147] The target arrays corresponding to each cell and the message body will now be explained with reference to specific examples.
[0148] See Figure 2 The figure is a schematic diagram of an online table provided in an embodiment of this application.
[0149] Assuming the total number of cell attributes is M, the target array can include a maximum of 4 elements: the first element is the third element, the second element is the aforementioned first element (i.e., the element corresponding to the cell value), the third element is the element corresponding to the font, and the fourth element is the element corresponding to the font size. Assuming the user changes the font of the seven cells in rows one through seven of the online table to SimSun, then for each cell, the target array could be: {4, NULL, "0"}, where:
[0150] The value of the third element is 4, which is represented as 0100 in binary. This indicates that the value of the cell was not modified because the second element is NULL. In addition, the cell properties corresponding to the fourth and fifth elements were not modified either. The value of the third element, "0", is the index of the font, SimSun.
[0151] The message body can be, for example, {[4, NULL, "0"], [4, NULL, "0"], [4, NULL, "0"], ..., [4, NULL, "0"]; [Font: SimSun]}. Here, [Font: SimSun] represents the attribute manager corresponding to the font, specifically meaning that the identifier for SimSun is 0. Of course, if the attribute manager corresponding to the font is: [Font: SimSun, KaiTi], then it means that the identifier for SimSun is 0, and the identifier for KaiTi is 1.
[0152] S104: Send the message body to the server.
[0153] After obtaining the message body, the message body can be sent to the server.
[0154] In one example, after the message body is sent to the server, the attribute manager corresponding to the aforementioned first attribute can be destroyed.
[0155] After receiving the message body, the server can execute... Figure 3 Steps S301-S302 are described above. Figure 3 This is a flowchart illustrating another online form processing method provided in an embodiment of this application.
[0156] S301: Based on the message body, obtain the attribute values that are edited for each cell in the plurality of cells respectively.
[0157] In one example, if the message body includes target arrays corresponding to each cell, and the value of the second element is an identifier of the attribute value of the first attribute, then the server can also receive the attribute manager corresponding to the first attribute sent by the client. In this case, in specific implementation, S301 can determine the attribute value of the first attribute corresponding to the first cell based on the value of the second element and the attribute manager. Now, let's illustrate with the above example. Suppose the message body is: {[4, NULL, "0"], [4, NULL, "0"], [4, NULL, "0"], ..., [4, NULL, "0"]; [Font: SimSun]}, then for any target array [4, NULL, "0"], the server can determine that the font of the cell has been modified to SimSun based on the identifier "0" and the attribute manager [Font: SimSun].
[0158] In another example, if the target array includes a third element, the server can determine the operation type corresponding to the target cell attribute based on the value of the third element. For example, in the example above, if the message body is {[4, NULL, "0"], [4, NULL, "0"], [4, NULL, "0"], ..., [4, NULL, "0"]; [Font: SimSun]}, the server can determine based on the value of the third element "4" that the second element NULL indicates that the cell value has not been modified, and also that the cell attributes corresponding to the fourth and fifth elements have not been modified.
[0159] In one example, if the operation type corresponding to the target cell is to modify the attribute value of the target cell to empty, then the server can determine the attribute value of the target cell to be empty.
[0160] S302: Update the online table based on the attribute values edited for each cell in the plurality of cells.
[0161] After obtaining the attribute values edited for each cell in the plurality of cells, the server can update the online table based on these attribute values. For example, the attribute values of each cell in the online table can be modified to reflect the attribute values edited for each cell in the plurality of cells.
[0162] In one example, if the operation type corresponding to the target cell is "do not modify the target cell attribute", then the server does not need to modify the target cell attribute.
[0163] In one example, after the server updates the online table, it can synchronize the updated online table to all clients.
[0164] As described above, this solution allows for the sending of only one message body to the server even when multiple cells are edited, thus reducing the number of messages processed by the server and improving its processing efficiency. Consequently, it ensures that the content displayed in the online table matches the user's actions.
[0165] Furthermore, this solution also simplifies the amount of data carried in the message body, thereby reducing the amount of data sent from the client to the server. Consequently, it improves the efficiency of sending the message body to the server and further enables the content displayed in the online table to be consistent with the user's operation.
[0166] Exemplary device
[0167] Based on the methods provided in the above embodiments, this application also provides a corresponding device, which will be described below with reference to the accompanying drawings.
[0168] See Figure 4 The figure is a schematic diagram of the structure of an online form processing device provided in an embodiment of this application. Figure 4 The device 400 shown can be applied to a client, for example, and includes: a first acquisition unit 401, a second acquisition unit 402, a processing unit 403, and a first sending unit 404.
[0169] The first acquisition unit 401 is used to acquire the editing area corresponding to the editing operation in response to an editing operation triggered for an online table, wherein the editing area includes multiple cells;
[0170] The second acquisition unit 402 is used to acquire the edit data corresponding to the plurality of cells, the edit data including the attribute values edited for each cell in the plurality of cells respectively;
[0171] Processing unit 403 is used to obtain the message body based on the edited data;
[0172] The first sending unit 404 is used to send the message body to the server.
[0173] Optionally, the second acquisition unit 402 is used for:
[0174] The edit data is obtained by traversing each cell in the edit area.
[0175] Optionally, the processing unit 403 is used for:
[0176] Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0177] Based on the target array corresponding to each cell, a message body including the target array corresponding to each cell is obtained.
[0178] Optionally, the target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the first cell.
[0179] Optionally, the target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute.
[0180] Optionally, obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes:
[0181] Get the attribute value of the first attribute corresponding to the first cell;
[0182] The identifier is obtained based on the attribute value of the first attribute;
[0183] Based on the identifier, the target array corresponding to the first cell is obtained.
[0184] Optionally, obtaining the identifier based on the attribute value of the first attribute includes:
[0185] Use the attribute value of the first attribute to query the attribute manager corresponding to the first attribute;
[0186] If the attribute manager includes a correspondence between the attribute value and the corresponding identifier, then the identifier is obtained from the attribute manager;
[0187] If the attribute value is not included in the attribute manager, then the identifier is generated, and the correspondence between the attribute value and the identifier is stored in the attribute manager.
[0188] Optionally, the device further includes:
[0189] The second sending unit is used to send the attribute manager of the first attribute to the server.
[0190] Optionally, obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes:
[0191] Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained;
[0192] If the values from the nth element to the last element in the initial array are all empty, then delete the nth element to the last element in the initial array to obtain the target array.
[0193] Optionally, the target array corresponding to the first cell includes a third element. The value of the third element is used to determine the operation type of the target cell attribute. The target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell. The operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
[0194] See Figure 5 The figure is a schematic diagram of the structure of another online form processing device provided in the embodiments of this application. Figure 5 The device 500 shown can be applied to a server, for example, and includes a first receiving unit 501, an acquisition unit 502, and an update unit 503.
[0195] The first receiving unit 501 is used to receive a message body, which is obtained based on the edit data corresponding to multiple cells in an online table. The edit data includes attribute values edited for each cell in the multiple cells.
[0196] The acquisition unit 502 is used to acquire the attribute values edited for each cell in the plurality of cells according to the message body;
[0197] The update unit 503 is used to update the online table based on the attribute values edited for each cell in the plurality of cells.
[0198] Optionally, the message body includes a target array corresponding to each cell. The target array corresponding to each cell is obtained by editing the attribute values of each cell in the plurality of cells, including a first cell. The target array corresponding to the first cell includes at least one element, each element corresponding to a cell attribute, and the value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
[0199] Optionally, the target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the cell.
[0200] Optionally, the target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute.
[0201] Optionally, the device further includes:
[0202] The second receiving unit is used to receive the attribute manager of the first attribute, wherein the attribute manager of the first attribute includes the correspondence between the attribute value of the first attribute and the identifier.
[0203] Optionally, the acquisition unit 502 is used for:
[0204] Based on the value of the second element and the attribute manager, determine the attribute value of the first attribute corresponding to the first cell.
[0205] Optionally, the last element of the target array is not empty, and the length of the target array is less than a preset length.
[0206] Optionally, the target array corresponding to the first cell includes a third element. The value of the third element is used to determine the operation type of the target cell attribute. The target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell. The operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
[0207] Optionally, the acquisition unit 502 is used for:
[0208] Based on the value of the third element, determine the operation type corresponding to the target cell attribute;
[0209] If the operation type corresponding to the target cell is to modify the attribute value of the target cell to empty, then the attribute value of the target cell is determined to be empty.
[0210] For details on the specific implementation of the devices 400 and 500, please refer to the relevant descriptions in the above method embodiments; they will not be repeated here.
[0211] This application also provides a device, which includes a processor and a memory;
[0212] The processor is used to execute instructions stored in the memory so that the device performs the online table processing method described in any of the above method embodiments.
[0213] This application provides a computer-readable storage medium including instructions that instruct a device to perform the online form processing method described in any of the above method embodiments.
[0214] This application provides a computer program product that, when run on a computer, causes the computer to execute the online form processing method described in any of the above method embodiments.
[0215] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0216] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
[0217] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An online form processing method, characterized in that, The method includes: In response to an editing operation triggered on an online table, the editing area corresponding to the editing operation is obtained, and the editing area includes multiple cells; Obtain the edit data corresponding to the plurality of cells, wherein the edit data includes attribute values edited for each cell in the plurality of cells respectively; A message body is obtained based on the edited data, and the message body includes the edited data; Send the message body to the server; The step of obtaining a message body based on the edited data includes: Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element. Based on the target arrays corresponding to each cell, a message body is obtained that includes the target arrays corresponding to each cell; wherein: The target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute. The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Obtain the attribute value of the first attribute corresponding to the first cell; obtain the identifier based on the attribute value of the first attribute; obtain the target array corresponding to the first cell based on the identifier; or, The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained; if the values from the nth element to the last element in the initial array are all empty, then the nth element to the last element in the initial array is deleted to obtain the target array; wherein: the target array corresponding to the first cell includes a third element, the value of the third element is used to determine the operation type of the target cell attribute, the target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell, and the operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
2. The method according to claim 1, characterized in that, The step of obtaining the edit data corresponding to the plurality of cells includes: The edit data is obtained by traversing each cell in the edit area.
3. The method according to claim 1, characterized in that, The target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the cell value, and the value of the first element is the value of the first cell.
4. The method according to claim 1, characterized in that, The step of obtaining the identifier based on the attribute value of the first attribute includes: Use the attribute value of the first attribute to query the attribute manager corresponding to the first attribute; If the attribute manager includes a correspondence between the attribute value and the corresponding identifier, then the identifier is obtained from the attribute manager; If the attribute value is not included in the attribute manager, then the identifier is generated, and the correspondence between the attribute value and the identifier is stored in the attribute manager.
5. The method according to claim 4, characterized in that, The method further includes: Send the attribute manager of the first attribute to the server.
6. An online form processing method, characterized in that, The method includes: Receive a message body, which is obtained based on edit data corresponding to multiple cells in an online table, wherein the edit data includes attribute values edited for each of the multiple cells respectively; Based on the message body, obtain the attribute values that are edited for each cell in the plurality of cells respectively; The online table is updated based on the attribute values edited for each cell in the plurality of cells; wherein: The process of obtaining the message body based on the edit data corresponding to the multiple cells is as follows: Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element. Based on the target arrays corresponding to each cell, a message body is obtained that includes the target arrays corresponding to each cell; wherein: The target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute. The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Obtain the attribute value of the first attribute corresponding to the first cell; obtain the identifier based on the attribute value of the first attribute; obtain the target array corresponding to the first cell based on the identifier; or, The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained; if the values from the nth element to the last element in the initial array are all empty, then the nth element to the last element in the initial array is deleted to obtain the target array; wherein: the target array corresponding to the first cell includes a third element, the value of the third element is used to determine the operation type of the target cell attribute, the target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell, and the operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
7. The method according to claim 6, characterized in that, The message body includes a target array corresponding to each cell. The target array corresponding to each cell is obtained by editing the attribute values of each cell in the plurality of cells. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element.
8. The method according to claim 7, characterized in that, The target array corresponding to the first cell includes a first element, the cell attribute corresponding to the first element is the value of the cell, and the value of the first element is the value of the cell.
9. The method according to claim 6, characterized in that, The method further includes: The attribute manager receives the first attribute, and the attribute manager of the first attribute includes the correspondence between the attribute value of the first attribute and the identifier.
10. The method according to claim 9, characterized in that, The step of obtaining the attribute values edited for each cell in the plurality of cells according to the message body includes: Based on the value of the second element and the attribute manager, determine the attribute value of the first attribute corresponding to the first cell.
11. The method according to claim 7, characterized in that, The last element of the target array is not empty, and the length of the target array is less than a preset length.
12. The method according to claim 6, characterized in that, The step of obtaining the attribute values edited for each cell in the plurality of cells according to the message body includes: Based on the value of the third element, determine the operation type corresponding to the target cell attribute; If the operation type corresponding to the target cell is to modify the attribute value of the target cell to empty, then the attribute value of the target cell is determined to be empty.
13. An online form processing device, characterized in that, The device includes: The first acquisition unit is configured to, in response to an editing operation triggered on an online table, acquire the editing area corresponding to the editing operation, wherein the editing area includes multiple cells; The second acquisition unit is used to acquire the edit data corresponding to the plurality of cells, wherein the edit data includes attribute values edited for each cell in the plurality of cells respectively; A processing unit is configured to obtain a message body based on the edited data; The first sending unit is used to send the message body to the server. The processing unit is specifically used for: Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element. Based on the target arrays corresponding to each cell, a message body is obtained that includes the target arrays corresponding to each cell; wherein: The target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute. The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Obtain the attribute value of the first attribute corresponding to the first cell; obtain the identifier based on the attribute value of the first attribute; obtain the target array corresponding to the first cell based on the identifier; or, The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained; if the values from the nth element to the last element in the initial array are all empty, then the nth element to the last element in the initial array is deleted to obtain the target array; wherein: the target array corresponding to the first cell includes a third element, the value of the third element is used to determine the operation type of the target cell attribute, the target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell, and the operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
14. An online form processing device, characterized in that, The device includes: The first receiving unit is used to receive a message body, which is obtained based on the edit data corresponding to multiple cells in an online table. The edit data includes attribute values edited for each cell in the multiple cells. The acquisition unit is used to acquire, based on the message body, the attribute values edited for each cell in the plurality of cells respectively; The update unit is used to update the online table based on the attribute values edited for each cell in the plurality of cells; wherein: The process of obtaining the message body based on the edit data corresponding to the multiple cells is as follows: Based on the attribute values edited for each cell in the plurality of cells, a target array corresponding to each cell is obtained. The plurality of cells include a first cell. The target array corresponding to the first cell includes at least one element. Each element corresponds to a cell attribute. The value of each element is used to indicate the attribute value of the cell attribute corresponding to that element. Based on the target arrays corresponding to each cell, a message body is obtained that includes the target arrays corresponding to each cell; wherein: The target array corresponding to the first cell includes a second element, the cell attribute corresponding to the second element is a first attribute, the first attribute is not the value of the cell, and the value of the second element is an identifier of the attribute value of the first attribute. The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Obtain the attribute value of the first attribute corresponding to the first cell; obtain the identifier based on the attribute value of the first attribute; obtain the target array corresponding to the first cell based on the identifier; or, The step of obtaining the target array corresponding to each cell based on the attribute values edited for each cell in the plurality of cells includes: Based on the attribute values edited for each cell in the plurality of cells, an initial array corresponding to each cell is obtained; if the values from the nth element to the last element in the initial array are all empty, then the nth element to the last element in the initial array is deleted to obtain the target array; wherein: the target array corresponding to the first cell includes a third element, the value of the third element is used to determine the operation type of the target cell attribute, the target cell attribute is the cell attribute corresponding to the element with an empty value in the target array corresponding to the first cell, and the operation type includes: not modifying the target cell attribute, or modifying the attribute value of the target cell attribute to empty.
15. An online form processing device, characterized in that, The online form processing device includes a processor and a memory; The processor is configured to execute instructions stored in the memory to cause the online form processing device to perform the method as described in any one of claims 1 to 12.
16. A computer-readable storage medium, characterized in that, Includes instructions that instruct the device to perform the method as described in any one of claims 1 to 12.
Citation Information
Patent Citations
Efficient copy paste in collaborative spreadsheet
CN106663088A
Mapping relationship display method and device, electronic equipment and storage medium
CN113722345A