File processing method and device, electronic equipment and storage medium

CN116702720BActive Publication Date: 2026-09-15NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310759920.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-26
Publication Date
2026-09-15
Estimated Expiration
2043-06-26

AI Technical Summary

Technical Problem

[0004]但是,上述方法的比较方式较为片面,比较结果的准确性较差,从而基于比较结果进行融合,生成的融合结果准确性较差

Benefits of technology

[0019] This application provides a file processing method, apparatus, electronic device, and storage medium. The method converts the table file to be processed based on the preset structure information of the table file type, generates tree data of the table file to be processed, and then performs tree comparison based on the tree data of the table file to be processed, ensuring the accuracy of the correspondence between the sub-units of different table files, thereby ensuring the accuracy of the comparison results of different table files to be processed. Based on the comparison results, the fusion and conflict determination of local table files and remote table files can be performed to determine the fusion content between local table files and remote table files, thereby realizing automatic fusion processing between local table files and remote table files and improving the accuracy of file fusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116702720B_ABST
    Figure CN116702720B_ABST
Patent Text Reader

Abstract

The application provides a file processing method and device, electronic equipment and storage medium, and relates to the technical field of data processing. The method is based on preset structure information of a table type file to realize conversion of a to-be-processed table file, generate tree data of the to-be-processed table file, and perform tree comparison based on the tree data of the to-be-processed table file, thereby ensuring the accuracy of the correspondence relationship between sub-units in different table files, ensuring the accuracy of the comparison result of different to-be-processed table files, and based on the comparison result, the fusion and conflict determination of a local table file and a remote table file can be performed to determine the fusion content between the local table file and the remote table file, thereby realizing automatic fusion processing between the local table file and the remote table file and improving the accuracy of file fusion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a document processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] In online game development, developers often use Excel files to configure game content and then commit these Excel files to version control tools such as SVN and Git for processing. Because version control tools treat Excel files as binary files, conflicts often arise when multiple people modify and commit the same Excel file (e.g., branch merging), making it impossible to guarantee the accuracy of the generated latest version. Therefore, file comparison and merging are needed to resolve these file modification conflicts.

[0003] In existing technologies, the commonly used method for comparing Excel files is based on the longest common subsequence algorithm. The comparison process involves calculating the similarity of rows and columns in the two Excel files to be compared, finding the correspondence between rows and columns in the two Excel files, thereby determining the addition and deletion of rows and columns and the modification of cells, and completing the fusion process of the Excel files based on this.

[0004] However, the comparison method described above is rather one-sided, and the accuracy of the comparison results is poor. Therefore, the fusion result generated based on the comparison results is also inaccurate. Summary of the Invention

[0005] The purpose of this application is to provide a document processing method, apparatus, electronic device, and storage medium to improve the accuracy of table document comparison and fusion.

[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:

[0007] In a first aspect, embodiments of this application provide a file processing method, including: converting each table file to be processed according to preset structure information of a table type file to generate tree-like data of each table file to be processed, wherein the preset structure information includes: the hierarchical relationship of sub-units; corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files, and remote table files;

[0008] The tree data of each table file to be processed is compared to obtain the comparison results of each node in the tree data of each table file to be processed. The comparison results represent the relative modifications between different table files to be processed.

[0009] Based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file, the fusion status of each node in the tree data of the local table file and the fusion status of each node in the tree data of the remote table file are determined.

[0010] Based on the comparison results of each node in the tree data of the remote table file, the fusion status of the nodes in the tree data of the local table file is updated, and the local table file is updated based on the fusion status and node type of the nodes in the updated tree data of the local table file.

[0011] Secondly, embodiments of this application also provide a file processing apparatus, including: a generation module, a comparison module, a determination module, and an update module;

[0012] The generation module is used to convert each table file to be processed according to the preset structure information of the table type file, and generate tree data of each table file to be processed. The preset structure information includes: the hierarchical relationship of sub-units; corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files and remote table files.

[0013] The comparison module is used to compare the tree data of each table file to be processed, and obtain the comparison results of each node in the tree data of each table file to be processed. The comparison results represent the relative modifications between different table files to be processed.

[0014] The determining module is used to determine the fusion state of each node in the tree data of the local table file and the fusion state of each node in the tree data of the remote table file based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the tree data of the remote table file.

[0015] The update module is used to update the fusion status of nodes in the tree data of the local table file according to the comparison results of each node in the tree data of the remote table file, and to update the local table file according to the fusion status and node type of the nodes in the updated tree data of the local table file.

[0016] Thirdly, embodiments of this application provide an electronic device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to implement the file processing method provided in the first aspect.

[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the file processing method as provided in the first aspect.

[0018] The beneficial effects of this application are:

[0019] This application provides a file processing method, apparatus, electronic device, and storage medium. The method converts the table file to be processed based on the preset structure information of the table file type, generates tree data of the table file to be processed, and then performs tree comparison based on the tree data of the table file to be processed, ensuring the accuracy of the correspondence between the sub-units of different table files, thereby ensuring the accuracy of the comparison results of different table files to be processed. Based on the comparison results, the fusion and conflict determination of local table files and remote table files can be performed to determine the fusion content between local table files and remote table files, thereby realizing automatic fusion processing between local table files and remote table files and improving the accuracy of file fusion.

[0020] In addition, the provided Windows platform graphical interface displays the comparison results and fusion status according to the preset display style, allowing users to conveniently and clearly view the comparison and fusion results and handle conflicts. This reduces the workload of manually handling Excel file conflicts, improves the accuracy of Excel file conflict handling, and increases the efficiency of Excel file processing during branch development. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 Flowchart of the document processing method provided in the embodiments of this application Figure 1 ;

[0023] Figure 2 Flowchart of the document processing method provided in the embodiments of this application Figure 2 ;

[0024] Figure 3 A tree-structured data diagram of a tabular file provided in this application embodiment;

[0025] Figure 4 Flowchart of the document processing method provided in the embodiments of this application Figure 3 ;

[0026] Figure 5 Flowchart of the document processing method provided in the embodiments of this application Figure 4 ;

[0027] Figure 6 Flowchart of the document processing method provided in the embodiments of this application Figure 5 ;

[0028] Figure 7 Flowchart of the document processing method provided in the embodiments of this application Figure 6 ;

[0029] Figure 8 Flowchart of the document processing method provided in the embodiments of this application Figure 7 ;

[0030] Figure 9 Flowchart of the document processing method provided in the embodiments of this application Figure 8 ;

[0031] Figure 10 Flowchart of the document processing method provided in the embodiments of this application Figure 9 ;

[0032] Figure 11 Flowchart of the document processing method provided in the embodiments of this application Figure 10 ;

[0033] Figure 12 A schematic diagram of a document processing apparatus provided in an embodiment of this application;

[0034] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0036] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0037] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0038] In online game development, developers often use Excel files to configure game content and incorporate these files into version control tools such as SVN (subversion, an open-source version control system) and Git (an open-source distributed version control system). Because these tools treat Excel files as binary files, conflicts often arise when multiple people modify and commit the same Excel file (e.g., during branch merging). These conflicts typically require committers to compare the files using Excel file comparison tools, manually modify the Excel files, and resubmit. To improve the efficiency and accuracy of this conflict resolution process, a highly efficient and accurate Excel file comparison and merging system is usually needed.

[0039] In common Excel file comparison and merging systems, the common comparison method is generally based on the Longest Common Subsequence (LCS) algorithm. The comparison process uses the LCS algorithm to calculate the similarity of rows and columns in the two two-dimensional tables being compared, finds the correspondence between rows and columns in the two Excel tables, and thus determines the addition and deletion of rows and columns, as well as the modification of cells. Based on this, the Excel files are then merged.

[0040] Current Excel file comparison and fusion systems typically suffer from the following three problems:

[0041] 1. The accuracy of the comparison and fusion results cannot be guaranteed.

[0042] As mentioned above, the commonly used method for comparing Excel files is based on the longest common subsequence. This method calculates the correspondence between Excel rows and columns based on similarity. Depending on the specific use case and data, there may be errors or situations that cannot be handled (such as modification of similar rows and columns, or addition and deletion of entire rows and columns). It cannot always produce accurate comparison results for Excel files, and further affects the accuracy and stability of Excel file fusion.

[0043] 2. Some code frameworks do not provide adequate support for reading and writing Excel files.

[0044] Currently, common codebases such as Python, Java, and C# have various codebases that support reading and writing Excel files. However, due to the large number of versions of Excel software (i.e., Office software) (such as Office 2016, Office 365, Office 2019, etc.) and the diversity of Excel file content (including numbers, text, hyperlinks, formatting, comments, formulas, filtering, and data validation, etc.), some codebases do not provide complete support for reading and writing Excel files or lack maintenance. Opening and generating specific versions of Excel files may result in the loss of some content (such as comments and formatting), and it cannot be guaranteed that the merged file will be consistent with the original file in all the above aspects.

[0045] 3. Cross-platform support for comparing and merging Excel files is not implemented.

[0046] Existing Excel file comparison and merging systems are typically implemented on the Windows platform, failing to achieve cross-platform compatibility. In demanding development workflows with multiple branches, automating branch merging via a server can significantly improve efficiency, thus creating a need for cross-platform support for Excel file comparison and merging systems.

[0047] Addressing the issues of accuracy, Excel file support, and cross-platform compatibility in existing Excel file comparison and fusion systems, this application provides a cross-platform Excel file comparison and fusion system based on structured information. This system transforms the comparison and fusion of Excel files into tree-like data for processing, enabling the comparison and fusion of multiple versions of Excel files across multiple platforms, thereby improving the accuracy and efficiency of Excel file fusion.

[0048] Figure 1 Flowchart of the document processing method provided in the embodiments of this application Figure 1 The execution subject of this method can be a computer device, such as... Figure 1 As shown, the method may include:

[0049] S101. Based on the preset structure information of the table type file, convert each table file to be processed to generate tree data of each table file to be processed. The preset structure information includes: the hierarchical relationship of sub-units; the corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files and remote table files.

[0050] Table-type files are typically composed of rows, columns, and cells formed by rows and columns, such as the commonly used Excel file. The structure of a table-type file is generally fixed, usually consisting of worksheets, rows, columns, and cells. The hierarchical relationship between these sub-units is also pre-defined. That is, the pre-defined structural information can include the sub-units that make up the table-type file and the hierarchical relationship between them. Based on this pre-defined structural information, the table-type file can be formatted. In this embodiment, the table file can be converted into tree-like data for processing.

[0051] In some embodiments, to facilitate comparison between different table files and ensure the correspondence of the comparison, the same identification information can be assigned to corresponding sub-cells in different table files. For example, worksheet 1 in table file 1 and worksheet 1 in table file 2 have the same identification information, and row 1 under worksheet 1 in table file 1 and row 1 under worksheet 1 in table file 2 have the same identification information. That is, the corresponding worksheets, rows, and columns in different table files have the same ID, and each ID is unique, thereby facilitating the indexing of corresponding sub-cells in different table files.

[0052] Optionally, the table files to be processed in this scheme may include original table files, local table files, and remote table files. The original table file may refer to the base table file (or an older version of the table file, the `base` file), the local table file may refer to the locally modified file (or the table file of the local branch, the `local` file), and the remote table file may refer to the latest version of the table file stored remotely (or the table file of the remote branch, the `remote` file). The common ancestor version of the local table file and the remote table file is the original table file.

[0053] The remote table file can also be understood as the latest table file. It exists as a public file. When multiple users modify the same original table file, since different users may modify it in different orders, each user will submit the modified table file to the remote location for storage after making changes locally. In principle, the changes of the next user should be based on the latest table file modified and submitted by the previous user, that is, the changes of the next user should be based on the remote table file. However, due to the possibility of data asynchrony, the remote table file may not be available in time. Therefore, when each user makes changes locally, they usually modify the original table file to generate a local table file, and then merge the local table file with the remote table file to obtain the latest locally modified file before submitting it, thereby ensuring the accuracy and completeness of the file modification.

[0054] For example: Both a and b need to modify the original table file. a first modifies it locally and commits it to the remote end. When b modifies it locally, it should theoretically be based on the latest version of the table file (remote table file) committed by a and stored on the remote end. However, there may be data synchronization issues. b may not have obtained the remote table file and is also modifying it based on the original table file. In this case, the modifications made by a and b may conflict. b needs to compare and merge its local modifications (local table file) with the remote table file to generate the modified file.

[0055] S102. Compare the tree data of each table file to be processed to obtain the comparison results of each node in the tree data of each table file to be processed. The comparison results represent the relative modifications between different table files to be processed.

[0056] It should be noted that the file comparison process usually occurs when a user views local file modifications or the differences between two versions (or branches) of a file, and mainly involves two files: the original table file and the local table file.

[0057] The merging process often occurs when a user commits local changes or merges branches, and mainly involves three files: the original spreadsheet file, the local spreadsheet file, and the remote spreadsheet file. Furthermore, the merging process requires a merging decision based on the comparison results generated during the comparison process.

[0058] When this method is applied to a file comparison scenario, the table text to be processed can include: the original table file and the local table file.

[0059] When this method is applied to a file fusion scenario, the table text to be processed can include: the original table file, the local table file, and the remote table file.

[0060] Optionally, a tree comparison can be performed based on the tree-structured data of the converted table files. The tree-structured data displays each sub-cell in the table file as tree nodes. Comparing the table files is essentially comparing each sub-cell, which is equivalent to comparing each node in the tree-structured data. This generates comparison results for each node in the tree-structured data of each table file to be processed. Each table file to be processed corresponds to tree-structured data, and each tree-structured data can correspond to a data table used to record the attribute information of the nodes in the tree-structured data. The comparison result of a node can be one of the node's attribute information.

[0061] The comparison result can represent the relative modifications between different table files to be processed. For example, if the two table files to be compared are a and b, then if the comparison result of node 1 (let's say row 1) in the tree data of table file a is "added", it means that table file a has added row 1 relative to table file b.

[0062] S103. Based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file, determine the fusion status of each node in the tree data of the local table file and the fusion status of each node in the tree data of the remote table file.

[0063] As explained above, table merging requires integrating modifications made to both the local and remote table files. Therefore, we first obtain the comparison results of each node in the tree data of the local table file and the corresponding node in the tree data of the remote table file. Then, based on these comparison results, we determine the merging conflict between the two table files. Based on the determination results, we generate the merging status of each node in the tree data of both the local and remote table files.

[0064] In some embodiments, the fusion status can indicate whether nodes can be fused. When the fusion status is fused, fused nodes can be fused. When there is a conflict, it means that different modification methods have occurred for the same node, and the conflict needs to be resolved.

[0065] S104. Based on the comparison results of each node in the tree data of the remote table file, update the fusion status of the nodes in the tree data of the local table file, and update the local table file based on the fusion status and node type of the nodes in the updated tree data of the local table file.

[0066] In some embodiments, based on the comparison results, the fusion status of nodes in the tree data of the local table file can be updated based on the comparison results of each node in the tree data of the remote table file, so as to obtain a more accurate fusion status of nodes in the tree data of the local table file.

[0067] Optionally, the local table file can be modified and updated based on the fusion status of nodes in the updated tree data and the node type to generate a locally modified target table file. After the locally modified target table file is committed, the current remote table file can be updated to obtain a new remote table file.

[0068] In summary, the file processing method provided in this embodiment converts the table files to be processed based on the preset structure information of the table type files, generates tree data of the table files to be processed, and then performs tree comparison based on the tree data of the table files to be processed, ensuring the accuracy of the correspondence between the sub-units of different table files, thereby ensuring the accuracy of the comparison results of different table files to be processed. Based on the comparison results, the fusion and conflict determination of local table files and remote table files can be performed to determine the fusion content between local table files and remote table files, thereby realizing automatic fusion processing between local table files and remote table files and improving the accuracy of file fusion.

[0069] Figure 2 Flowchart of the document processing method provided in the embodiments of this application Figure 2 Optionally, in a conventional table-type file, sub-units can include: file table, row, column, and cell; this embodiment is illustrated using a table file containing four types of sub-units: file table, row, column, and cell.

[0070] Optionally, in step S101, converting each table file to be processed according to the preset structure information of the table type file to generate tree data of each table file to be processed may include:

[0071] S201. Based on the hierarchical relationship of each sub-unit in the table-type file and the pre-configured sub-unit filtering conditions and identifier generation method, filter the sub-units to be processed in each table file and assign identifier information to each filtered sub-unit.

[0072] In some embodiments, since the table file contains a large number of sub-cells, there may be multiple sub-cells of one type, such as multiple rows, multiple columns, or multiple worksheets. Therefore, comparisons of table files may often only involve comparing a subset of the sub-cells, rather than comparing all of them.

[0073] Based on this, in this embodiment, according to the pre-configured sub-unit filtering conditions and identifier generation method, the sub-units to be processed in each table file to be processed are filtered according to the hierarchical relationship of the sub-units in the preset structural information, and identifier information is assigned to each filtered sub-unit.

[0074] The sub-cell filter criteria can indicate the identifier of the sub-cell to be selected. Sub-cell filter criteria can include: worksheet filter criteria, row filter criteria, column filter criteria, and cell filter criteria.

[0075] Regarding the generation of sub-cell identifiers, for worksheets, the worksheet title or worksheet number can be used as its identifier; for rows, the first cell of two columns can be used as the row identifier or the row number can be used; for columns, the first n cells of a row can be used as the column identifier or the column number can be used; for cells, the row identifier and column identifier can be combined to form the cell identifier.

[0076] S202. Based on the hierarchical relationship of each selected sub-unit, construct a tree-like data structure for the table file to be processed from top to bottom. The number of layers in the tree-like data is consistent with the number of types of sub-units, and the type of nodes contained in each layer is determined according to the hierarchical relationship of each sub-unit.

[0077] Optionally, in a table-type file, there is a clear hierarchical relationship between the file tables, rows, columns, and cells: for example, a table file contains multiple worksheets, each worksheet contains multiple rows and columns, and each row and column contains multiple non-empty cells.

[0078] The process of generating tree-structured data from a tabular file can be as follows:

[0079] 1) Read the table file to be processed and initialize the root node, i.e., the file node.

[0080] 2) Traverse all worksheets in the table file to be processed, generate worksheet nodes for the worksheets to be processed in the table file according to the worksheet filter conditions and worksheet identifier generation rules, and put them into the child node list of the root node in turn.

[0081] 3) For all worksheets to be processed, traverse the rows and columns respectively, generate row nodes or column nodes for the rows or columns to be processed according to the filtering conditions and identifier generation rules of the rows and columns, and put them into the child node list of the worksheet node in turn.

[0082] 4) For each worksheet, iterate through all non-empty cells, generate cell nodes for the cells to be processed based on cell filtering conditions and identifier generation rules, find the corresponding row and column nodes for that cell, and add the cell node to the child node list of the row node and column node respectively.

[0083] Through the above algorithm, the table file to be processed can be converted into a four-level tree structure with the file node as the root node and the layers from top to bottom being file nodes, worksheet nodes, row and column nodes, and cell nodes.

[0084] Figure 3 This is a schematic diagram of a tree-like data structure for a tabular file, as provided in an embodiment of this application.

[0085] like Figure 3 The diagram shown illustrates how an Excel file is converted into a tree-like data structure, with the following layers from top to bottom: Excel file, worksheet, row or column, and cell.

[0086] like Figure 3 The diagram illustrates the inclusion relationship between sub-cells in each layer. An Excel file includes Worksheet 1 and Worksheet 2, etc. Worksheet 1 contains Row 1, Row 2, Column 1 and Column 2, etc., and Row 1 and Column 1 form Cell 1, Row 1 and Column 2 form Cell 2, Row 2 and Column 1 form Cell 3, Row 2 and Column 2 form Cell 4, etc.

[0087] Figure 4 Flowchart of the document processing method provided in the embodiments of this application Figure 3 Optionally, in step S102, comparing the tree data of each table file to be processed to obtain the comparison results of each node in the tree data of each table file to be processed may include:

[0088] S401. Compare the tree data in the local table file with the corresponding nodes in the tree data of the original table file, and generate the comparison results of each node in the tree data of the local table file. The comparison results include: addition, deletion, modification and no operation.

[0089] In some embodiments, since both the local table file and the remote table file are obtained by modifying the original table file, the local table file can be compared with the original table file first to obtain the comparison result of the local table file; then the remote table file can be compared with the original table file to obtain the comparison result of the remote table file.

[0090] Therefore, it's possible to compare the corresponding nodes in the tree structure of the local table file with those in the tree structure of the original table file, generating comparison results for each node in the local table file's tree structure. Here, comparing corresponding nodes can refer to comparing two corresponding nodes (two nodes with the same identifier information) in the two tree structures. For example, comparing node 1 in the local table file's tree structure with node 1 in the original table file's tree structure, and comparing node 2 in the local table file's tree structure with node 2 in the original table file, etc.

[0091] S402. Compare the tree data of the remote table file with the corresponding nodes in the tree data of the original table file to generate the comparison results of each node in the tree data of the remote table file.

[0092] Similarly, by comparing the tree data of the remote table file with the corresponding nodes in the tree data of the original table file, the comparison results of each node in the tree data of the remote table file are generated.

[0093] Figure 5 Flowchart of the document processing method provided in the embodiments of this application Figure 4 Optionally, in step S401, comparing the tree data of the local table file with the corresponding nodes in the tree data of the original table file to generate the comparison results of each node in the tree data of the local table file may include:

[0094] S501. If the corresponding node to be compared is empty in the tree data of the local table file but not empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the original table file is determined to be deletion.

[0095] In some embodiments, the tree data of the local table file and the tree data of the original table file can be converted into a node dictionary. Then, by traversing all the keys in the node dictionary, the node index can be performed to compare all the corresponding nodes.

[0096] A node dictionary can refer to a tree-like structure where the node identifier is the key and the node itself is the value. For example, if we assume that the identifier of row 1 in the tree data is 'a' and use it as the key, then when indexing by key, we can find row 1 by searching for key 'a', and then compare row 1.

[0097] The above-mentioned conversion of tree data into a node dictionary is only for the purpose of facilitating indexing of the corresponding nodes. In practical applications, this processing can be omitted.

[0098] In the first scenario, if the corresponding node to be compared is empty in the tree data of the local table file but not empty in the tree data of the original table file, meaning that the node has actually been deleted in the local table file, and since it is in a deleted state, the tree data of the local table file does not contain the corresponding node, and the node comparison result cannot be recorded, then the comparison result of the corresponding node can be recorded as deleted in the tree data of the original table file.

[0099] S502. If the corresponding node to be compared is not empty in the tree data of the local table file, but is empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the local table file is determined to be an addition.

[0100] In the second scenario, if the corresponding node to be compared is not empty in the tree data of the local table file but is empty in the tree data of the original table file, that is, the node has actually been added in the local table file. Since the corresponding node exists in the tree data of the local table file, the comparison result of the corresponding node can be recorded as an addition in the tree data of the local table file.

[0101] S503. If the corresponding node to be compared is not empty in the tree data of the local table file and the tree data of the original table file, then recursively search the cell nodes in the child nodes of the corresponding node, and determine the comparison results of the corresponding node in the tree data of the local table file and the tree data of the original table file based on the value of the cell node.

[0102] In the third case, if the corresponding node to be compared is not empty in the tree data of the local table file and the tree data of the original table file, and the corresponding node is a cell node, then the comparison result of the corresponding node can be determined based on the value of the cell node in the local table file and the value in the original table file.

[0103] If the corresponding node is not a cell node, the comparison result of the corresponding node is determined by the comparison result of the child nodes of the corresponding node. The comparison result of the corresponding node can be determined by recursively comparing the child nodes of the corresponding node and finding them in turn according to the comparison method of cell nodes.

[0104] S504. Based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file, determine the comparison results of each node in the tree data of the local table file.

[0105] Optionally, since some comparison results of the local table file relative to the original table file are recorded in the node comparison results of the tree data of the original table file, the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file can be combined to obtain the comparison results of each node in the tree data of the local table file.

[0106] Optionally, in step S503, determining the comparison results of the corresponding node in the tree data of the local table file and in the tree data of the original table file based on the value of the cell node may include: if the value of the cell node is inconsistent in the tree data of the local table file and in the tree data of the original table file, then determining that the comparison results of the corresponding node in the tree data of the local table file and in the tree data of the original table file are modified.

[0107] In the third scenario described above, when the corresponding node is a cell node, for the comparison of cell nodes, if the value of the cell node is inconsistent in the tree data of the local table file and the tree data of the original table file—that is, the same cell has different data in the local and original table files—then it can be determined that the comparison result of the corresponding node in both the local and original table file tree data is modified. Conversely, if the value of the cell node is consistent in both the local and original table file tree data, then it can be determined that the comparison result of the corresponding node in both the local and original table file tree data is unchanged.

[0108] If the comparison results of all corresponding nodes in the tree data of the local table file and the tree data of the original table file are both unchanged, then the comparison result of the two table files is "no operation"; otherwise, the comparison result is "modified".

[0109] Figure 6 Flowchart of the document processing method provided in the embodiments of this application Figure 5 Optionally, in step S504, determining the comparison results of each node in the tree data of the local table file based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file may include:

[0110] S601. Obtain the comparison results of nodes in the tree data of the local table file as candidate nodes for addition and modification, and the comparison results of nodes in the tree data of the original table file as candidate nodes for deletion and modification.

[0111] Optionally, the comparison results of all nodes in the tree data of the local table file can be traversed to obtain all nodes whose comparison results are "added" and "modified" as candidate nodes; and the comparison results of all nodes in the tree data of the original table file can be traversed to obtain all nodes whose comparison results are "deleted" and "modified" as candidate nodes.

[0112] S602. Based on the comparison results of each candidate node, generate the comparison results of each node in the tree data of the local table file.

[0113] Therefore, the comparison results of each node in the tree data of the local table file can be generated from the comparison results of each candidate node obtained above.

[0114] Table 1 below illustrates the comparison results of each node in the tree data of the generated table file:

[0115] Table 1

[0116]

[0117]

[0118] Among them, the last four rows (Worksheet 3, Table 3-Row 2, Table 3-Column 5, Table 3-Cell (2, 5)) are the comparison results of modified and deleted nodes in the tree data of the original table file, and are used as part of the node comparison results in the tree data of the local table file.

[0119] Optionally, the comparison results of nodes in the tree data of the remote table file can be generated by referring to the above steps, and will not be repeated here.

[0120] Figure 7 Flowchart of the document processing method provided in the embodiments of this application Figure 6 Optionally, in step S103, determining the fusion status of each node in the tree data of the local table file and the fusion status of each node in the tree data of the remote table file based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file may include:

[0121] S701. The comparison result of the corresponding node in the tree data of the local table file and the tree data of the remote table file is the newly added node. The child nodes of the corresponding node and the comparison result of the child nodes are completed in the tree data. The comparison result of the corresponding node is updated from newly added to modified. The comparison results of each node in the tree data of the local table file and the comparison results of each node in the tree data of the remote table file are obtained respectively.

[0122] Through the above embodiments, the comparison results of each node in the tree data of the local table file and the comparison results of each node in the tree data of the remote table file can be obtained respectively. Next, the comparison results of each node in the tree data of the local table file and the comparison results of each node in the tree data of the remote table file can be updated based on the comparison results of the corresponding nodes. This ensures that the comparison results of each node are accurate when determining the fusion state, thereby improving the accuracy of the fusion result.

[0123] Optionally, for nodes whose comparison results (under the same ID) in the tree data of the local table file and the tree data of the remote table file are both newly added, a recursive comparison of the subtrees is performed (the comparison method here can refer to the three cases in steps S501-S503 for comparison), to complete the comparison results of all nodes (child nodes of the corresponding nodes) in the two subtrees, and to modify the comparison result of the root node (corresponding node) of the subtree.

[0124] Table 2 illustrates the comparison results of each updated node in the tree data of the local table file:

[0125] Table 2

[0126] Worksheet 2 Revise Table 2, Row 5 Revise Table 2-Column 6 Revise Table 2 - Cell (5, 6) Revise Worksheet 3 Revise Table 3 - Row 1 Revise Table 3-Column 5 Revise Table 3 - Cell (1, 5) Revise Worksheet 5 delete Table 5 - Row 1 delete Table 5-Column 6 delete Table 5 - Cell (1, 6) delete

[0127] Table 3 illustrates the comparison results of each node in the tree data of the remote table file after the update:

[0128] Table 3

[0129]

[0130]

[0131] S702. Find the union of the updated nodes in the tree data of the local table file and the updated nodes in the tree data of the remote table file to obtain the node set.

[0132] Optionally, the updated nodes in the tree data of the local table file and the updated nodes in the tree data of the remote table file can be joined to obtain a node set. In some embodiments, the obtained node set can be represented in the form of a queue, that is, a queue of all nodes is generated. In this way, when traversing nodes and performing conflict determination, the node that needs to be traversed can be taken sequentially from the head of the queue, which can avoid the repetition of node traversal. Alternatively, the node set can be represented in the form of a sequence.

[0133] S703. Iterate through each node in the node set in sequence, and generate the updated fusion status of each node in the local table file and the updated fusion status of each node in the remote table file based on the comparison results of the currently traversed node in the tree data of the local table file and the comparison results of the tree data of the remote table file. The fusion status includes: no operation, can be merged, conflict, to be added, to be deleted, and to be modified.

[0134] Optionally, by sequentially traversing each node in the node set, and based on the comparison results of the currently traversed node in the tree data of the local table file and the comparison results of the tree data of the remote table file, the updated fusion state of each node in the tree data of the local table file and the updated fusion state of each node in the tree data of the remote table file are generated.

[0135] The following is the specific method for generating the fusion state:

[0136] Figure 8 Flowchart of the document processing method provided in the embodiments of this application Figure 7 Optionally, in step S703, based on the comparison results of the currently traversed nodes in the tree data of the local table file and the comparison results in the tree data of the remote table file, generating the updated fusion state of each node in the tree data of the local table file and the updated fusion state of each node in the tree data of the remote table file may include:

[0137] S801. If the currently traversed node is empty or only one is empty in both the tree data of the local table file and the tree data of the remote table file, then it is determined that the fusion status of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is fusionable.

[0138] If the currently traversed node is empty or only one of the tree data in the local table file is empty, that is, only one of the local table file and the remote table file has modified the node or neither of them has modified it, then the fusion state of the currently traversed node in the tree data in the local table file and the tree data in the remote table file can be considered as fusionable.

[0139] This situation can also be understood as the node currently being traversed undergoing different modification operations in the local table file and the remote table file.

[0140] S802. If the currently traversed node is not empty in the tree data of the local table file or in the tree data of the remote table file, then determine whether the comparison results of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file are the same.

[0141] If the currently traversed node is not empty in either the tree data of the local table file or the tree data of the remote table file, then it can be further determined whether the comparison results of the currently traversed node in the tree data of the local table file and the tree data of the remote table file are the same.

[0142] S803. If the comparison results are the same, determine whether the comparison results of the currently traversed nodes are all modified and the node values ​​are different.

[0143] If the comparison results of the currently traversed node are the same in the tree data of the local table file and the tree data of the remote table file, it can be further determined whether the comparison results are both modified and whether the node values ​​are different.

[0144] S804. If the comparison results are both modified and the node values ​​are different, then it is determined that the fusion state of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file is conflicting.

[0145] When the comparison results are both modified and the node values ​​are different, it can be considered that the currently traversed node has undergone the same modification in both the local table file and the remote table file, but the content of the modification is different. It is also considered that the fusion state of the currently traversed node in the tree data of the local table file and the tree data of the remote table file is conflicting.

[0146] Optionally, in step S802, after determining whether the comparison results of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file are the same, the method further includes: if the comparison results are different, then it is determined that the fusion state of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file is conflict.

[0147] If the comparison results of the currently traversed node in the tree data of the local table file and the tree data of the remote table file are different, it is considered that the currently traversed node has been modified differently in the local table file and the remote table file, and there is a conflict. Therefore, it is determined that the fusion state of the currently traversed node in the tree data of the local table file and the tree data of the remote table file is a conflict.

[0148] Figure 9 Flowchart of the document processing method provided in the embodiments of this application Figure 8 Optionally, in step S104, updating the fusion status of nodes in the tree data of the local table file based on the comparison results of each node in the tree data of the remote table file may include:

[0149] S901. If the comparison result of the target node in the tree data of the remote table file is "added", then a subtree with the target node as the root node is added in the tree data of the local table file, and the fusion status of the target node and all nodes in the subtree is updated to "to be added"; wherein, the target node indicates a node whose fusion status is "can be fused".

[0150] Based on the above fusion status determination, this embodiment can also update the fusion status of nodes in the local table file's tree data by writing the node data in the remote table file's tree data that has a fusion status of "can be fused" into the local table file's tree data. This can be divided into three cases:

[0151] The first approach: If the comparison result of a node in the tree data of the remote table file indicates it's an addition, then a subtree rooted at that node is added to the corresponding position in the tree data of the local table file, and the merge status of all nodes in that subtree is set to "pending addition." If the node is a worksheet, row, or column node, then the original position attributes of nodes of the same type are updated. The original position attributes characterize the node's original position in the table file. Examples include row identifier and column identifier. Updating the original position attributes ensures that inserting or deleting rows or columns does not affect the identifiers of the original rows and columns in the table.

[0152] For example: If row 2 is inserted in the remote table file, then insert a new row 2 between row 1 and row 2 in the local table file, change the identifier of the original row 2 to the old row 2, and change the inserted row to the new row 2. This way, in subsequent modifications, modifications to row 2 can be accurately made to the old row 2, rather than being made to the new row 2.

[0153] S902. If the comparison result of the target node in the tree data of the remote table file is modified, and the target node is a cell node, then modify the value of the target node in the tree data of the local table file to be consistent with the value of the target node in the tree data of the remote table file, and update the fusion status of the target node in the tree data of the local table file to pending modification.

[0154] The second approach involves modifying the comparison result of nodes in the tree data of the remote table file: if the node is a cell node, modify the value of the corresponding node in the tree data of the local table file to be the same as that in the tree data of the remote table file, and set the merging status of the node to pending modification; if it is not a cell node, then no action is taken.

[0155] S903. If the comparison result of the target node in the tree data of the remote table file is deletion, then update the fusion status of all nodes under the subtree of the target node in the tree data of the local table file to pending deletion.

[0156] The third approach: If the comparison result of a node in the tree data of the remote table file is "delete", then the merge status of all nodes under the corresponding node's subtree in the tree data of the local table file is set to "pending deletion". If the node is a worksheet, row, or column node, then the original position attributes of nodes of the same type are updated.

[0157] Table 4 below shows a schematic diagram of the merging status of nodes in the tree data of the remote table file:

[0158] Table 4

[0159]

[0160]

[0161] The merging status of nodes in the updated tree data of the local table file obtained through the above processing is shown in Table 5 below:

[0162] Table 5

[0163] Worksheet 2 Revise / Table 2, Row 5 Revise / Table 2-Column 6 Revise conflict Table 2 - Cell (5, 6) Revise conflict Worksheet 3 Revise / Table 3 - Row 1 Revise / Table 3-Column 5 Revise / Table 3 - Cell (1, 5) Revise conflict Worksheet 5 delete / Table 5 - Row 1 delete / Table 5-Column 6 delete / Table 5 - Cell (1, 6) delete / Table 1 - Row 1 New To be added Table 1 - Cell (1, 2) New To be added Table 3 - Cell (1, 6) delete To be deleted Table 3 - Cell (1, 7) New To be added

[0164] Figure 10 Flowchart of the document processing method provided in the embodiments of this application Figure 9Optionally, in step S104, updating the local table file based on the fusion status and node type of the nodes in the updated tree data may include:

[0165] S1001. Sort the nodes in the updated tree data of the local table file according to the fusion status and node type of the nodes.

[0166] The above processing has yielded the fusion state of nodes in the updated tree data of the local table file. In this embodiment, the modified target file can be generated by generating an Excel file from the tree data.

[0167] In contrast to the process of converting an Excel file into tree-like data, the process of updating a local spreadsheet file and generating a locally modified target file is the process of converting Excel tree-like data into a new Excel file. This process includes the following steps:

[0168] 1) Read the local spreadsheet file and generate an Excel file in memory named newData that is exactly the same as the data in the local spreadsheet file.

[0169] 2) Perform a breadth-first traversal of all nodes in the updated tree data of the local table file, and sort each node according to its fusion status (priority order of pending deletion, pending addition, and pending modification) and node type (priority order of worksheet, row, column, and cell) to generate a sorting result.

[0170] S1002. Based on the sorting results, traverse each node in turn, and update the local table file according to the fusion status and node type of the currently traversed node.

[0171] 3) Based on the sorting results, traverse each node sequentially and update the local table file according to the node type and fusion status.

[0172] Optionally, in step S1002, the local table file is updated based on the fusion status and node type of the currently traversed node, including:

[0173] If the currently traversed node is a worksheet, row, or column, and its merge status is deleted, then delete the child cell at the corresponding position of the node in the local table file.

[0174] a) If the node type of the currently traversed node is worksheet, row, or column, and the merge status is deleted: Based on the original position attribute of the node, delete the corresponding worksheet, row, or column in newData, and clear the format, data validation, filtering, etc. of the corresponding position.

[0175] If the currently traversed node is a worksheet, row, or column, and the merge status is "new", then an empty worksheet, row, or column will be added at the corresponding position of the node in the local table file.

[0176] b) If the node type of the currently traversed node is worksheet, row, or column, and the merging status is "new": Based on the original position attributes of the node, add an empty worksheet, row, or column in newData, and at the same time copy the format, data validation, filtering, etc. of the corresponding position in remoteFile and write them to newData.

[0177] If the currently traversed node is a cell and its merge status is "added" or "modified", then the position of the node in the local table file is determined based on the corresponding row and column nodes, and the value of the cell in the remote table file is written into the position.

[0178] c) The node type of the currently traversed node is a cell, and the merging status is newly added or modified: Based on the two parent nodes (row node and column node) of this node, obtain the original position of the corresponding row and column, read the value, format, comments, etc. of the corresponding cell in the remote table file and write them to this position.

[0179] Optionally, after all nodes have been traversed, newData can generate a locally modified target file according to the sub-cell hierarchy of the Excel file.

[0180] Figure 11 Flowchart of the document processing method provided in the embodiments of this application Figure 10 Optionally, in step S103, after determining the fusion status of each node in the tree data of the local table file and the fusion status of each node in the tree data of the remote table file, the method further includes:

[0181] S1101. Based on the node type, fusion status, comparison result, and the pre-configured display style of the fusion status and the display style of the comparison result, convert the tree data of the local table file and the tree data of the remote table file into target formats for display. The target formats include: two-dimensional table format.

[0182] In some embodiments, a graphical interface based on the Windows platform is also implemented to display the comparison results and fusion status.

[0183] The Windows graphical interface converts the comparison and merging results of Excel files into a comparison display of multiple two-dimensional tables, which users can switch between using drop-down options.

[0184] Optionally, the display style of the fusion state and the display style of the comparison results can be preset. The display style can include display colors and display symbols. Different colors and symbols can be used to represent different comparison results and different fusion results. The comparison results and fusion results can be displayed in the form of a two-dimensional table according to the set style, which can make it easy for users to clearly view the comparison results and fusion state.

[0185] For example: Add - corresponding to yellow; Delete - corresponding to orange; Modify - corresponding to purple; Conflict - corresponding to pink; Add is represented by a plus sign; Delete is represented by a minus sign; Conflict is represented by an exclamation mark, etc. The current display style can be adaptively adjusted to effectively distinguish different comparison results and merging states.

[0186] S1102. In response to a conflict handling operation for a table input whose fusion status is conflicting, change the table information of the table whose fusion status is conflicting.

[0187] Optionally, based on the results display, users can select, jump to, and search worksheets using buttons and shortcut keys, and can also set and save file structure information and results display styles.

[0188] File modifications are performed using right-click options, primarily including three categories: using data from a remote table file, using data from a local table file, and appending to the end of the file (only usable in cases of line conflicts).

[0189] (1) Use data from the remote table file: Overwrite the node data in the tree data of the local table file with the node data in the tree data of the remote table file, and change the merging status to pending modification or pending deletion.

[0190] (2) Using data from the local table file: Change the fusion status of the corresponding node in the tree data of the local table file to no operation.

[0191] (3) Append to end of file: Add a subtree corresponding to the corresponding row at the end of the tree data in the local table file, and change the merge status to pending addition. After the user clicks save or the conflict is resolved, these modifications will be written to the tree data in the local table file in sequence.

[0192] In some embodiments, when handling conflicts, the conflict handling operation can be based on the user's input for the target table in the displayed fusion status result. The conflict handling operation can be right-clicking and selecting from the drop-down options whether to use data from the local table file or data from the remote table file as the target value of the target table.

[0193] Of course, the handling of non-conflict data is similar to the above. You can also trigger the display of drop-down options in the table to be processed and select the required data from the drop-down options for non-conflict processing.

[0194] For example: A row was deleted from the local spreadsheet file, but no changes were made to the remote spreadsheet file. There were no conflicts after merging the local and remote spreadsheet files. However, after verification, the user believes that the deletion of that row in the local spreadsheet file was accidental and needs to be restored. In this case, the user can right-click on the desired location to trigger a drop-down menu, select "Use data from the remote spreadsheet file," and add the content of the accidentally deleted row to the corresponding location.

[0195] In addition, to facilitate automated operation and cross-platform support, a cross-platform user notification process is implemented to remind users of the automatic fusion results. When running on non-Windows platforms, this solution skips the result display step and directly makes a judgment based on the conflict determination and automatic fusion results. If neither the local nor remote spreadsheet file has any nodes with a conflicting fusion status, a new Excel file is generated and automatically committed based on the automatic fusion results, completing the fusion process. Otherwise, the fusion process is aborted, the file is rolled back, all node information with a conflicting fusion status is exported as a text file, and the conflict information is sent to the user via the file's modification log in svn / git, tracing back to the corresponding user, and reminding the user to handle the conflict manually through internal company software.

[0196] In summary, the file processing method provided in this embodiment converts the table files to be processed based on the preset structure information of the table type files, generates tree data of the table files to be processed, and then performs tree comparison based on the tree data of the table files to be processed, ensuring the accuracy of the correspondence between the sub-units of different table files, thereby ensuring the accuracy of the comparison results of different table files to be processed. Based on the comparison results, the fusion and conflict determination of local table files and remote table files can be performed to determine the fusion content between local table files and remote table files, thereby realizing automatic fusion processing between local table files and remote table files and improving the accuracy of file fusion.

[0197] In addition, the provided Windows platform graphical interface displays the comparison results and fusion status according to the preset display style, allowing users to conveniently and clearly view the comparison and fusion results and handle conflicts. This reduces the workload of manually handling Excel file conflicts, improves the accuracy of Excel file conflict handling, and increases the efficiency of Excel file processing during branch development.

[0198] The following describes the apparatus, equipment, and storage medium used to execute the document processing method provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.

[0199] Figure 12 This is a schematic diagram of a file processing apparatus provided in an embodiment of this application. The functions implemented by this file processing apparatus correspond to the steps performed by the method described above. This apparatus can be understood as the aforementioned computer device, such as... Figure 12 As shown, the device may include: a generation module 120, a comparison module 121, a determination module 122, and an update module 123;

[0200] The generation module 120 is used to convert each table file to be processed according to the preset structure information of the table type file, and generate tree data of each table file to be processed. The preset structure information includes: the hierarchical relationship of the sub-units; the corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files and remote table files.

[0201] The comparison module 121 is used to compare the tree data of each table file to be processed, and obtain the comparison results of each node in the tree data of each table file to be processed. The comparison results represent the relative modifications between different table files to be processed.

[0202] The determination module 122 is used to determine the fusion status of each node in the tree data of the local table file and the fusion status of each node in the tree data of the remote table file based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file.

[0203] The update module 123 is used to update the fusion status of nodes in the tree data of the local table file based on the comparison results of each node in the tree data of the remote table file, and to update the local table file based on the fusion status and node type of the nodes in the updated tree data of the local table file.

[0204] Optionally, the sub-units include: file tables, rows, columns, and cells; the generation module 120 is specifically used to filter the sub-units to be processed in each table file according to the hierarchical relationship of each sub-unit in the table type file and the pre-configured sub-unit filtering conditions and identifier generation method, and to assign identifier information to each filtered sub-unit.

[0205] Based on the hierarchical relationship of each selected sub-unit, a tree-like data structure is constructed from top to bottom for the table file to be processed. The number of layers in the tree-like data is consistent with the number of types of sub-units, and the type of nodes contained in each layer is determined according to the hierarchical relationship of each sub-unit.

[0206] Optionally, the comparison module 121 is specifically used to compare the tree data of the local table file with the corresponding nodes in the tree data of the original table file, and generate the comparison results of each node in the tree data of the local table file. The comparison results include: addition, deletion, modification and no operation.

[0207] The tree data in the remote table file is compared with the corresponding nodes in the tree data in the original table file to generate the comparison results of each node in the tree data of the remote table file.

[0208] Optionally, the comparison module 121 is specifically used to determine that the comparison result of the corresponding node in the tree data of the original table file is deletion if the corresponding node to be compared is empty in the tree data of the local table file and not empty in the tree data of the original table file.

[0209] If the corresponding node to be compared is not empty in the tree data of the local table file, but is empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the local table file is determined to be an addition.

[0210] If the corresponding node to be compared is not empty in the tree data of the local table file and the tree data of the original table file, then recursively search the cell nodes in the child nodes of the corresponding node, and determine the comparison results of the corresponding node in the tree data of the local table file and the tree data of the original table file based on the value of the cell node.

[0211] Based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file, determine the comparison results of each node in the tree data of the local table file.

[0212] Optionally, the comparison module 121 is specifically used to determine that if the value of a cell node is inconsistent in the tree data of the local table file and the tree data of the original table file, the comparison result of the corresponding node in the tree data of the local table file and the tree data of the original table file is modified.

[0213] Optionally, the comparison module 121 is specifically used to obtain the comparison results of the nodes in the tree data of the local table file as candidate nodes for addition and modification, and the comparison results of the nodes in the tree data of the original table file as candidate nodes for deletion and modification.

[0214] Based on the comparison results of each candidate node, the comparison results of each node in the tree data of the local table file are generated.

[0215] Optionally, the determining module 122 is specifically used to determine the newly added node by comparing the corresponding node in the tree data of the local table file and the tree data of the remote table file, to complete the child nodes and comparison results of the child nodes in the tree data, and to update the comparison results of the corresponding node from newly added to modified, so as to obtain the comparison results of each node in the tree data of the local table file and the comparison results of each node in the tree data of the remote table file after the update.

[0216] Find the union of the updated nodes in the tree data of the local table file and the updated nodes in the tree data of the remote table file to obtain the node set;

[0217] Iterate through each node in the node set sequentially, and based on the comparison results of the currently traversed node in the tree data of the local table file and the comparison results of the tree data of the remote table file, generate the merge status of each node in the updated tree data of the local table file and the merge status of each node in the updated tree data of the remote table file. The merge status includes: no operation, mergeable, conflict, pending addition, pending deletion, and pending modification.

[0218] Optionally, the determining module 122 is specifically used to determine that if the currently traversed node is empty in both the tree data of the local table file and the tree data of the remote table file, or only one of them is empty, then the fusion status of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is fusionable.

[0219] If the currently traversed node is not empty in the tree data of the local table file and the tree data of the remote table file, then determine whether the comparison results of the currently traversed node in the tree data of the local table file and the tree data of the remote table file are the same.

[0220] If the comparison results are the same, then determine whether the comparison results of the currently traversed nodes are all modified and the node values ​​are different.

[0221] If the comparison results are both modified and the node values ​​are different, then it is determined that the fusion state of the currently traversed node in the tree data of the local table file and the tree data of the remote table file is conflicting.

[0222] Optionally, module 122 is specifically used to determine that if the comparison results are different, the fusion state of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file is conflicting.

[0223] Optionally, the update module 123 is specifically used to add a subtree with the target node as the root node in the tree data of the local table file if the comparison result of the target node in the tree data of the remote table file is a new addition, and update the fusion status of the target node and all nodes of the subtree to be added; wherein, the target node indicates a node whose fusion status is fusionable.

[0224] If the comparison result of the target node in the tree data of the remote table file is modified, and the target node is a cell node, then modify the value of the target node in the tree data of the local table file to be consistent with the value of the target node in the tree data of the remote table file, and update the fusion status of the target node in the tree data of the local table file to pending modification.

[0225] If the comparison result of the target node in the tree data of the remote table file is deletion, then the fusion status of all nodes under the subtree of the target node in the tree data of the local table file will be updated to pending deletion.

[0226] Optionally, the update module 123 is specifically used to sort each node in the updated tree data of the local table file according to the fusion status and node type of the nodes in the updated tree data of the local table file.

[0227] Based on the sorting results, each node is traversed sequentially, and the local table file is updated according to the fusion status and node type of the currently traversed node.

[0228] Optionally, update module 123 is specifically used to delete the child cell at the corresponding position of the node in the local table file if the currently traversed node is a worksheet, row or column and the merging status is deleted;

[0229] If the currently traversed node is a worksheet, row, or column, and the merge status is "new", then an empty worksheet, row, or column will be added at the corresponding position of the node in the local table file.

[0230] If the currently traversed node is a cell and its merge status is "added" or "modified", then the position of the node in the local table file is determined based on the corresponding row and column nodes, and the value of the cell in the remote table file is written into the position.

[0231] Optionally, the device may also include: a display module and a conflict resolution module;

[0232] The display module is used to convert the tree data of the local table file and the tree data of the remote table file into target formats for display based on the node type, fusion status, comparison result, and the pre-configured display styles of the fusion status and comparison result. The target formats include: two-dimensional table format.

[0233] The conflict handling module is used to change the table information of the table with a conflicting fusion status in response to a conflict handling operation for table inputs with a conflicting fusion status.

[0234] The above-described apparatus is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effects are similar, so they will not be described again here.

[0235] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0236] The modules described above can be connected or communicate with each other via wired or wireless connections. Wired connections can include metal cables, optical fibers, hybrid cables, or any combination thereof. Wireless connections can include connections via LAN, WAN, Bluetooth, ZigBee, or NFC, or any combination thereof. Two or more modules can be combined into a single module, and any module can be divided into two or more units. Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here.

[0237] Figure 13 A schematic diagram of an electronic device provided in this application embodiment includes: a processor 801, a storage medium 802, and a bus 803. The storage medium 802 stores machine-readable instructions executable by the processor 801. When the electronic device runs a file processing method as described in the embodiment, the processor 801 communicates with the storage medium 802 via the bus 803. The processor 801 executes the machine-readable instructions to perform the following steps:

[0238] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following: Based on the preset structure information of the table-type file, it converts each table file to be processed to generate tree data for each table file to be processed. The preset structure information includes: the hierarchical relationship of sub-units; corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files, and remote table files; it compares the tree data of each table file to be processed to obtain the comparison results of each node in the tree data of each table file to be processed, the comparison results representing the relative modifications between different table files to be processed; based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file, it determines the fusion state of each node in the tree data of the local table file and the fusion state of each node in the tree data of the remote table file; based on the comparison results of each node in the tree data of the remote table file, it updates the fusion state of the nodes in the tree data of the local table file, and updates the local table file based on the fusion state and node type of the nodes in the updated tree data of the local table file.

[0239] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following: based on the hierarchical relationship of each sub-unit in the table-type file and the pre-configured sub-unit filtering conditions and identifier generation method, it filters the sub-units to be processed in each table file to be processed, and assigns identifier information to each filtered sub-unit; based on the hierarchical relationship of each filtered sub-unit, it constructs a tree-like data structure of the table file to be processed from top to bottom, wherein the number of layers in the tree-like data is consistent with the number of types of sub-units, and the type of nodes contained in each layer is determined according to the hierarchical relationship of each sub-unit.

[0240] In a feasible implementation, when executing the file processing method, the processor 801 is specifically used to: compare the tree data of the local table file with the corresponding nodes in the tree data of the original table file, and generate the comparison results of each node in the tree data of the local table file, including: addition, deletion, modification and no operation; compare the tree data of the remote table file with the corresponding nodes in the tree data of the original table file, and generate the comparison results of each node in the tree data of the remote table file.

[0241] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following steps: if the corresponding node to be compared is empty in the tree data of the local table file but not empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the original table file is determined to be deletion; if the corresponding node to be compared is not empty in the tree data of the local table file but not empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the local table file is determined to be addition; if the corresponding node to be compared is not empty in either the tree data of the local table file or the tree data of the original table file, then the cell nodes in the child nodes of the corresponding node are recursively searched, and the comparison results of the corresponding node in the tree data of the local table file and the tree data of the original table file are determined based on the values ​​of the cell nodes; and the comparison results of each node in the tree data of the local table file are determined based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file.

[0242] In one feasible implementation, when executing the file processing method, the processor 801 is specifically used to: if the value of a cell node is inconsistent in the tree data of the local table file and in the tree data of the original table file, determine that the comparison result of the corresponding node in the tree data of the local table file and in the tree data of the original table file is modified.

[0243] In a feasible implementation, when executing the file processing method, the processor 801 is specifically used to: obtain candidate nodes for addition and modification based on the comparison results of nodes in the tree data of the local table file and candidate nodes for deletion and modification based on the comparison results of nodes in the tree data of the original table file; and generate the comparison results of each node in the tree data of the local table file based on the comparison results of each candidate node.

[0244] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following: For nodes in the tree data of the local table file and the tree data of the remote table file that are compared to newly added nodes, the processor completes the child nodes and comparison results of the child nodes in the tree data, and updates the comparison results of the corresponding nodes from newly added to modified, thereby obtaining the updated comparison results of each node in the tree data of the local table file and the updated comparison results of each node in the tree data of the remote table file; The processor calculates the union of the updated nodes in the tree data of the local table file and the updated nodes in the tree data of the remote table file to obtain a node set; The processor sequentially traverses each node in the node set, and based on the comparison results of the currently traversed node in the tree data of the local table file and the comparison results of the currently traversed node in the tree data of the remote table file, generates the fusion state of the updated nodes in the tree data of the local table file and the fusion state of the updated nodes in the tree data of the remote table file. The fusion states include: no operation, fusionable, conflict, pending addition, pending deletion, and pending modification.

[0245] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following: if the currently traversed node is empty or only one is empty in both the tree data of the local table file and the tree data of the remote table file, then it is determined that the fusion state of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is fusionable; if the currently traversed node is not empty in both the tree data of the local table file and the tree data of the remote table file, then it is determined whether the comparison results of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file are the same; if the comparison results are the same, then it is determined whether the comparison results of the currently traversed node are both modified and the node values ​​are different; if the comparison results are both modified and the node values ​​are different, then it is determined that the fusion state of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is conflicted.

[0246] In a feasible implementation, when executing the file processing method, the processor 801 is specifically used to: if the comparison results are different, determine that the fusion state of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file is conflicting.

[0247] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following: if the comparison result of the target node in the tree data of the remote table file is "add", then a subtree with the target node as the root node is added to the tree data of the local table file, and the fusion status of the target node and all nodes in the subtree is updated to "to be added"; wherein, the target node indicates a node whose fusion status is "to be fused"; if the comparison result of the target node in the tree data of the remote table file is "modify", and the target node is a cell node, then the value of the target node in the tree data of the local table file is modified to be consistent with the value of the target node in the tree data of the remote table file, and the fusion status of the target node in the tree data of the local table file is updated to "to be modified"; if the comparison result of the target node in the tree data of the remote table file is "delete", then the fusion status of all nodes under the subtree of the target node in the tree data of the local table file is updated to "to be deleted".

[0248] In a feasible implementation, when executing the file processing method, the processor 801 is specifically used to: sort each node in the updated tree data of the local table file according to the fusion status and node type of the nodes; according to the sorting result, traverse each node in turn, and update the local table file according to the fusion status and node type of the currently traversed node.

[0249] In a feasible implementation, when executing the file processing method, the processor 801 specifically performs the following: if the currently traversed node is a worksheet, row, or column, and the fusion status is deletion, then delete the child cell at the corresponding position of the node in the local table file; if the currently traversed node is a worksheet, row, or column, and the fusion status is addition, then add an empty worksheet, row, or column at the corresponding position of the node in the local table file; if the currently traversed node is a cell, and the fusion status is addition or modification, then determine the position of the node in the local table file based on the corresponding row node and column node, and write the value of the cell in the remote table file into the position.

[0250] In one feasible implementation, when executing the file processing method, the processor 801 is specifically used to: convert the tree data of the local table file and the tree data of the remote table file into target forms for display according to the node type, fusion status, comparison result, and pre-configured display styles of the fusion status and the comparison result; the target forms include: two-dimensional table forms; and in response to a conflict handling operation for a table input with a conflicting fusion status, modify the table information of the table with a conflicting fusion status.

[0251] The storage medium 802 stores program code, which, when executed by the processor 801, causes the processor 801 to perform various steps in the file processing methods according to various exemplary embodiments of this application as described in the "Exemplary Methods" section above.

[0252] The processor 801 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0253] Storage medium 802, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory is any other medium capable of carrying or storing desired program code having an instruction or data structure form and accessible by a computer, but is not limited thereto. Storage medium 802 in this embodiment can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0254] Optionally, embodiments of this application also provide a computer-readable storage medium storing a computer program, which is executed by a processor, and the processor performs the following steps:

[0255] In a feasible implementation, when executing the file processing method, the processor specifically performs the following steps: Based on the preset structure information of the table-type file, it converts each table file to be processed, generating tree-like data for each table file. The preset structure information includes: the hierarchical relationship of sub-units; corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files, and remote table files; it compares the tree-like data of each table file to be processed, obtaining the comparison results of each node in the tree-like data of each table file to be processed, the comparison results representing the relative modifications between different table files to be processed; based on the comparison results of each node in the tree-like data of the local table file and the comparison results of each node in the corresponding tree-like data of the remote table file, it determines the fusion state of each node in the tree-like data of the local table file and the fusion state of each node in the tree-like data of the remote table file; based on the comparison results of each node in the tree-like data of the remote table file, it updates the fusion state of the nodes in the tree-like data of the local table file, and updates the local table file based on the fusion state and node type of the nodes in the updated tree-like data of the local table file.

[0256] In a feasible implementation, when executing the file processing method, the processor specifically performs the following: Based on the hierarchical relationship of each sub-unit in the table-type file and the pre-configured sub-unit filtering conditions and identifier generation method, it filters the sub-units to be processed in each table file and assigns identifier information to each filtered sub-unit; based on the hierarchical relationship of each filtered sub-unit, it constructs a tree-like data structure of the table file to be processed from top to bottom, wherein the number of layers in the tree-like data is consistent with the number of types of sub-units, and the type of nodes contained in each layer is determined according to the hierarchical relationship of each sub-unit.

[0257] In one feasible implementation, when the processor executes the file processing method, it is specifically used to: compare the tree data of the local table file with the corresponding nodes in the tree data of the original table file, and generate the comparison results of each node in the tree data of the local table file, including: addition, deletion, modification and no operation; compare the tree data of the remote table file with the corresponding nodes in the tree data of the original table file, and generate the comparison results of each node in the tree data of the remote table file.

[0258] In a feasible implementation, when executing the file processing method, the processor specifically performs the following steps: If the corresponding node to be compared is empty in the tree data of the local table file but not empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the original table file is determined to be deletion; if the corresponding node to be compared is not empty in the tree data of the local table file but not empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the local table file is determined to be addition; if the corresponding node to be compared is not empty in either the tree data of the local table file or the tree data of the original table file, then the processor recursively searches for cell nodes among the child nodes of the corresponding node, and determines the comparison result of the corresponding node in the tree data of the local table file and the tree data of the original table file based on the value of the cell node; and determines the comparison result of each node in the tree data of the local table file based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file.

[0259] In one feasible implementation, when the processor executes the file processing method, it specifically performs the following: if the value of a cell node is inconsistent in the tree data of the local table file and in the tree data of the original table file, it determines that the comparison result of the corresponding node in the tree data of the local table file and in the tree data of the original table file is modified.

[0260] In one feasible implementation, when the processor executes the file processing method, it is specifically used to: obtain candidate nodes for addition and modification based on the comparison results of nodes in the tree data of the local table file and candidate nodes for deletion and modification based on the comparison results of nodes in the tree data of the original table file; and generate the comparison results of each node in the tree data of the local table file based on the comparison results of each candidate node.

[0261] In a feasible implementation, when executing the file processing method, the processor specifically performs the following steps: For nodes in the tree data of the local table file and the tree data of the remote table file that are compared to identify newly added nodes, the processor completes the child nodes and comparison results of the child nodes in the tree data, and updates the comparison results of the corresponding nodes from "added" to "modified," thereby obtaining the updated comparison results of each node in the tree data of the local table file and the remote table file respectively; The processor calculates the union of the updated nodes in the tree data of the local table file and the updated nodes in the tree data of the remote table file to obtain a node set; The processor sequentially traverses each node in the node set, and based on the comparison results of the currently traversed node in the tree data of the local table file and the remote table file respectively, generates the fusion status of the updated nodes in the tree data of the local table file and the fusion status of the updated nodes in the tree data of the remote table file. The fusion status includes: no operation, fusionable, conflict, pending addition, pending deletion, and pending modification.

[0262] In a feasible implementation, when the processor executes the file processing method, it specifically performs the following: if the currently traversed node is empty or has only one empty node in both the tree data of the local table file and the tree data of the remote table file, then it determines that the fusion state of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is fusionable; if the currently traversed node is not empty in either the tree data of the local table file or the tree data of the remote table file, then it determines whether the comparison results of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file are the same; if the comparison results are the same, then it determines whether the comparison results of the currently traversed node are both modified and the node values ​​are different; if the comparison results are both modified and the node values ​​are different, then it determines that the fusion state of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is conflicted.

[0263] In one feasible implementation, when the processor executes the file processing method, it specifically determines that if the comparison results are different, the fusion state of the currently traversed node in the tree data of the local table file and in the tree data of the remote table file is conflicting.

[0264] In one feasible implementation, when executing the file processing method, the processor specifically performs the following: if the comparison result of the target node in the tree data of the remote table file is "add", then a subtree with the target node as the root node is added to the tree data of the local table file, and the fusion status of the target node and all nodes in the subtree is updated to "to be added"; wherein, the target node indicates a node whose fusion status is "to be fused"; if the comparison result of the target node in the tree data of the remote table file is "modify", and the target node is a cell node, then the value of the target node in the tree data of the local table file is modified to be consistent with the value of the target node in the tree data of the remote table file, and the fusion status of the target node in the tree data of the local table file is updated to "to be modified"; if the comparison result of the target node in the tree data of the remote table file is "delete", then the fusion status of all nodes under the subtree of the target node in the tree data of the local table file is updated to "to be deleted".

[0265] In one feasible implementation, when the processor executes the file processing method, it specifically performs the following: sorting each node in the updated tree data of the local table file according to the fusion state and node type of the nodes; traversing each node sequentially according to the sorting result, and updating the local table file according to the fusion state and node type of the currently traversed node.

[0266] In a feasible implementation, when the processor executes the file processing method, it specifically performs the following: if the currently traversed node is a worksheet, row, or column, and the merge status is "delete," then delete the child cell at the corresponding position of the node in the local table file; if the currently traversed node is a worksheet, row, or column, and the merge status is "add," then add an empty worksheet, row, or column at the corresponding position of the node in the local table file; if the currently traversed node is a cell, and the merge status is "add" or "modify," then determine the position of the node in the local table file based on the corresponding row and column nodes, and write the value of the cell in the remote table file into the position.

[0267] In one feasible implementation, when executing the file processing method, the processor specifically performs the following: based on the node type, fusion status, comparison result, and pre-configured display styles for the fusion status and comparison result, converts the tree data of the local table file and the tree data of the remote table file into target formats for display, including two-dimensional table formats; and in response to a conflict handling operation for table inputs with conflicting fusion status, modifies the table information of the tables with conflicting fusion status.

[0268] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.

[0269] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0270] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0271] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0272] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A file processing method, characterized in that, include: Based on the preset structure information of the table type files, each table file to be processed is converted to generate tree-like data of each table file to be processed. The preset structure information includes: the hierarchical relationship of sub-units; corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files, and remote table files. The tree data of each table file to be processed is compared to obtain the comparison results of each node in the tree data of each table file to be processed. The comparison results represent the relative modifications between different table files to be processed. Based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file, the fusion status of each node in the tree data of the local table file and the fusion status of each node in the tree data of the remote table file are determined. Based on the comparison results of each node in the tree data of the remote table file, the fusion status of each node in the tree data of the local table file is updated, and the local table file is updated based on the fusion status and node type of each node in the updated tree data of the local table file.

2. The method according to claim 1, characterized in that, The sub-unit includes: file table, row, column, and cell; the process of converting each table file to be processed according to the preset structure information of the table type file to generate tree-like data of each table file to be processed includes: Based on the hierarchical relationship of each sub-unit in the table-type file and the pre-configured sub-unit filtering conditions and identifier generation method, the sub-units to be processed in each table file are filtered, and identifier information is assigned to each filtered sub-unit. Based on the hierarchical relationship of each selected sub-unit, a tree-like data structure is constructed from top to bottom for the table file to be processed. The number of layers in the tree-like data is consistent with the number of types of sub-units, and the type of nodes in each layer is determined according to the hierarchical relationship of each sub-unit.

3. The method according to claim 1, characterized in that, The tree-structured data of each table file to be processed is compared to obtain the comparison results of each node in the tree-structured data of each table file, including: The tree data of the local table file is compared with the corresponding nodes in the tree data of the original table file to generate the comparison results of each node in the tree data of the local table file. The comparison results include: addition, deletion, modification and no operation. The tree data of the remote table file is compared with the corresponding nodes in the tree data of the original table file to generate the comparison results of each node in the tree data of the remote table file.

4. The method according to claim 3, characterized in that, The step of comparing the tree data of the local table file with the corresponding nodes in the tree data of the original table file to generate the comparison results of each node in the tree data of the local table file includes: If the corresponding node to be compared is empty in the tree data of the local table file and not empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the original table file is determined to be deletion. If the corresponding node to be compared is not empty in the tree data of the local table file and is empty in the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the local table file is determined to be an addition. If the corresponding node to be compared is not empty in the tree data of the local table file and the tree data of the original table file, then recursively search the cell nodes in the child nodes of the corresponding node, and determine the comparison results of the corresponding node in the tree data of the local table file and the tree data of the original table file based on the value of the cell node. Based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file, the comparison results of each node in the tree data of the local table file are determined.

5. The method according to claim 4, characterized in that, The step of determining the comparison results of the corresponding node in the tree data of the local table file and in the tree data of the original table file based on the value of the cell node includes: If the value of the cell node is inconsistent in the tree data of the local table file and the tree data of the original table file, then the comparison result of the corresponding node in the tree data of the local table file and the tree data of the original table file is determined to be modified.

6. The method according to claim 4, characterized in that, The step of determining the comparison results of each node in the tree data of the local table file based on the comparison results of each node in the tree data of the original table file and the comparison results of each node in the tree data of the local table file includes: The comparison results of nodes in the tree data of the local table file are used to identify candidate nodes for addition and modification, and the comparison results of nodes in the tree data of the original table file are used to identify candidate nodes for deletion and modification. Based on the comparison results of each candidate node, the comparison results of each node in the tree data of the local table file are generated.

7. The method according to claim 1, characterized in that, Based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the corresponding tree data of the remote table file, the fusion state of each node in the tree data of the local table file and the fusion state of each node in the tree data of the remote table file are determined, including: The comparison result of the corresponding node in the tree data of the local table file and the tree data of the remote table file is the newly added node. The child nodes of the corresponding node and the comparison result of the child nodes are completed in the tree data. The comparison result of the corresponding node is updated from "added" to "modified". The updated comparison results of each node in the tree data of the local table file and the updated comparison results of each node in the tree data of the remote table file are obtained respectively. The node set is obtained by taking the union of each updated node in the tree data of the local table file and each updated node in the tree data of the remote table file. The system iterates through each node in the node set sequentially, and generates the updated fusion status of each node in the local table file and the remote table file based on the comparison results of the currently traversed node in the tree data of the local table file and the comparison results of the tree data of the remote table file. The fusion status includes: no operation, fusionable, conflict, pending addition, pending deletion, and pending modification.

8. The method according to claim 7, characterized in that, The step of generating the updated fusion state of each node in the local table file's tree data and the updated fusion state of each node in the remote table file based on the comparison results of the currently traversed node in the tree data of the local table file and the comparison results in the tree data of the remote table file includes: If the currently traversed node is empty or only one is empty in both the tree data of the local table file and the tree data of the remote table file, then the fusion status of the currently traversed node in both the tree data of the local table file and the tree data of the remote table file is determined to be fusionable. If the currently traversed node is not empty in the tree data of the local table file and the tree data of the remote table file, then determine whether the comparison results of the currently traversed node in the tree data of the local table file and the tree data of the remote table file are the same. If the comparison results are the same, then determine whether the comparison results of the currently traversed nodes are all modified and the node values ​​are different. If the comparison results are both modified and the node values ​​are different, then it is determined that the fusion state of the currently traversed node in the tree data of the local table file and the tree data of the remote table file is conflicting.

9. The method according to claim 8, characterized in that, After determining whether the comparison results of the currently traversed node in the tree data of the local table file and the tree data of the remote table file are the same, the method further includes: If the comparison results are different, it is determined that the fusion state of the currently traversed node in the tree data of the local table file and the tree data of the remote table file is conflicting.

10. The method according to any one of claims 7-9, characterized in that, The step of updating the fusion state of each node in the tree data of the local table file based on the comparison results of each node in the tree data of the remote table file includes: If the comparison result of the target node in the tree data of the remote table file is "new", then a subtree with the target node as the root node is added to the tree data of the local table file, and the fusion status of the target node and all nodes of the subtree is updated to "to be added"; wherein, the target node indicates a node whose fusion status is "can be fused". If the comparison result of the target node in the tree data of the remote table file is modified, and the target node is a cell node, then the value of the target node in the tree data of the local table file is modified to be consistent with the value of the target node in the tree data of the remote table file, and the fusion status of the target node in the tree data of the local table file is updated to pending modification. If the comparison result of the target node in the tree data of the remote table file is deletion, then the fusion status of all nodes under the subtree of the target node in the tree data of the local table file is updated to pending deletion.

11. The method according to claim 1, characterized in that, The step of updating the local table file based on the fusion status and node type of each node in the updated tree data includes: The nodes in the updated tree data of the local table file are sorted according to their fusion status and node type. Based on the sorting results, each node is traversed sequentially, and the local table file is updated according to the fusion status and node type of the currently traversed node.

12. The method according to claim 11, characterized in that, The step of updating the local table file based on the fusion status and node type of the currently traversed nodes includes: If the currently traversed node is a worksheet, row, or column, and the merge status is deleted, then delete the sub-cell at the corresponding position of the node in the local table file. If the currently traversed node is a worksheet, row, or column, and the merge status is "new", then an empty worksheet, row, or column will be added at the corresponding position of the node in the local table file. If the currently traversed node is a cell and its merge status is "added" or "modified", then the position of the node in the local table file is determined according to the row node and column node corresponding to the node, and the value of the cell in the remote table file is written into the position.

13. The method according to claim 1, characterized in that, After determining the fusion state of each node in the tree data of the local table file and the fusion state of each node in the tree data of the remote table file, the method further includes: Based on the node type, fusion status, comparison result, and pre-configured display styles for fusion status and comparison result, the tree data of the local table file and the tree data of the remote table file are converted into target formats for display. The target formats include: two-dimensional table formats. In response to a conflict handling operation for a form input whose fusion status is conflicted, the form information of the form whose fusion status is conflicted is changed.

14. A document processing device, characterized in that, include: Generate module, compare module, determine module, update module; The generation module is used to convert each table file to be processed according to the preset structure information of the table type file, and generate tree data of each table file to be processed. The preset structure information includes: the hierarchical relationship of sub-units; corresponding sub-units in different table files to be processed have the same identification information; the table files to be processed include: original table files, local table files and remote table files. The comparison module is used to compare the tree data of each table file to be processed, and obtain the comparison results of each node in the tree data of each table file to be processed. The comparison results represent the relative modifications between different table files to be processed. The determining module is used to determine the fusion state of each node in the tree data of the local table file and the fusion state of each node in the tree data of the remote table file based on the comparison results of each node in the tree data of the local table file and the comparison results of each node in the tree data of the remote table file. The update module is used to update the fusion status of each node in the tree data of the local table file according to the comparison results of each node in the tree data of the remote table file, and to update the local table file according to the fusion status and node type of each node in the updated tree data of the local table file.

15. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to implement the file processing method as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is executed by a processor to implement the file processing method as described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Apparatus and method for merging business data

    CN101232538A

  • Configuration data synchronization method, storage medium and related equipment

    CN113783734A