Excel table generation method and device

By obtaining the target business data and its corresponding business types, obtaining the FTL template file corresponding to the business types, and using Apache POI tools to process and generate Excel tables, it solves the problem that it is difficult to efficiently and automatically generate Excel tables in the existing technology, and realizes an efficient and flexible table generation method.

CN119808735APending Publication Date: 2025-04-11CHINA TELECOM CORP LTD

Patent Information

Application Number
CN202411735485.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In data statistics scenarios, it is difficult for the existing technology to efficiently and accurately generate Excel tables, resulting in a lot of manpower and time required. The fixed Excel table templates require manual adjustments, and the complete automated generation cannot be achieved.

Method used

By obtaining the target business data and its corresponding business type, obtaining the FTL template file corresponding to the business type, using the Apache POI tool to process the template files and data, generating the target Excel table, and dynamically adjusting the template to meet data needs when the data does not match the template.

Benefits of technology

The method of automatically generating and dynamically adjusting Excel table templates based on business data is realized, which significantly improves the efficiency and flexibility of table generation, reduces manual operations, and solves the problem of difficult to automatically generate Excel tables in data statistics scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808735A_ABST
    Figure CN119808735A_ABST
Patent Text Reader

Abstract

The invention discloses an Excel table generation method and device. The method comprises the following steps: acquiring target business data to be arranged, and determining a target business type corresponding to the target business data; a target free mark template language FTL template file corresponding to the target service type is obtained from a target storage system, multiple FTL template files of multiple service types are stored in the target storage system, and each FTL template file is obtained by converting an Excel template file of the corresponding type into an extensible markup language XML file and then converting the XML file; and processing the target FTL template file and the target business data by utilizing an Apache POI tool to obtain a target Excel table. The technical problem that it is difficult to efficiently, accurately and automatically generate the Excel table in a data statistics scene is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and device for generating an Excel table. Background Art

[0002] In the process of business analysis, data statistics and presentation are usually required, which includes making data tables according to the specified Excel table template. This process often requires a lot of manpower and time. In addition, due to the differences in data at different times and locations, fixed Excel table templates often need to be manually adjusted twice, such as adding or deleting table rows and columns.

[0003] The currently commonly used technical solution is to generate Excel tables through fixed templates, but this method cannot automatically adjust the format according to data changes, and still requires manual post-review and adjustment, and cannot achieve complete automatic generation. Therefore, the problem that needs to be solved is how to reduce manual operations and improve generation efficiency while ensuring the standardization of document formats.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide an Excel table generation method and device to at least solve the technical problem that it is difficult to automatically generate Excel tables efficiently and accurately in data statistics scenarios.

[0006] According to one aspect of an embodiment of the present application, a method for generating an Excel table is provided, comprising: obtaining target business data to be sorted, and determining a target business type corresponding to the target business data; obtaining a target free markup template language FTL template file corresponding to the target business type from a target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is obtained by converting an Excel template file of a corresponding type into an extensible markup language XML file, and then converting the XML file; using an Apache POI tool to process the target FTL template file and the target business data to obtain a target Excel table.

[0007] Optionally, before obtaining the target FTL template file corresponding to the target business type from the target storage system, the method also includes: obtaining multiple Excel template files of multiple business types; for the Excel template file of each business type, converting the Excel template file into an XML file using the Aspose.Cells tool, and converting the XML file into an FTL template file using the FreeMarker template engine, and storing the FTL template file of the business type in the target storage system.

[0008] Optionally, obtaining the target business data to be sorted includes: in response to a business request of the target business, querying the target business data corresponding to the target business from a target database; or obtaining the target business data transmitted by the target object through an application program interface.

[0009] Optionally, after obtaining the target business data to be sorted, the method also includes: preprocessing the target business data, wherein the preprocessing includes at least one of the following: data cleaning, data standardization processing, data cleaning includes at least one of the following: data deduplication, outlier elimination, and data standardization processing includes at least one of the following: dimensional standardization processing, format standardization processing.

[0010] Optionally, the target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table, including: when the target business data matches the target FTL template file, the target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table; when the target business data does not match the target FTL template file, the target FTL template file is adjusted according to the target business data, and the adjusted target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table, and the adjusted target FTL template file is updated to the target storage system.

[0011] Optionally, when the target business data does not match the target FTL template file, the target FTL template file is adjusted according to the target business data, including: when the target business data includes a first data type that does not exist in the target FTL template file, using the FreeMarker template engine to add rows or columns corresponding to the first data type in the target FTL template file; when the amount of data of the second data type in the target business data exceeds the maximum amount of data that can be accommodated by the row or column corresponding to the second data type in the target FTL template file, using the FreeMarker template engine to add rows or columns corresponding to the second data type in the target FTL template file.

[0012] Optionally, after obtaining the target Excel table, the method also includes: responding to the modification instruction of the target object, adjusting the target Excel table according to the modification instruction; using the Aspose.Cells tool to convert the adjusted target Excel table into an update XML file, and using the FreeMarker template engine to convert the update XML file into an update FTL template file; and using the update FTL template file to replace the target FTL template file in the target storage system.

[0013] According to another aspect of an embodiment of the present application, an Excel table generation device is also provided, including: a data acquisition module, used to acquire target business data to be sorted, and determine the target business type corresponding to the target business data; a template selection module, used to acquire a target FTL template file corresponding to the target business type from a target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is converted from an Excel template file of a corresponding type into an XML file, and then converted from the XML file; a table generation module, used to use the Apache POI tool to process the target FTL template file and the target business data to obtain a target Excel table.

[0014] According to another aspect of an embodiment of the present application, a computer program product is further provided, the computer program product comprising: a computer program, wherein when the computer program is executed by a processor, the above-mentioned Excel table generation method is implemented.

[0015] According to another aspect of an embodiment of the present application, an electronic device is further provided, comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned Excel table generation method through the computer program.

[0016] In an embodiment of the present application, the target business data to be sorted is obtained, and the target business type corresponding to the target business data is determined; the target free markup template language FTL template file corresponding to the target business type is obtained from the target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is converted from an Excel template file of a corresponding type to an extensible markup language XML file, and then converted from the XML file; the target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table. In this way, by combining the efficient processing capabilities of Aspose.Cells and the dynamic template adjustment function of FreeMarker, as well as the Excel generation capability of Apache POI, an innovative method for automatically generating and dynamically adjusting Excel table templates based on business data is implemented, which significantly improves the efficiency and flexibility of table generation, thereby solving the technical problem of the difficulty in efficiently and accurately automatically generating Excel tables in data statistics scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 It is a flowchart of an optional Excel table generation method according to an embodiment of the present application;

[0019] Figure 2 is a schematic structural diagram of an optional Excel table generating device according to an embodiment of the present application;

[0020] Figure 3 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] In order to better understand the embodiments of the present application, some nouns or terms that appear in the description of the embodiments of the present application are first translated and explained as follows:

[0024] FTL: FreeMarker Template Language, a template language used by the FreeMarker template engine. FreeMarker is an open source, high-performance, extensible template engine, which is mainly used to generate dynamic content on the server side. It can map data models to various output formats, such as HTML (Hyper Text Markup Language), XML, Java source code, etc., and also includes templates for generating Excel tables.

[0025] XML: The full name is Extensible Markup Language. It is a language similar to HTML but does not use predefined tags. Users can define their own tags according to their own design requirements. The basic format of XML is standardized and is used to store and transmit data.

[0026] Example 1

[0027] According to an embodiment of the present application, a method for generating an Excel table is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0028] Figure 1 is a flow chart of an Excel table generation method provided according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:

[0029] Step S102, obtaining target business data to be sorted, and determining a target business type corresponding to the target business data;

[0030] Step S104, obtaining a target FTL template file corresponding to the target business type from the target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is obtained by converting an Excel template file of a corresponding type into an XML file and then converting the XML file;

[0031] Step S106: Use the Apache POI tool to process the target FTL template file and the target business data to obtain a target Excel table.

[0032] The following describes the various steps of the Excel table generation method in conjunction with a specific implementation process.

[0033] First, the target business data to be sorted is obtained, and the target business type corresponding to the target business data is determined.

[0034] Optionally, obtaining the target business data to be sorted includes: in response to a business request of the target business, querying the target business data corresponding to the target business from a target database; or obtaining the target business data transmitted by the target object through an application program interface.

[0035] As an optional implementation, after obtaining the target business data to be sorted, the target business data can also be preprocessed, wherein the preprocessing includes at least one of the following: data cleaning, data standardization processing, data cleaning includes at least one of the following: data deduplication, outlier elimination, data standardization processing includes at least one of the following: dimensional standardization processing, format standardization processing.

[0036] Specifically, the first step of the above process begins with receiving a target business request, which can be automatically triggered in the business system or manually initiated by a user through an application programming interface (API). The system is flexibly designed and can respond to target business requests from various sources, whether internal system operations or external user instructions. Once a business request is received, the system immediately starts the data acquisition process and queries the business data corresponding to the requested business type from the specified target database (such as PostgreSQL). Data acquisition is not limited to database queries. The system also supports receiving business data transmitted by the target object through the API. In the data acquisition stage, the system analyzes the key features of the business data, identifies and confirms its corresponding target business type, and lays the foundation for subsequent template matching and data filling. After obtaining the target business data, the system preprocesses it. The preprocessing includes two major steps: data cleaning and data standardization. It aims to ensure the integrity and consistency of the data and improve the accuracy and professionalism of the final generated Excel table. These steps include: the system deduplicates the target business data and removes outliers to eliminate redundancy and erroneous information in the data and improve the purity of the data; standardizes the dimensions and formats of the data to ensure that the units of all data fields are consistent and the display format complies with corporate specifications, facilitating the unified generation of subsequent Excel tables.

[0037] For example, the manager of the human resources department initiates a request for spreadsheet generation. This request clearly points out the need to update the "personnel file directory", which may be done through system interface operations or API calls. Based on this request, the system retrieves the latest file information of each employee from the PostgreSQL database or other data sources, which includes all data fields that need to be integrated into the "personnel file directory", including but not limited to employee ID, name, title, entry time, file number, file content, etc. If the data source is not limited to PostgreSQL, it can also be obtained from other databases such as MySQL (My Structures Query Language) or local Excel files. The system recognizes that the business request is associated with the specific business type of "personnel file directory update", and determines that the current target business type is "personnel file directory" update. This step ensures that subsequent operations can call the correct template file for table generation.

[0038] Different business types may correspond to different data fields, format requirements and display needs. For example, although the update of personnel files and the generation of financial statements both generate Excel tables, their data structures and display formats are completely different. Determining the target business type helps the system select the correct FTL template file and correctly parse and process the data.

[0039] After determining the target business type, obtain the target FTL template file corresponding to the target business type from the target storage system, wherein the target storage system stores multiple FTL template files of multiple business types, and each FTL template file is converted from an Excel template file of the corresponding type into an XML file, and then converted from the XML file.

[0040] Among them, for the target storage system that stores multiple FTL template files of multiple business types, the generation process can be summarized as follows: First, prepare one or more Excel template files for each business type. These template files are designed by business experts to define the layout, style and structure of the data to ensure that the generated Excel table meets the enterprise's specifications and format requirements. Then use the Aspose.Cells tool to convert the Excel template file into XML format. XML is a structured data format that can clearly represent the structure and content of the template, including cell styles, merged areas, formulas, etc., which provides a basis for subsequent dynamic adjustment of the template. Then, the generated XML file is converted into an FTL template file through the FreeMarker template engine. FTL is a powerful template language that supports dynamic data filling and modification of template structure. The FTL template file converted from XML contains data binding points, which allow the system to dynamically insert or update data, as well as adjust the format and layout of the template according to the actual situation of the data. Finally, store these FTL template files in Ceph or FastDFS. Ceph provides high-availability and high-performance storage services to ensure that template files can be quickly accessed and used. It also supports large-scale data storage and high-concurrency access, making it very suitable for enterprise-level business applications.

[0041] Taking the above-mentioned personnel file directory as an example, the system obtains the target FTL template file corresponding to the "personnel file directory" business type from the Ceph file system. If there is no such FTL template file, the system will call the pre-uploaded Excel template file from Ceph, use the Aspose.Cells tool to convert it to XML format, and then use the FreeMarker template engine to convert the XML file into an FTL template file and store it in Ceph.

[0042] Optionally, after obtaining the target FTL template file and the target business data, the target FTL template file and the target business data are processed using an Apache POI tool to generate a target Excel table.

[0043] As an optional implementation method, when the target business data matches the target FTL template file, the target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table; when the target business data and the target FTL template file do not match, the target FTL template file is adjusted according to the target business data, and the adjusted target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table, and the adjusted target FTL template file is updated to the target storage system.

[0044] Among them, after obtaining the target FTL template file and the target business data, the system uses the Apache POI tool to perform preliminary data matching and template parsing. Specifically, Apache POI will identify the data binding points in the template file, that is, the data placeholders defined using the FreeMarker template language, such as #data, #list, etc. These placeholders correspond to specific fields or lists in the business data. The matching process mainly checks the following points: whether the data fields correspond to the placeholders defined in the template, whether the data volume is within the range of the number of rows and columns set by the template, and whether the data type conforms to the expected type of the data binding point set in the template. If the target business data and the target FTL template file are completely matched, that is, all data fields, data types, and data volumes meet the template presets, the Apache POI tool will directly fill the data into the template to generate the target Excel table.

[0045] Specifically, when the target service data does not match the target FTL template file, the target FTL template file is adjusted according to the target service data, which may include the following processing methods:

[0046] Adding a data type: when the target business data includes a first data type that does not exist in the target FTL template file, a row or column corresponding to the first data type is added to the target FTL template file by using the FreeMarker template engine.

[0047] For example, when the personnel file data contains a first data type that is not preset in the FTL template file, the system adds corresponding rows and columns in the template through FreeMarker to accommodate the new data type.

[0048] Add data volume: When the data volume of the second data type in the target business data exceeds the maximum data volume that can be accommodated in the row or column corresponding to the second data type in the target FTL template file, use the FreeMarker template engine to add the row or column corresponding to the second data type in the target FTL template file.

[0049] For example, if the amount of data of the second data type (such as archive content) in an existing template exceeds the capacity of the template rows or columns, the FreeMarker engine automatically expands the template, adding rows or columns to ensure that all data can be fully displayed.

[0050] Optionally, the adjusted template file will be further processed by Apache POI to generate the final target Excel table. At the same time, in order to maintain the update and consistency of the template library, the adjusted FTL template file will be updated to the target storage system, replacing the original template file to ensure that the template is the latest version when used next time.

[0051] Taking personnel file management as an example, suppose the latest personnel file information contains a new data type called "emergency contact", and the previous FTL template file does not reserve a place for it. In this case, the system will recognize this difference, and the FreeMarker template engine will automatically add a row or a column to the template file to accommodate the filling of the "emergency contact" data. Then the Apache POI tool will generate a new Excel table based on the adjusted template and the complete personnel file data. After the table is generated, the updated template file is uploaded to the Ceph file system, overwriting the original template file, completing the online dynamic update of the template.

[0052] Optionally, after obtaining the target Excel table, the method also includes: responding to the modification instruction of the target object, adjusting the target Excel table according to the modification instruction; using the Aspose.Cells tool to convert the adjusted target Excel table into an update XML file, and using the FreeMarker template engine to convert the update XML file into an update FTL template file; and using the update FTL template file to replace the target FTL template file in the target storage system.

[0053] For example, after an Excel table is generated, if the human resources management department issues modification instructions, such as updating file content or adjusting the format, the system adjusts the table according to the instructions and uses the Aspose.Cells tool to convert the modified Excel table into an updated XML format. It then uses FreeMarker to convert the XML into an updated FTL template file, and finally replaces the original FTL template file in the Ceph file system to achieve dynamic update of the template.

[0054] In an embodiment of the present application, the target business data to be sorted is obtained, and the target business type corresponding to the target business data is determined; the target free markup template language FTL template file corresponding to the target business type is obtained from the target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is converted from an Excel template file of a corresponding type to an extensible markup language XML file, and then converted from the XML file; the target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table. In this way, by combining the efficient processing capability of Aspose.Cells and the dynamic template adjustment function of FreeMarker, as well as the Excel generation capability of Apache POI and using the database for data query, an innovative method for automatically generating and dynamically adjusting Excel table templates based on business data is implemented, which significantly improves the efficiency and flexibility of table generation, thereby solving the technical problem of the difficulty in efficiently and accurately automatically generating Excel tables in data statistics scenarios.

[0055] Example 2

[0056] According to an embodiment of the present application, an Excel table generating device for implementing the Excel table generating method in Embodiment 1 is also provided. Figure 2 As shown, the Excel table generating device at least includes: a data acquisition module 21, a template selection module 22 and a table generating module 23, wherein:

[0057] The data acquisition module 21 is used to acquire the target business data to be sorted and determine the target business type corresponding to the target business data;

[0058] The template selection module 22 is used to obtain a target FTL template file corresponding to a target business type from a target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is obtained by converting an Excel template file of a corresponding type into an XML file and then converting the XML file;

[0059] The table generation module 23 is used to process the target FTL template file and the target business data using the Apache POI tool to obtain a target Excel table.

[0060] The functions of each module of the Excel table generating device are explained below in conjunction with a specific implementation process.

[0061] The data acquisition module acquires the target business data to be sorted and determines the target business type corresponding to the target business data.

[0062] Optionally, obtaining the target business data to be sorted includes: in response to a business request of the target business, querying the target business data corresponding to the target business from a target database; or obtaining the target business data transmitted by the target object through an application program interface.

[0063] Optionally, after obtaining the target business data to be sorted, the method also includes: preprocessing the target business data, wherein the preprocessing includes at least one of the following: data cleaning, data standardization processing, data cleaning includes at least one of the following: data deduplication, outlier elimination, and data standardization processing includes at least one of the following: dimensional standardization processing, format standardization processing.

[0064] The template selection module obtains the target FTL template file corresponding to the target business type from the target storage system, wherein the target storage system stores multiple FTL template files of multiple business types, and each FTL template file is converted from an Excel template file of the corresponding type into an XML file, and then converted from the XML file.

[0065] After determining the business type, the system obtains the FTL template file related to the business type from the Ceph file system. These FTL template files are converted from Excel template files to XML format in advance, and then converted using the FreeMarker template engine. If it is the first time to use or the template needs to be updated, the system will obtain the Excel template file and convert it to XML format using the Aspose.Cells tool. Then, the FreeMarker template engine converts the XML file into an FTL template file and stores it in the Ceph file system.

[0066] Optionally, the table generation module processes the target FTL template file and the target business data using the Apache POI tool to obtain a target Excel table.

[0067] When the target business data matches the target FTL template file, the target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table; when the target business data and the target FTL template file do not match, the target FTL template file is adjusted according to the target business data, and the adjusted target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table, and the adjusted target FTL template file is updated to the target storage system.

[0068] Specifically, when the target service data does not match the target FTL template file, the target FTL template file is adjusted according to the target service data, which can be done in the following manner:

[0069] Adding a data type: when the target business data includes a first data type that does not exist in the target FTL template file, adding a row or column corresponding to the first data type in the target FTL template file by using the FreeMarker template engine;

[0070] Add data volume: When the data volume of the second data type in the target business data exceeds the maximum data volume that can be accommodated in the row or column corresponding to the second data type in the target FTL template file, use the FreeMarker template engine to add the row or column corresponding to the second data type in the target FTL template file.

[0071] Optionally, after obtaining the target Excel table, the method also includes: responding to the modification instruction of the target object, adjusting the target Excel table according to the modification instruction; using the Aspose.Cells tool to convert the adjusted target Excel table into an update XML file, and using the FreeMarker template engine to convert the update XML file into an update FTL template file; and using the update FTL template file to replace the target FTL template file in the target storage system.

[0072] It should be noted that each module in the Excel table generation device in the embodiment of the present application corresponds one by one to each implementation step of the Excel table generation method in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be repeated here.

[0073] Example 3

[0074] According to an embodiment of the present application, a computer program product is also provided. The computer program product includes a computer program, wherein when the computer program is executed by a processor, the Excel table generation method in Example 1 is implemented.

[0075] According to an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the Excel table generation method in Example 1 by running the computer program.

[0076] According to an embodiment of the present application, a processor is further provided, which is used to run a computer program, wherein the Excel table generation method in Example 1 is executed when the computer program is running.

[0077] According to an embodiment of the present application, an electronic device is also provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the Excel table generation method in Example 1 through the computer program.

[0078] Specifically, when the computer program is running, the following steps are executed: obtaining target business data to be sorted, and determining the target business type corresponding to the target business data; obtaining a target free markup template language FTL template file corresponding to the target business type from a target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each FTL template file is converted from an Excel template file of a corresponding type into an extensible markup language XML file, and then converted from the XML file; using the Apache POI tool to process the target FTL template file and the target business data to obtain a target Excel table.

[0079] As an optional implementation, the electronic device may be in the form of a mobile terminal, a computer terminal or a similar computing device. Figure 3 The hardware structure block diagram of an electronic device for implementing the Excel table generation method is shown. Figure 3 As shown, the electronic device 30 may include one or more (302a, 302b, ..., 302n are used to illustrate) processors 302 (the processor 302 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 304 for storing data, and a transmission device 306 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 3 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 3 More or fewer components as shown, or with Figure 3 Different configurations are shown.

[0080] It should be noted that the one or more processors 302 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the electronic device 30. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0081] The memory 304 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the Excel table generation method in the embodiment of the present application. The processor 302 executes various functional applications and data processing by running the software programs and modules stored in the memory 304, that is, realizing the vulnerability detection method of the above-mentioned application. The memory 304 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 304 may further include a memory remotely arranged relative to the processor 302, and these remote memories may be connected to the electronic device 30 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0082] The transmission device 306 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the electronic device 30. In one example, the transmission device 306 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 306 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0083] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 30 .

[0084] The serial numbers of the above embodiments are only for description and do not represent the advantages or disadvantages of the embodiments.

[0085] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0086] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units 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 interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0087] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0088] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0089] If the integrated unit 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 application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0090] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating an Excel table, characterized in that: include: Acquire target business data to be sorted, and determine the target business type corresponding to the target business data; Acquire a target free markup template language FTL template file corresponding to the target business type from the target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each of the FTL template files is converted from an Excel template file of a corresponding type into an extensible markup language XML file, and then converted from the XML file; The target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table.

2. The method according to claim 1, characterized in that Before acquiring the target FTL template file corresponding to the target service type from the target storage system, the method further includes: Get various Excel template files for various business types; For the Excel template file of each business type, the Excel template file is converted into an XML file using the Aspose.Cells tool, and the XML file is converted into an FTL template file using the FreeMarker template engine, and the FTL template file of the business type is stored in the target storage system.

3. The method according to claim 1, characterized in that Obtain the target business data to be sorted, including: In response to a service request of a target service, querying a target database for the target service data corresponding to the target service; or, The target business data transmitted by the target object through the application program interface is obtained.

4. The method according to claim 1, characterized in that After obtaining the target business data to be sorted, the method further includes: The target business data is preprocessed, wherein the preprocessing includes at least one of the following: data cleaning, data standardization processing, the data cleaning includes at least one of the following: data deduplication, outlier removal, and the data standardization processing includes at least one of the following: dimensional standardization processing, format standardization processing.

5. The method according to claim 1, characterized in that: The target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table, including: When the target business data matches the target FTL template file, the target FTL template file and the target business data are processed using an Apache POI tool to obtain a target Excel table; When the target business data does not match the target FTL template file, the target FTL template file is adjusted according to the target business data, and the adjusted target FTL template file and the target business data are processed using the Apache POI tool to obtain a target Excel table, and the adjusted target FTL template file is updated to the target storage system.

6. The method according to claim 5, characterized in that When the target service data does not match the target FTL template file, adjusting the target FTL template file according to the target service data includes: When the target business data includes a first data type that does not exist in the target FTL template file, adding a row or column corresponding to the first data type in the target FTL template file by using a FreeMarker template engine; When the amount of data of the second data type in the target business data exceeds the maximum amount of data that can be accommodated in the row or column corresponding to the second data type in the target FTL template file, a row or column corresponding to the second data type is added to the target FTL template file using the FreeMarker template engine.

7. The method according to claim 1, characterized in that After obtaining the target Excel table, the method further includes: In response to a modification instruction of the target object, adjusting the target Excel table according to the modification instruction; Using Aspose.Cells tool to convert the adjusted target Excel table into an update XML file, and using FreeMarker template engine to convert the update XML file into an update FTL template file; The target FTL template file in the target storage system is replaced by the updated FTL template file.

8. An Excel table generating device, characterized in that: include: A data acquisition module, used to acquire target business data to be sorted, and determine the target business type corresponding to the target business data; A template selection module is used to obtain a target FTL template file corresponding to the target business type from a target storage system, wherein the target storage system stores a plurality of FTL template files of a plurality of business types, and each of the FTL template files is converted from an Excel template file of a corresponding type to an XML file, and then converted from the XML file; The table generation module is used to process the target FTL template file and the target business data using the Apache POI tool to obtain a target Excel table.

9. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the Excel table generation method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the Excel table generation method according to any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • Document output method and system, computer equipment and storage medium

    CN112232038A

  • Cloud paper typesetting method and system, electronic equipment and storage medium

    CN115238668A

Cited By

  • Excel file dynamic generation method and device based on front-end configuration

    CN120257952A