Table data processing method and device, equipment and storage medium
By obtaining and processing the file data and node data of the original file, the online editable table file is created, which solves the inefficiency and error-prone problems of traditional table document editing methods, and achieves efficient and accurate table data management and collaborative sharing.
Patent Information
- Application Number
- CN202410793445.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-10-15
AI Technical Summary
The traditional table document editing method is inefficient and error-prone. It cannot meet the needs of modern laboratories for efficient, accurate, and standardized data processing and report generation. It is especially inconvenient in data collaboration, sharing and long-term storage.
By obtaining the original file, generating file data and node data, determining cell data and merging cell data, an online editable table file is created to achieve efficient management and collaborative sharing.
It improves the efficiency and accuracy of table data processing, meets the needs of modern laboratories for data processing and report generation, and facilitates collaborative sharing and long-term storage of data.
Smart Images

Figure CN118780253A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of file processing technology, and in particular to a table data processing method, device, equipment and storage medium. Background Art
[0002] In the rapidly developing scientific research field, traditional spreadsheet document editing methods have gradually become inadequate and unable to meet the efficiency requirements of modern laboratories for data processing and report generation. With the increasing number and complexity of scientific research projects, the amount of data that laboratories need to process has increased dramatically, placing higher requirements on the speed, accuracy and standardization of data processing.
[0003] Traditional table document editing methods usually use local office software such as Word or Excel to edit and manage table data in reports. This is inefficient and error-prone, and cannot meet the needs of modern laboratories for efficient, accurate, and standardized data processing and report generation. It also has many inconveniences in data collaboration, sharing, and long-term preservation. Summary of the invention
[0004] The purpose of this application is to provide a table data processing method, device, equipment and storage medium to address the deficiencies in the above-mentioned prior art, so as to solve the problem that the traditional table document editing method in the prior art is inefficient and prone to errors.
[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0006] In a first aspect, an embodiment of the present application provides a table data processing method, the method comprising:
[0007] Obtaining an original file, wherein the original file is a file including a table;
[0008] Generate file data and node data corresponding to the original file according to the original file, wherein the file data and the node data are both used to represent the format and content of the original file, and the representation form of the file data is different from the representation form of the node data;
[0009] Determine, according to the file data, first data corresponding to the original file, where the first data is used to indicate single cell data in the original file;
[0010] Determine, according to the node data, second data corresponding to the original file, where the second data is used to indicate whether a cell in a table of the original file is a merged cell;
[0011] An online table is created based on the first data and the second data to obtain an online editable table file.
[0012] In a possible implementation, generating file data and node data corresponding to the original file according to the original file includes:
[0013] Convert the original file to a target version.
[0014] Use a preset function library to parse the original file of the target version to obtain the format and content of the original file;
[0015] Generate the file data according to the format and content of the original file;
[0016] A document object model tree is generated according to the format and content of the original file, and the document object model tree is used as node data of the original file.
[0017] In a possible implementation manner, determining, according to the file data, the first data corresponding to the original file includes:
[0018] Determine at least one table array in the original file according to the data type of each data in the file data;
[0019] Recursively search and convert each of the table arrays to obtain the first data corresponding to the original file.
[0020] In a possible implementation, recursively searching and converting each of the table arrays to obtain the first data corresponding to the original file includes:
[0021] All elements in the table array are traversed, and for the current element traversed, the current element is recursively searched and converted to obtain the first data corresponding to the current element.
[0022] In a possible implementation manner, determining, according to the node data, the second data corresponding to the original file includes:
[0023] The node data is converted into target format data, and the target format data is parsed by a preset function to obtain second data corresponding to the original file.
[0024] In a possible implementation manner, creating an online form according to the first data and the second data includes:
[0025] A preset plug-in is called to create an online form according to the first data and the second data.
[0026] In a possible implementation, the method further includes:
[0027] Creating a target configuration file and a target content file according to the online editable table file;
[0028] A local table file is exported according to the target configuration file and the target content file.
[0029] In a second aspect, another embodiment of the present application provides a table data processing device, the device comprising:
[0030] An acquisition module, used for acquiring an original file, wherein the original file is a file including a table;
[0031] A generating module, used for generating file data and node data corresponding to the original file according to the original file, wherein the file data and the node data are both used for representing the format and content of the original file, and the representation form of the file data is different from the representation form of the node data;
[0032] A determination module, used to determine first data corresponding to the original file according to the file data, where the first data is used to indicate single cell data in the original file;
[0033] A determination module, used to determine second data corresponding to the original file according to the node data, wherein the second data is used to indicate whether a cell in a table of the original file is a merged cell;
[0034] A creation module is used to create an online table according to the first data and the second data to obtain an online editable table file.
[0035] In a possible implementation, the generating module is specifically used to:
[0036] Convert the original file to a target version.
[0037] Use a preset function library to parse the original file of the target version to obtain the format and content of the original file;
[0038] Generate the file data according to the format and content of the original file;
[0039] A document object model tree is generated according to the format and content of the original file, and the document object model tree is used as node data of the original file.
[0040] In a possible implementation, the determining module is specifically configured to:
[0041] Determine at least one table array in the original file according to the data type of each data in the file data;
[0042] Recursively search and convert each of the table arrays to obtain the first data corresponding to the original file.
[0043] In a possible implementation, the determining module is specifically configured to:
[0044] All elements in the table array are traversed, and for a current element traversed, the current element is recursively searched and converted to obtain first data corresponding to the current element.
[0045] In a possible implementation, the determining module is specifically configured to:
[0046] The node data is converted into target format data, and the target format data is parsed by a preset function to obtain second data corresponding to the original file.
[0047] In a possible implementation, the creation module is specifically used to:
[0048] A preset plug-in is called to create an online form according to the first data and the second data.
[0049] In a possible implementation, the device further includes: an export module;
[0050] The export module is used to create a target configuration file and a target content file according to the online editable table file;
[0051] The export module is used to export a local table file according to the target configuration file and the target content file.
[0052] In the third aspect, another embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.
[0053] In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.
[0054] The beneficial effects of the present application are: by obtaining the original file; and generating file data and node data corresponding to the original file according to the original file; thereby being able to determine the first data indicating a single cell in the original file corresponding to the original file according to the file data; and determining the second data indicating whether the cells in the table of the original file can be merged according to the node data; and further creating an online table according to the first data and the second data to obtain an online editable table file. It is able to efficiently and accurately manage table data, meet the needs of modern laboratories for table data processing and generation, and facilitate collaborative sharing and long-term preservation of table data. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 A flowchart of a table data processing method provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram of a process flow when the table data processing method provided in an embodiment of the present application generates file data and node data corresponding to an original file;
[0058] Figure 3 A schematic diagram of a flow chart for determining first data corresponding to an original file in the table data processing method provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram of a flow chart for exporting a local table file in the table data processing method provided in an embodiment of the present application;
[0060] Figure 5 A schematic diagram of a table data processing device provided in an embodiment of the present application;
[0061] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0063] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0064] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0065] Traditional table document editing methods usually use local office software such as Word or Excel to edit and manage table data in reports. This is inefficient and error-prone, and cannot meet the needs of modern laboratories for efficient, accurate, and standardized data processing and report generation. It also has many inconveniences in data collaboration, sharing, and long-term preservation.
[0066] Based on the above problems, the embodiment of the present application proposes a table data processing method, which obtains the original file; and generates file data and node data corresponding to the original file according to the original file; thereby determining the first data indicating a single cell in the original file corresponding to the original file according to the file data; and determining the second data indicating whether the cell in the table of the original file is a merged cell according to the node data; further creating an online table according to the first data and the second data to obtain an online editable table file. It is able to efficiently and accurately manage table data, meet the needs of modern laboratories for table data processing and generation, and facilitate collaborative sharing and long-term preservation of table data.
[0067] It is understood that the table data processing method provided in the embodiment of the present application can be deployed in a specific software system, such as a laboratory report software system, which is deployed in an electronic device and provides a graphical user interface to the user so that the user can obtain the processing results of the table data. Exemplarily, the laboratory report software system can be deployed in a browser of an electronic device.
[0068] The table data processing method provided in the embodiments of the present application is described in detail below in combination with multiple embodiments.
[0069] Figure 1 A flow chart of a table data processing method provided in an embodiment of the present application, referring to Figure 1 As shown, the execution subject of the method is any electronic device with processing capability, and illustratively, it can be a laboratory report software system deployed in a browser of the electronic device. The method includes:
[0070] S101. Obtain an original file, where the original file is a file including a table.
[0071] It can be understood that when the table data processing method provided in the embodiment of the present application is executed, the original file needs to be obtained first, wherein the original file may be a file including contents such as tables, texts, and pictures.
[0072] Exemplarily, the electronic device may provide a user with a graphical user interface, so that the user can upload the original file to the laboratory report software system in the browser of the electronic device by dragging and dropping, so that the electronic device can obtain the original file.
[0073] S102: Generate file data and node data corresponding to the original file according to the original file. Both the file data and the node data are used to represent the format and content of the original file, and the representation form of the file data is different from the representation form of the node data.
[0074] Optionally, after obtaining the original file, the electronic device may parse the original file to generate file data and node data corresponding to the original file.
[0075] Among them, both file data and node data are used to represent the format and content of the original file, and the representation form of file data is different from that of node data, that is, file data and node data represent the format and content of the original file in different forms.
[0076] The format of the original file may include: font format information of text, such as font type, size, color, bold, italic, etc.; paragraph information of text, such as alignment, indentation, line spacing, paragraph spacing, etc.; resolution information, format information, position and size information of pictures; row and column structure information, border and fill information and cell format information of tables, for example: text format in cells, such as font, size, alignment, etc. The content of the original file may include: text content, picture content and table content.
[0077] S103. Determine first data corresponding to the original file according to the file data, where the first data is used to indicate single cell data in the original file.
[0078] Optionally, after obtaining the file data, the table in the file data may be searched and processed to determine the first data corresponding to the original file, that is, the data of a single cell in the original file, wherein the data of a single cell includes the format and content data of the cell.
[0079] Exemplarily, after obtaining the file data, all data in the file data may be traversed to find the table in the original file, and processed to obtain single cell data in the original file as the first data corresponding to the original file.
[0080] S104. Determine second data corresponding to the original file according to the node data, where the second data is used to indicate whether cells in a table of the original file can be merged.
[0081] Optionally, after the node data is obtained, the node data may be processed to determine whether a cell in a table of the original file is a merged cell, as the second data corresponding to the original file.
[0082] Exemplarily, after obtaining the node data, the node data may be traversed and judged to determine whether the cells in the table of the original file are merged cells, and the obtained cell merging information may be used as the second data corresponding to the original file.
[0083] S105. Create an online table according to the first data and the second data to obtain an online editable table file.
[0084] Optionally, after obtaining the first data and the second data, the table in the original file can be determined, and on this basis, the electronic device creates an online table and processes the first data and the second data to obtain an online editable table.
[0085] Exemplarily, the laboratory report software system in the electronic device can create an online table in the user graphical interface according to the obtained first data and the second data, thereby obtaining an online editable table file.
[0086] In this embodiment, by obtaining the original file, and generating file data and node data corresponding to the original file according to the original file, the first data indicating a single cell in the original file corresponding to the original file can be determined according to the file data, and the second data indicating whether the cells in the table of the original file can be merged corresponding to the original file can be determined according to the node data; further, an online table is created according to the first data and the second data to obtain an online editable table file. The table data can be managed efficiently and accurately, meeting the needs of modern laboratories for table data processing and generation, and facilitating collaborative sharing and long-term preservation of table data.
[0087] Figure 2 A flow chart showing a method for processing table data provided in an embodiment of the present application for generating file data and node data corresponding to an original file.
[0088] In one possible implementation, referring to Figure 2 As shown, in the above step S102, when generating file data and node data corresponding to the original file according to the original file, it includes:
[0089] S201, converting the format of the original file to obtain the target version of the original file.
[0090] Optionally, the original file may be converted into a target version of the original file based on Apache POI (Poor Obfuscation Implementation), wherein the target version of the original file may be in .docx format or .xlsx format.
[0091] Exemplarily, the dependency of Apache POI can be introduced, and HWPFDocument can be used to read the original file in .doc or .xls format, and the read original file can be written into XWPFDocument, and the file can be written into FileOutputStream and returned to the browser. The original file can be converted into a format based on Apache POI, and the original file in .doc or .xls format can be converted into an original file in .docx format or .xlsx format.
[0092] S202: Use a preset function library to parse the original file of the target version to obtain the format and content of the original file.
[0093] Optionally, use the function in the docxjs library to parse the original file of the target version to obtain the format and content of the original file.
[0094] The format of the original file may include: font format information of text, such as font type, size, color, bold, italic, etc.; paragraph information of text, such as alignment, indentation, line spacing, paragraph spacing, etc.; resolution information, format information, position and size information of pictures; row and column structure information, border and fill information and cell format information of tables, for example: text format in cells, such as font, size, alignment, etc. The content of the original file may include: text content, picture content and table content.
[0095] S203: Generate file data according to the format and content of the original file.
[0096] Optionally, after obtaining the format and content of the original file, the js file of docxjs may be introduced to generate file data.
[0097] S204: Generate a document object model tree according to the format and content of the original file, and use the document object model tree as node data of the original file.
[0098] Optionally, after obtaining the format and content of the original file, a Document Object Model (DOM) node can be generated, and a DOM tree can be generated from the DOM node according to the format and content of the original file, and the DOM tree can be rendered to the browser as the node data of the original file.
[0099] By converting the format of the original file, the original file of the target version is obtained, and the original file of the target version is parsed using a preset function library to obtain the format and content of the original file, thereby generating file data according to the format and content of the original file, and generating a DOM tree according to the format and content of the original file, and using the DOM tree as the node data of the original file, the file data and node data can be obtained efficiently and accurately.
[0100] Figure 3 A schematic diagram of a flow chart for determining first data corresponding to an original file in the table data processing method provided in an embodiment of the present application.
[0101] In one possible implementation, referring to Figure 3 As shown, the above step S103, when determining the first data corresponding to the original file according to the file data, includes:
[0102] S301. Determine at least one table array in the original file according to the data type of each data in the file data.
[0103] Optionally, after obtaining the file data, the data type of each data in the file data can be determined, data with a table data type can be found, and each found table can be stored as a table array, wherein the table array is a two-dimensional array.
[0104] Exemplarily, the file data may be wordData.documentPart.body.children. After obtaining the file data, data of type table is retrieved therefrom to obtain at least one table array wordTableData.
[0105] S302: recursively search and convert each table array to obtain first data corresponding to the original file.
[0106] It can be understood that each table array includes all the data of all the cells in each table, and the format or content of some cells may not be a standard format or data. Therefore, a traversal method can be used to recursively search and convert each table array to convert the data in each table array into data in the target data format, thereby obtaining the first data corresponding to the original file.
[0107] Optionally, recursively search and convert each table array by traversing, and convert the data in each table array into data in the target data format to obtain the first data corresponding to the original file. The first data corresponding to the original file is used to indicate the single cell data in the original file. The data of a single cell includes the format and content data of the cell.
[0108] Exemplarily, the first data may include the total number of rows and columns in the table, row height data, column width data, cell original value, display value, background color, font, text size, text color, text bold, italic, text wrap, strikethrough, underline, vertical alignment, and horizontal alignment.
[0109] At least one table array in the original file is determined by the data type of each data in the file data, and each table array is recursively searched and converted to obtain the first data corresponding to the original file, so that the first data can be obtained efficiently and accurately.
[0110] In a possible implementation, the recursive search and conversion of each table array in the above step S302 to obtain the first data corresponding to the original file includes:
[0111] All elements in the table array are traversed, and for the current element traversed, the current element is recursively searched and converted to obtain the first data corresponding to the current element.
[0112] Optionally, the table array is traversed, and for the current element traversed, the current element is recursively searched and the searched data is converted into data in the target data format according to preset rules, and after the recursive search and conversion of the table array is completed, the first data corresponding to the original file is obtained.
[0113] Exemplarily, a table array may consist of multiple cell elements, each of which stores all the data of the current cell. These data may include the total number of table rows and columns, row height data, column width data, cell original value, display value, background color, font, text size, text color, text bold, italic, text wrap, strikethrough, underline, vertical alignment, and horizontal alignment data stored in a recursive form. When obtaining the first data corresponding to the current element, the cell elements in the table array may be traversed first to obtain all the data of the current cell element, and recursively search these data, and convert the found data into data in the target data form according to preset rules, so as to serve as the first data corresponding to the current cell element.
[0114] In a possible implementation, in the above step S104, determining the second data corresponding to the original file according to the node data includes:
[0115] The node data is converted into target format data, and the target format data is parsed through a preset function to obtain second data corresponding to the original file.
[0116] Exemplarily, the tool xlsx.utils.table_to_sheet in the xlsx.js library is used to convert the node data into excel table data to obtain the table data xlsxSheetData, and the second data corresponding to the original file is parsed from the table data xlsxSheetData, that is, the table data xlsxSheetData is parsed to determine whether the cells in the table of the original file can be merged.
[0117] In a possible implementation, when creating an online form according to the first data and the second data in the above step S105, it includes:
[0118] A preset plug-in is called to create an online form according to the first data and the second data.
[0119] Optionally, a preset LuckySheet plug-in is called to create a blank online form, and the blank online form is processed according to the first data and the second data to obtain an online editable form file.
[0120] It can be understood that after obtaining the online form, the table data processing method provided in the embodiment of the present application can also process the online form to export the online form into a local table file. The process is described below.
[0121] Figure 4 A flowchart of exporting a local table file in the table data processing method provided in an embodiment of the present application.
[0122] In one possible implementation, referring to Figure 4 As shown, the table data processing method provided in the embodiment of the present application also includes:
[0123] S401. Create a target configuration file and a target content file according to an online editable table file.
[0124] Exemplarily, the target configuration file luckysheet.getluckysheetfile() can be obtained through the Luckysheet plug-in according to the online editable table file.
[0125] Exemplarily, workbook.xlsx.writeBuffer() is used to obtain the target content file in the online editable spreadsheet file, that is, the buffer data.
[0126] S402: Export a local table file according to the target configuration file and the target content file.
[0127] For example, the excel.js library tool is used to create a workbook, and the target configuration file is parsed and assembled into the format required by excel.js for setting. The format includes the total number of rows and columns in the table, row height data, column width data, cell original value, display value, background color, font, text size, text color, text bold, italic, text wrap, strikethrough, underline, vertical alignment, and horizontal alignment.
[0128] Exemplarily, the target content file buffer is filled to obtain a table file, which is then exported to a local computer.
[0129] Based on the same inventive concept, a table data processing device corresponding to the table data processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned table data processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0130] Figure 5 A schematic diagram of a table data processing device provided in an embodiment of the present application, referring to Figure 5As shown, the device includes: an acquisition module 501, a generation module 502, and a determination module 503;
[0131] An acquisition module 501 is used to acquire an original file, where the original file is a file including a table;
[0132] A generating module 502 is used to generate file data and node data corresponding to the original file according to the original file, wherein both the file data and the node data are used to represent the format and content of the original file, and the representation form of the file data is different from the representation form of the node data;
[0133] A determination module 503, configured to determine first data corresponding to the original file according to the file data, where the first data is used to indicate single cell data in the original file;
[0134] A determination module 503, used to determine second data corresponding to the original file according to the node data, where the second data is used to indicate whether a cell in a table of the original file is a merged cell;
[0135] A creation module is used to create an online table according to the first data and the second data to obtain an online editable table file.
[0136] In a possible implementation, the generating module 502 is specifically configured to:
[0137] Convert the format of the original file to obtain the target version of the original file;
[0138] Use the preset function library to parse the original file of the target version to obtain the format and content of the original file;
[0139] Generate file data according to the format and content of the original file;
[0140] A DOM tree is generated according to the format and content of the original file, and the DOM tree is used as the node data of the original file.
[0141] In a possible implementation, the determination module 503 is specifically configured to:
[0142] Determine at least one table array in the original file according to the data type of each data in the file data;
[0143] Recursively search and convert each table array to obtain the first data corresponding to the original file.
[0144] In a possible implementation, the determination module 503 is specifically configured to:
[0145] All elements in the table array are traversed, and for the current element traversed, the current element is recursively searched and converted to obtain the first data corresponding to the current element.
[0146] In a possible implementation, the determination module 503 is specifically configured to:
[0147] The node data is converted into target format data, and the target format data is parsed through a preset function to obtain second data corresponding to the original file.
[0148] In one possible implementation, a module is created, specifically for:
[0149] A preset plug-in is called to create an online form according to the first data and the second data.
[0150] In a possible implementation, the apparatus further includes: an export module 504;
[0151] The export module 504 is used to create a target configuration file and a target content file according to the online editable table file;
[0152] The export module 504 is used to export a local table file according to the target configuration file and the target content file.
[0153] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0154] The present application embodiment also provides an electronic device 60, such as Figure 6 As shown, it is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, including: a processor 61, a memory 62, and optionally, a bus 63. The memory 62 stores machine-readable instructions executable by the processor 61 (for example, Figure 5 In the device, the execution instructions corresponding to the acquisition module 501, the generation module 502 and the determination module 503 are obtained, etc. When the electronic device 60 is running, the processor 61 communicates with the memory 62 through the bus 63, and the steps of the above-mentioned table data processing method are executed by the processor 61.
[0155] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned table data processing method are executed.
[0156] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0157] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0158] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A table data processing method, characterized in that: include: Obtaining an original file, wherein the original file is a file including a table; Generate file data and node data corresponding to the original file according to the original file, wherein the file data and the node data are both used to represent the format and content of the original file, and the representation form of the file data is different from the representation form of the node data; Determine, according to the file data, first data corresponding to the original file, where the first data is used to indicate single cell data in the original file; Determine, according to the node data, second data corresponding to the original file, where the second data is used to indicate whether a cell in a table of the original file is a merged cell; An online form is created based on the first data and the second data to obtain an online editable form file.
2. The table data processing method according to claim 1, characterized in that: The step of generating file data and node data corresponding to the original file according to the original file includes: Convert the original file to a target version. Use a preset function library to parse the original file of the target version to obtain the format and content of the original file; Generate the file data according to the format and content of the original file; A document object model tree is generated according to the format and content of the original file, and the document object model tree is used as node data of the original file.
3. The table data processing method according to claim 1, characterized in that: The determining, according to the file data, first data corresponding to the original file includes: Determine at least one table array in the original file according to the data type of each data in the file data; Recursively search and convert each of the table arrays to obtain the first data corresponding to the original file.
4. The table data processing method according to claim 3, characterized in that: The recursive searching and converting of each of the table arrays to obtain the first data corresponding to the original file includes: All elements in the table array are traversed, and for the current element traversed, the current element is recursively searched and converted to obtain the first data corresponding to the current element.
5. The table data processing method according to claim 1, characterized in that: The determining, according to the node data, second data corresponding to the original file includes: The node data is converted into target format data, and the target format data is parsed by a preset function to obtain second data corresponding to the original file.
6. The table data processing method according to claim 1, characterized in that: The step of creating an online form according to the first data and the second data includes: A preset plug-in is called to create an online form according to the first data and the second data.
7. The table data processing method according to claim 1, characterized in that: The method further comprises: Creating a target configuration file and a target content file according to the online editable table file; A local table file is exported according to the target configuration file and the target content file.
8. A table data processing device, characterized in that: include: An acquisition module, used for acquiring an original file, wherein the original file is a file including a table; A generating module, used for generating file data and node data corresponding to the original file according to the original file, wherein the file data and the node data are both used for representing the format and content of the original file, and the representation form of the file data is different from the representation form of the node data; A determination module, used to determine first data corresponding to the original file according to the file data, where the first data is used to indicate single cell data in the original file; A determination module, used to determine second data corresponding to the original file according to the node data, wherein the second data is used to indicate whether a cell in a table of the original file is a merged cell; A creation module is used to create an online table according to the first data and the second data to obtain an online editable table file.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the table data processing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the table data processing method as claimed in any one of claims 1 to 7 are executed.
Citation Information
Cited By
RAG-based table data processing method and system
CN120354833A
Rag-based table data processing method and system
CN120354833B
