Table data preview method and device, computer equipment, readable storage medium and program product
Through the introduction of target data during the preview of the form data, and the memory optimization processing, the performance bottleneck during the processing of a large amount of data in existing technologies is solved, and efficient table data export and preview are achieved.
Patent Information
- Application Number
- CN202411494202.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-01-21
AI Technical Summary
Existing multi-tab technology for exporting preview reports can easily lead to performance bottlenecks when processing large batches of data, such as memory overflow or slow response.
During the preview of the table data, first import the target data to be imported into each table object of the workbook object, generate the form preview object, and use the table data processing class to optimize the memory to the form preview object to reduce memory consumption.
Effectively overcome the performance bottleneck of the multi -tab technology of the preview report, optimize the use of memory, export suitable for large data quantities, and avoid the problem of slow memory overflow and slow response.
Smart Images

Figure CN119337846A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a table data preview method, device, computer equipment, computer-readable storage medium and computer program product. Background Art
[0002] With the development of computer technology, the export preview report multi-tab technology has emerged, which refers to the report export and preview functions implemented in desktop applications or web applications. These functions allow users to export data to Excel or other formats and view these data in different tabs. The existing export preview report multi-tab technology uses Ajax and JavaScript frameworks (such as React, Vue.js, Angular, etc.) to create more dynamic and interactive web applications, and uses libraries such as apache poi, iText, JasperReports, etc. to handle server-side report generation and export.
[0003] However, the current export preview report multi-tab technology may cause performance bottlenecks in the processing and rendering of large quantities of data. For example, when multiple tabs are opened in a browser, it is easy to cause memory overflow or slow response. Summary of the invention
[0004] Based on this, it is necessary to provide a table data preview method, device, computer equipment, computer-readable storage medium and computer program product that can overcome the technical performance bottleneck of previewing multiple tabs of reports in order to solve the above technical problems.
[0005] In a first aspect, the present application provides a table data preview method, comprising:
[0006] Perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object;
[0007] Performing table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object;
[0008] Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object;
[0009] Performing memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result;
[0010] The table data optimization result is written into the output stream to obtain the table data preview result.
[0011] In one embodiment, the method further comprises:
[0012] Perform file generation processing based on the table preview object to obtain a table export file;
[0013] When a form download request is received, the form export file is fed back.
[0014] In one embodiment, the method further comprises:
[0015] Obtaining a data query request for the table data preview result;
[0016] Performing paging query processing on the table data preview result based on the data query request to obtain a paging query result;
[0017] The paging query results are aggregated to obtain a table data query result.
[0018] In one embodiment, creating cells corresponding to the target data in the table object, and importing the target data into cells of each table object to update the workbook object to obtain a table preview object includes:
[0019] Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object to obtain a table data import result;
[0020] Performing an update process on the table data import result based on the table design style to obtain a table data update result;
[0021] The cells in the table data update result are merged to obtain a table preview object.
[0022] In one embodiment, performing memory optimization processing on the table preview object through a table data processing class to obtain a table data optimization result includes:
[0023] Importing the table preview object into the template engine, performing table generation processing through the template engine to obtain a templated table file;
[0024] The templated table file is subjected to memory optimization processing through the table data processing class to obtain a table data optimization result.
[0025] In one embodiment, writing the table data optimization result into the output stream to obtain the table data preview result includes:
[0026] Based on streaming processing, the table data optimization result is written into the output stream row by row to obtain the table data preview result.
[0027] In a second aspect, the present application further provides a table data preview device, the device comprising:
[0028] An object creation module, used for performing object creation processing based on the preview data type of the target data to be imported to obtain a workbook object;
[0029] A page tab generation module, used to perform table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object;
[0030] A data import module, used for creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object;
[0031] A memory optimization module, used for performing memory optimization processing on the table preview object through a table data processing class to obtain a table data optimization result;
[0032] The table preview module is used to write the table data optimization result into the output stream to obtain the table data preview result.
[0033] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0034] Perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object;
[0035] Performing table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object;
[0036] Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object;
[0037] Performing memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result;
[0038] The table data optimization result is written into the output stream to obtain the table data preview result.
[0039] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0040] Perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object;
[0041] Performing table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object;
[0042] Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object;
[0043] Performing memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result;
[0044] The table data optimization result is written into the output stream to obtain the table data preview result.
[0045] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0046] Perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object;
[0047] Performing table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object;
[0048] Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object;
[0049] Performing memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result;
[0050] The table data optimization result is written into the output stream to obtain the table data preview result.
[0051] The above-mentioned table data preview method, device, computer equipment, computer-readable storage medium and computer program product first perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object; perform table tab generation processing based on the workbook object to obtain multiple table objects in the workbook object; create cells corresponding to the target data in the table object, and import the target data into the cells of each table object to update the workbook object to obtain a table preview object; perform memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result; write the table data optimization result into the output stream to obtain a table data preview result. The present application generates a table preview object by first importing the target data to be imported into each table object of the workbook object during the preview process of the table data, and then performs memory optimization on the table preview object through the table data processing class, so that when a large amount of table data is exported, memory usage is optimized, and the technical performance bottleneck of preview report multi-tab is overcome, so that it is suitable for the export of reports with large amounts of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0053] FIG1 is an application environment diagram of a table data preview method in one embodiment;
[0054] FIG2 is a schematic diagram of a flow chart of a table data preview method in one embodiment;
[0055] FIG3 is a schematic diagram of a process of querying table data in one embodiment;
[0056] FIG4 is a schematic diagram of a process of importing table data in one embodiment;
[0057] FIG5 is a structural block diagram of a table data preview device in one embodiment;
[0058] FIG. 6 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] The table data preview method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. When the data operation and maintenance personnel of the terminal 102 want to process the multi-page tabs of the table data export preview report, the table data preview method of the present application can be used to perform the table data, and the data operation and maintenance personnel submit the corresponding processing request to the server 104 through the terminal 102 to formulate the table data to be processed. The server 104 performs object creation processing based on the preview data type of the target data to be imported to obtain a workbook object; performs table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object; creates a cell corresponding to the target data in the table object, and imports the target data into the cells of each table object to update the workbook object to obtain a table preview object; performs memory optimization processing on the table preview object through the table data processing class to obtain the table data optimization result; writes the table data optimization result into the output stream to obtain the table data preview result. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0061] In an exemplary embodiment, as shown in FIG. 2 , a table data preview method is provided, which is described by taking the method applied to the server 104 in FIG. 1 as an example, and includes the following steps 201 to 209 . Among them:
[0062] Step 201 : performing object creation processing based on the preview data type of the target data to be imported to obtain a workbook object.
[0063] The target data to be imported refers to the target data that needs to be imported into the table. These target data can be numerical data, text data, or image data, etc. Preview data type The table type of the table into which the target data is imported, such as xls format or xlsx format. This format will determine the type of the workbook object. The workbook object refers to an object in the form of an empty table used to import data. This object will represent the entire table file. Select HSSFWorkbook (for .xls format) or XSSFWorkbook (for .xlsx format) as needed.
[0064] Exemplarily, for the process of previewing the table data, it is necessary to first import the collected scattered target data into the table, and then perform preview processing on the table. Therefore, it is necessary to first create a workbook object representing the entire table file through object creation processing. In one embodiment, the present application implements the processing and preview of table data through Apache POI, which is a powerful Java library for processing files in Microsoft Office format, including Excel. When using Apache POI to export reports, the technology that supports multiple tabs (i.e., multiple worksheets) can effectively distribute large amounts of data to different worksheets. At this time, the type of the workbook object corresponds to the type of the previewed table data. When the table data needs to be previewed in xls format, a workbook object such as HSSFWorkbook can be created, and when the table data needs to be previewed in xlsx format, a workbook object such as XSSFWorkbook needs to be created. That is, Workbook workbook = new XSSFWorkbook().
[0065] Step 203, performing table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object.
[0066] Among them, the table tab generation process is used to generate each tab in the table, and each tab corresponds to a table object. Tabs, also known as tabs or page tags, are a functional design on the computer interface. It allows users to quickly switch between different pages or views in the same window or interface. By clicking on different tabs, users can easily navigate between multiple pages without opening multiple independent windows or switching different applications. In a table file, a table file contains multiple tab tables, and users can browse different table contents by switching tabs.
[0067] Exemplarily, after creating a workbook object, the generation and processing of the table tab can be performed based on the workbook object. Based on the target data to be imported, multiple table objects can be created, and each table object corresponds to a tab of the workbook object. In one embodiment, the present application implements the processing and preview of table data through Apache POI. At this time, the createSheet(String sheetName) method of the Workbook object can be used to create multiple table objects, and each Sheet represents an independent tab. If two table objects need to be created, representing that the workbook object contains two tables, it can be represented as follows:
[0068] Sheet sheet1 = workbook.createSheet("Sheet1");
[0069] Sheet sheet2 = workbook.createSheet("Sheet2").
[0070] Step 205, creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object to update the workbook object and obtain a table preview object.
[0071] Among them, a cell is the intersection of a row and a column in a table. It is the smallest unit that makes up a table and can be split or merged. The input and modification of a single data are all done in a cell. You can create a table cell format in a table, and then implement data import processing.
[0072] Exemplarily, after the table object is created, it is necessary to import the target data into the created table to form a table file. At this time, cells can be created in each table object, and then the target data can be imported into the cells of each table object, so that the tables of multiple different tabs are filled completely. After the target data is imported, it can be considered that the update of the workbook object is completed, and the table preview object is obtained. In one embodiment, the present application realizes the processing and preview of table data through Apache POI. At this time, in each table object, the content is constructed by creating Row and Cell objects and filling in data.
[0073] Row row = sheet1.createRow(0); / / Create the first row
[0074] Cell cell = row.createCell(0); / / Create the first cell
[0075] cell.setCellValue("Data1"); / / Set the cell value
[0076] Step 207, performing memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result.
[0077] Step 209, writing the table data optimization result into the output stream to obtain the table data preview result.
[0078] Exemplarily, memory optimization processing refers to processing large amounts of tabular data through objects specifically used for memory optimization, thereby reducing the memory consumption of the table. For example, for table files in .xlsx format, memory usage can be optimized through the SXSSFWorkbook class. The SXSSFWorkbook class reduces memory consumption by maintaining a finite worksheet cache (100 rows by default). When the cache is full, it writes the oldest row data to the hard disk and removes it from the memory, allowing the program to avoid memory overflow problems when processing large quantities of data. By using the table data processing class to support the export of large amounts of data, memory usage is optimized, which is suitable for the export of reports with large amounts of data. Then, after the table optimization is completed, the table data optimization results can be written to the output stream to obtain the table data preview results. If written to the output stream ByteArrayOutputStream, the preview function can be implemented in the Web application. The corresponding code is:
[0079] ByteArrayOutputStream bos = new ByteArrayOutputStream();
[0080] workbook.write(bos);
[0081] byte[] bytes = bos.toByteArray().
[0082] The above-mentioned table data preview method first performs object creation processing based on the preview data type of the target data to be imported to obtain a workbook object; performs table tab generation processing based on the workbook object to obtain multiple table objects in the workbook object; creates cells corresponding to the target data in the table object, and imports the target data into the cells of each table object to update the workbook object to obtain a table preview object; performs memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result; writes the table data optimization result to the output stream to obtain a table data preview result. In the process of previewing the table data, the present application first imports the target data to be imported into each table object of the workbook object to generate a table preview object, and then performs memory optimization on the table preview object through the table data processing class, so that when a large amount of table data is exported, memory usage is optimized, and the technical performance bottleneck of previewing multiple tabs of reports is overcome, so that it is suitable for exporting reports with large amounts of data.
[0083] In one embodiment, the method further includes: performing file generation processing based on the table preview object to obtain a table export file; and feeding back the table export file when a table download request is received.
[0084] The file generation process is used to generate a table file in a specified format, such as a table file in .xls or .xlsx format. The table download request is generated by user operation. When the user needs to export a table file, he can initiate a table download request by operating the application and selecting the table export function.
[0085] Exemplarily, the table preview object can also be written into a file of the client, such as .xls or .xlsx format, so that the user can download it. When the user wants to download the specified table data, the corresponding table download request can be submitted, and the terminal or server responsible for processing the table data preview can feedback the table export file when receiving the table download request. In one of the specific embodiments, the user can also specify which part of the table data needs to be downloaded in the table download request. Then the terminal or server can search for the part to be downloaded in the table export file based on the table download request, and feedback and export the part of the table data specified by the user. In this embodiment, by generating a table export file and performing the export processing of the table file according to the user's specification, the flexibility of table data processing is effectively improved, and the availability of table data is improved.
[0086] In an exemplary embodiment, as shown in FIG3 , the method further includes:
[0087] Step 302: Obtain a data query request for the table data preview result.
[0088] Step 304: Perform paging query processing on the table data preview result based on the data query request to obtain a paging query result.
[0089] Step 306, summarize the paging query results to obtain table data query results.
[0090] Exemplarily, paging query processing is a database query technology that improves query efficiency and user experience by dividing a large amount of data into multiple smaller parts, i.e., pages. In Web applications, when users need to query information from massive data, paging query can effectively reduce the amount of data transmission and server load, thereby improving the response speed and concurrency performance of the system. The solution of the present application reduces the load pressure of the server through paging query. When a data query request is received, the paging query result can be obtained by performing paging query processing on the table data preview result. In the paging query result, the searched results are displayed in a paging form, and finally the paging query results are summarized to obtain the table data query result. In this embodiment, the corresponding data query processing of the table data preview process is performed by paging query, which can effectively reduce the amount of data transmission and server load, thereby ensuring the performance of the query and table data processing process.
[0091] In an exemplary embodiment, as shown in FIG4 , step 205 includes:
[0092] Step 401, creating cells corresponding to target data in a table object, and importing the target data into cells of each table object to obtain a table data import result.
[0093] Step 403: update the table data import result based on the table design style to obtain the table data update result.
[0094] Step 405: merge cells in the table data update result to obtain a table preview object.
[0095] Exemplarily, the present application can also customize the style of the created table through the table design style. For the process of importing table data, it is first necessary to create cells corresponding to the target data in the table object, and import the target data into the cells of each table object to obtain the table data import result. The process can be expressed as:
[0096] Row row = sheet1.createRow(0); / / Create the first row
[0097] Cell cell = row.createCell(0); / / Create the first cell
[0098] cell.setCellValue("Data1"); / / Set the cell value
[0099] Then, based on the table design style, the table data import result is updated to obtain the table data update result. The design style process can be specifically expressed as:
[0100] CellStyle style = workbook.createCellStyle();
[0101] Font font = workbook.createFont();
[0102] font.setBold(true);
[0103] style.setFont(font);
[0104] cell.setCellStyle(style).
[0105] Finally, the cells in the result are updated by merging the table data to obtain the table preview object. The process can be expressed as:
[0106] sheet1.addMergedRegion(new CellRangeAddress(0, 0, 0, 2)); / / Merge the first three rows of cells.
[0107] In this embodiment, by providing a rich API, complex operations can be performed on the table data, such as cell style settings, data formatting, merging cells, etc., thereby improving the usability and expression effect of the table data.
[0108] In an exemplary embodiment, step 207 includes: importing the table preview object into the template engine, performing table generation processing through the template engine to obtain a templated table file; performing memory optimization processing on the templated table file through the table data processing class to obtain a table data optimization result.
[0109] Exemplarily, the present application can also implement the export processing of table data through templated tools. First, the table templates can be predefined and loaded into the template engine. Then, when the table data needs to be exported, the table preview object can be imported into the template engine, and the table generation processing is performed through the template engine to obtain a templated table file. In a specific embodiment, XLSTransformer or other template engines can be used to dynamically generate templated table files based on predefined Excel templates, and finally the templated table files are optimized in memory through the table data processing class to obtain the table data optimization results. Thereby exporting the optimized table file. In this embodiment, the templated table generation processing is implemented through the template engine, thereby effectively ensuring the availability of the table data.
[0110] In an exemplary embodiment, step 209 includes: based on streaming processing, writing the table data optimization result into the output stream row by row to obtain the table data preview result.
[0111] Exemplarily, stream processing is a technology for processing data in real time, suitable for application scenarios that require fast response. It processes continuous and growing data streams rather than static data sets. Stream processing systems need to be able to handle problems such as data loss, delays, and out-of-order arrival to ensure the robustness and reliability of the system. Stream processing systems usually support the use of SQL query language to define and process data, but a special StreamSQL language is required to handle growing data streams. The present application can also use streaming processing to export tabular data. For very large reports, streaming processing can be used to write the optimized results of tabular data to the output stream line by line to obtain a preview result of the tabular data to reduce memory consumption. Ensure the processing effect on tabular data.
[0112] In one embodiment, the table data preview method of the present application is specifically implemented by Apache Poi, and the process of the method includes: performing object creation processing based on the preview data type of the target data to be imported to obtain a workbook object; performing table tab generation processing based on the workbook object to obtain multiple table objects in the workbook object; creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object to obtain the table data import result; updating the table data import result based on the table design style to obtain the table data update result; merging the cells in the table data update result to obtain the table preview object. The table preview object is imported into the template engine, and the table generation processing is performed by the template engine to obtain a templated table file; the templated table file is optimized in memory by the table data processing class to obtain the table data optimization result. Based on streaming processing, the table data optimization result is written to the output stream line by line to obtain the table data preview result. File generation processing is performed based on the table preview object to obtain a table export file; when a table download request is received, the table export file is fed back. Get the data query request for the table data preview result; perform paging query processing on the table data preview result based on the data query request to obtain the paging query result; summarize the paging query results to obtain the table data query result. Apache Poi supports the export of large amounts of data by using the SXSSFWorkbook type, optimizes memory usage, and is suitable for the export of reports with large amounts of data. At the same time, it provides a rich API for complex operations, such as cell style settings, data formatting, merging cells, etc. And it does not rely on any platform-specific components, can run on multiple operating systems, and realize cross-platform report processing. Apache Poi can also be easily integrated into existing Java applications, whether desktop applications or Web applications. For reports with large amounts of data, Apache Poi supports streaming processing, which can write data line by line to reduce memory consumption. Apache Poi allows developers to have fine-grained control over exported reports, including cell styles, formula calculations, etc.
[0113] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0114] Based on the same inventive concept, the embodiment of the present application also provides a table data preview device for implementing the table data preview method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more table data preview device embodiments provided below can refer to the limitations of the table data preview method above, and will not be repeated here.
[0115] In an exemplary embodiment, as shown in FIG5 , a table data preview device is provided, comprising:
[0116] The object creation module 502 is used to perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object.
[0117] The page tab generation module 504 is used to perform table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object.
[0118] The data import module 506 is used to create cells corresponding to the target data in the table object, and import the target data into the cells of each table object to update the workbook object and obtain a table preview object.
[0119] The memory optimization module 508 is used to perform memory optimization processing on the table preview object through the table data processing class to obtain the table data optimization result.
[0120] The table preview module 510 is used to write the table data optimization result into the output stream to obtain the table data preview result.
[0121] In one embodiment, it also includes a data export module, which is used to: perform file generation processing based on the table preview object to obtain a table export file; and feedback the table export file when a table download request is received.
[0122] In one embodiment, it also includes a paging query module, which is used to: obtain a data query request for the table data preview result; perform paging query processing on the table data preview result based on the data query request to obtain the paging query result; and summarize the paging query results to obtain the table data query result.
[0123] In one embodiment, the data import module 506 is specifically used to: create cells corresponding to the target data in the table object, and import the target data into the cells of each table object to obtain the table data import result; update the table data import result based on the table design style to obtain the table data update result; merge the cells in the table data update result to obtain a table preview object.
[0124] In one embodiment, the memory optimization module 508 is specifically used for: importing the table preview object into the template engine, performing table generation processing through the template engine to obtain a templated table file; performing memory optimization processing on the templated table file through the table data processing class to obtain a table data optimization result.
[0125] In one embodiment, the table preview module 510 is specifically used to: based on stream processing, write the table data optimization result into the output stream row by row to obtain the table data preview result.
[0126] Each module in the above-mentioned table data preview device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0127] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store table data preview related data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a table data preview method is implemented.
[0128] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0130] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0131] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0132] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0133] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0134] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0135] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A table data preview method, characterized in that: The method comprises: Perform object creation processing based on the preview data type of the target data to be imported to obtain a workbook object; Performing table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object; Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object; Performing memory optimization processing on the table preview object through the table data processing class to obtain a table data optimization result; The table data optimization result is written into the output stream to obtain the table data preview result.
2. The method according to claim 1, characterized in that The method further comprises: Perform file generation processing based on the table preview object to obtain a table export file; When a form download request is received, the form export file is fed back.
3. The method according to claim 1, characterized in that The method further comprises: Obtaining a data query request for the table data preview result; Performing paging query processing on the table data preview result based on the data query request to obtain a paging query result; The paging query results are aggregated to obtain a table data query result.
4. The method according to claim 1, characterized in that: The step of creating cells corresponding to the target data in the table object and importing the target data into cells of each table object to update the workbook object and obtain a table preview object includes: Creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object to obtain a table data import result; Performing an update process on the table data import result based on the table design style to obtain a table data update result; The cells in the table data update result are merged to obtain a table preview object.
5. The method according to claim 1, characterized in that: The table data optimization result obtained by performing memory optimization processing on the table preview object through the table data processing class includes: Importing the table preview object into the template engine, performing table generation processing through the template engine to obtain a templated table file; The templated table file is subjected to memory optimization processing through the table data processing class to obtain a table data optimization result.
6. The method according to claim 1, characterized in that Writing the table data optimization result into the output stream to obtain the table data preview result includes: Based on streaming processing, the table data optimization result is written into the output stream row by row to obtain the table data preview result.
7. A table data preview device, characterized in that: The device comprises: An object creation module, used for performing object creation processing based on the preview data type of the target data to be imported to obtain a workbook object; A page tab generation module, used to perform table page tab generation processing based on the workbook object to obtain multiple table objects in the workbook object; A data import module, used for creating cells corresponding to the target data in the table object, and importing the target data into the cells of each table object, so as to update the workbook object and obtain a table preview object; A memory optimization module, used for performing memory optimization processing on the table preview object through a table data processing class to obtain a table data optimization result; The table preview module is used to write the table data optimization result into the output stream to obtain the table data preview result.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.