Report rendering method for realizing custom template

By adjusting the method of the head area and generating the attribute identification, the problems of lack of functions of existing reporting tools in dynamic header and group summary are solved, and the flexible display of the report and efficient data processing are realized.

CN119378511APending Publication Date: 2025-01-28浪潮数字粮储科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411531132.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

Existing report tools have insufficient functions in handling dynamic headers, grouped subtotals and total timing, resulting in inflexible report presentation methods, complex operations, and limited scalability and flexibility.

Method used

Adjust the header area according to the title query data, generate custom report templates, and generate the attribute identification of the data area according to the template, and use the data to query and process through the back end to form report files.

Benefits of technology

The dynamic changes of the report header of the report, improved the flexibility and adaptability of the report, simplified data processing, improved the speed and accuracy of data processing, and enhanced the flexibility and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119378511A_ABST
    Figure CN119378511A_ABST
Patent Text Reader

Abstract

The invention discloses a report rendering method for realizing a self-defined template, a report comprises a header area and a data area, and the method comprises the following steps: adjusting the header area according to title query data to generate a report template; generating an attribute identifier of data in the data area according to the report template, wherein the attribute identifier is formed by combining title data in a header area corresponding to the data; and performing data query and processing through the back end according to the attribute identifier, and returning a result to the front end to form a report file. The report template is generated by dynamically adjusting the header area, so that the flexibility of the report and the user experience are improved, and the workload of template design and maintenance is reduced. The automatic generation of the attribute identifier improves the efficiency and accuracy of data processing, simplifies data analysis, and promotes data integration and sharing. And the back end processes the data and returns to the front end for filling, so that the system performance is improved, the front end logic is simplified, the flexibility and expandability of the system are enhanced, the data consistency is guaranteed, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, and in particular relates to a report rendering method for implementing a custom template. Background Art

[0002] Many reporting tools on the market currently rely on fixed template formats when processing data and generating reports. Once the template is defined, the system can usually only fill in cell data, expand table data rows, and perform conventional total calculations. However, when faced with more complex dynamic headers, group subtotals, and totals, existing technologies do not support them enough and are difficult to implement.

[0003] Existing reporting tools have limited functions in terms of dynamic headers, which makes it difficult to meet users' diverse reporting needs. Users cannot flexibly customize the presentation of reports based on their own business scenarios and data characteristics.

[0004] In addition, as the business develops and the amount of data increases, users may need to expand or upgrade reports. However, fixed template formats cannot meet such changing needs. Although SpreadJS table controls provide basic summary and calculation functions of Excel, when dealing with complex group totals and subtotals, it is often necessary to write complex formulas or macro codes, which increases the difficulty of operation.

[0005] In addition, the fixed template format leads to limitations in the flexibility and scalability of reports. Especially when data needs to be displayed in multiple dimensions, the current technical solutions cannot adapt well to the changes in data display requirements. Summary of the invention

[0006] The present invention provides a report rendering method for implementing a custom template to solve the problems of inflexible report display mode, increased operation complexity, and limited extensibility and flexibility of reports caused by insufficient functions of existing report tools in dynamic table headers and group summarization.

[0007] The technical solution adopted by the present invention is:

[0008] A report rendering method for implementing a custom template includes:

[0009] S101: adjusting the header area according to the title query data to generate a report template;

[0010] S201 generates an attribute identifier of the data in the data area according to the report template, wherein the attribute identifier is formed by combining the title data in the header area corresponding to the data;

[0011] S301: query and process data through the back end according to the attribute identifier, and return the result to the front end to form a report file.

[0012] The report rendering method for implementing a custom template in the present invention also includes the following additional technical features:

[0013] According to the title query data, the header area is adjusted to generate a report template, specifically:

[0014] Generate a title query array according to the title query data;

[0015] According to the number of rows and columns of the title query array, the number of rows and columns of the header area are correspondingly adjusted;

[0016] According to the coordinates of the title data in the title query array, the title data are filled into the header area one by one.

[0017] According to the title query data, the header area is adjusted to generate a report template, which also includes:

[0018] When the cell title data in the header area is consistent with the title data in the adjacent cell, the cell in the header area is merged with the adjacent cell.

[0019] According to the attribute identifier, data query and processing are performed through the back end, and the results are returned to the front end to form a report file, specifically:

[0020] According to the attribute identifier, data query is performed through the backend;

[0021] If data is found, the data is returned to the front end so that the data is filled into the data area according to the attribute identifier;

[0022] If no data is found, the data is processed by the backend and the results are returned to the frontend.

[0023] If no data is found, the backend processes the data and returns the result to the frontend. Specifically:

[0024] When the attribute identifier of the data does not contain subtotal and total identifiers, the data is identified as 0;

[0025] When the attribute identifier of the data contains subtotal and / or total identifier, the data is processed through the back end.

[0026] When the attribute identifier of the data contains subtotal and / or total identifier, the data is processed by the backend, specifically:

[0027] The attribute identifier includes a first identifier segment formed by sequentially combining the header data in the header area corresponding to the column where the data is located from top to bottom, and a second identifier segment formed by sequentially combining the header data in the header area corresponding to the row where the data is located from left to right;

[0028] Data query and summation processing are performed according to the first identification segment and the second identification segment.

[0029] The data query and summation processing are performed according to the first identification segment and the second identification segment, specifically:

[0030] When the first identification segment contains a subtotal identification word, query the data corresponding to the attribute identification words that are the same as the subtotal identification word, and perform sum processing;

[0031] When the first identification segment contains a total identification word, the total identification word in the first identification segment is replaced with a subtotal identification word, and data query is performed based on the subtotal identification word in the first identification segment, the identification word after the subtotal identification word, and the second identification segment, and summation processing is performed.

[0032] The present invention also provides a report rendering system for implementing a custom template, which is implemented based on a SpreadJS table control and includes:

[0033] Title query interface, used to provide title query data to generate report templates;

[0034] The data query interface is used to call the back-end data query and processing, and return the results to the front-end and fill them into the cells of the data area to form a report file.

[0035] The present invention further provides a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to implement the report rendering method of a custom template.

[0036] The present invention again provides an electronic device, comprising:

[0037] Memory, for storing computer instructions;

[0038] The processor is used to implement the report rendering method for implementing a custom template when executing the computer instructions.

[0039] Due to the adoption of the above technical solution, the beneficial effects achieved by the present invention are as follows:

[0040] 1. In the present invention, the header area is adjusted according to the title query data to generate a report template, so that the header of the report can be dynamically changed according to actual business needs. This means that the header is no longer a fixed part, but can be adjusted according to the query results.

[0041] Users can flexibly customize the content of the table header according to different business scenarios and data characteristics. For example, a business scenario may need to display more dimensional data, while another scenario may need to simplify the display items. Dynamic table header design allows reports to display the most appropriate content in different scenarios.

[0042] The dynamic header design allows the report to automatically adjust the header content according to the query results, thus presenting a layout that best meets user needs. This not only reduces the trouble of manually adjusting the header, but also makes the final report more intuitive and easy to understand, enhancing the user experience.

[0043] In addition, users no longer need to predefine templates for every possible situation, but can dynamically generate table headers to adapt to various situations. This greatly reduces the workload of early template design and also reduces the complexity of later maintenance.

[0044] 2. In the present invention, the attribute identifier of the data in the data area is generated according to the report template, and the attribute identifier is formed by combining the title data in the header area corresponding to the data. This not only improves the speed and accuracy of data processing, simplifies data analysis, promotes data integration and sharing, but also provides the possibility of realizing higher-level intelligent management, which has important practical significance and development prospects.

[0045] First, from the perspective of improving data processing efficiency, traditional report processing often relies on manual data input or checking, which is time-consuming and labor-intensive, especially when faced with large amounts of data, and is extremely inefficient. By extracting attribute identifiers in an automated way, the system can quickly identify and classify data, greatly shortening the time for data processing, thereby significantly improving work efficiency. Automated processes can also enhance the accuracy of data processing. During manual operations, errors can easily be introduced due to factors such as fatigue or distraction. Generating attribute identifiers through automated tools can ensure the consistency and correctness of data, reduce data errors caused by human factors, and further improve data quality.

[0046] In addition, the generated attribute identification is of great significance for subsequent data analysis. The generation of attribute identification gives semantic labels to data, helping users quickly locate and understand the specific meaning of the data, thereby accelerating the decision-making process. Furthermore, the standardization of attribute identification also facilitates data integration and sharing. In practical applications, data often comes from different departments or platforms, with different formats, which are difficult to directly compare or merge. Through a unified attribute identification system, data exchange and integration across departments and even organizations can be easily achieved, which promotes the circulation and collaboration of information. Moreover, the automatically generated attribute identification can provide structured input for these intelligent systems, help build more efficient and intelligent information processing systems, and promote the digital transformation of enterprises.

[0047] 3. In the present invention, data query and processing are performed through the back end according to the attribute identifier, and the results are returned to the front end to form a report file. The design of performing data query and processing through the back end and returning the results to the front end to fill the cells in the data area not only improves the efficiency and accuracy of data processing, but also reduces the burden on the front end, enhances the flexibility and scalability of the system, ensures data consistency, improves user experience, and facilitates maintenance and upgrading. These beneficial effects work together to make the reporting system more intelligent, efficient and user-friendly.

[0048] First, by centralizing the data processing logic on the backend, the server's powerful computing power can be used to handle complex grouping subtotals, totals, and other calculation tasks, which is more efficient than executing them on the frontend. The backend can handle a large amount of data operations to ensure the accuracy of the calculation results. By placing data calculations on the backend, the frontend only needs to be responsible for data display, thereby simplifying the logic of the frontend. The frontend no longer needs to write complex function calculations and data rendering code, which reduces the complexity of frontend development and allows frontend developers to focus more on user interface design and optimization of interactive experience.

[0049] Secondly, the front end is only responsible for receiving the processed data and filling it into the cells, which can generate reports faster, shorten the waiting time for users, and improve the user experience. In addition, the back end usually has stronger computing power and storage resources, which is more suitable for large-scale data processing. By handing this part of the task to the back end, system resources can be used more effectively and the performance of the overall system can be improved. The back end is responsible for data processing, and the front end is responsible for data display. This separated architecture is conducive to system maintenance and upgrading. When the data processing logic needs to be changed, only the back end code needs to be adjusted, and the front end code can remain unchanged. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0051] Figure 1 A schematic diagram of a flow chart of a report rendering method for implementing a custom template in one embodiment of the present invention;

[0052] Figure 2 A schematic diagram of a report showing a report rendering completed in one embodiment of the present invention;

[0053] Figure 3 The figure is a schematic diagram of the structure of the electronic device in one embodiment of the present invention.

[0054] in:

[0055] 110 memory; 120 processor. DETAILED DESCRIPTION

[0056] In order to more clearly illustrate the overall concept of the present invention, a detailed description is given below in an exemplary manner in conjunction with the accompanying drawings.

[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0058] like Figure 1 As shown, a report rendering method for implementing a custom template, the report includes a header area and a data area, and the method includes:

[0059] S101: adjusting the header area according to the title query data to generate a report template.

[0060] This step aims to dynamically generate report templates to adapt to report presentation under different requirements. By adjusting the header area according to the title query data, the report template can be flexibly configured to better reflect the characteristics of actual business data. This approach not only improves the adaptability of the report, but also enhances the flexibility and scalability of the report.

[0061] In one embodiment, Figure 2 As shown in the figure, an inventory summary table is provided. The inventory summary table needs to include the inventory quantity of different regions, different storage enterprises, different grain storage points, and different grain varieties in different years, and provides subtotals and total statistics in various cases. Since the city may increase or decrease the storage area, storage enterprise, grain storage point, or adjust different years, the report template needs to be able to dynamically generate the header according to the latest information.

[0062] The header area of ​​the inventory summary table includes header rows and header columns. The header rows include the first four rows on the upper side of the table, which respectively indicate the city's reserve grain; grain, divided into three varieties of grain: rice, corn, and wheat; different years, including 2022 and 2023; divided into quantity and number of cargo spaces for separate statistical calculations.

[0063] The quantity is the weight of the grain in the corresponding title information, in tons. The number of cargo spaces is the number of locations used to store goods in a warehouse or storage facility.

[0064] The header column includes the first three rows on the left, which respectively indicate the storage areas, including Area 1 and Area 2; the storage enterprises, including Enterprise 1, Enterprise 2, and Enterprise 3; and the grain storage depots, including this depot, grain storage depot 1, and grain storage depot 2.

[0065] It is understandable that the above inventory summary table is only a specific embodiment of the present invention, and the present invention does not limit the specific information in the header area. The area and information in the header area are dynamically adjusted according to the title query data. The report can also be a monthly sales report, including the sales of different products, and it is necessary to display the sales of each product in each region.

[0066] In the above inventory summary table, this method will first obtain the title query data, and then adjust the report header area according to the query data, that is, generate a report template. For example, if the city adds a new grain storage unit "Region 3", then in the latest report, a new row will be added at the bottom, and "Region 3" will appear in the new header row. In this way, a report template containing the latest information can be generated without manually adjusting the template.

[0067] In this step, by dynamically adjusting the header area, the report can flexibly respond to changes in data without having to manually update the report template every time a modification is made. The method of dynamically generating the header area allows the report to dynamically adjust its structure based on the latest data, ensuring that the report content is synchronized with the actual business situation, reducing the need for manual intervention, and thus greatly improving the flexibility of the report. Automating work that originally required manual intervention reduces the time and resources required for manual maintenance of templates, while also reducing the possibility of errors. Automatically generating the header area automatically identifies and updates the header through the system, which not only saves labor costs, but also reduces the error rate by reducing manual operation links, thereby improving the accuracy and reliability of the report.

[0068] In addition, since report templates can be generated based on title query data, they can better adapt to various business scenarios and improve the applicability of reports. The method of dynamically generating header areas can flexibly adjust the content and format of reports according to specific business needs, so that reports can better serve specific business goals and improve the effectiveness of decision support. Moreover, as the business develops, reports may need to display more indicators or more detailed data classifications. The method of dynamically generating headers can easily cope with these expansion requirements and maintain the continuous availability of the reporting system. The mechanism of dynamically generating header areas allows the system to expand seamlessly as the business grows. Whether it is adding new analysis dimensions or introducing more complex data relationships, it can be achieved by dynamically adjusting the header area, ensuring that the reporting system always matches the actual needs of the enterprise.

[0069] Thirdly, ensure that each generated report template is based on the latest and most accurate data source, avoiding inconsistencies between different versions caused by manual operations. The method of automatically generating the header area ensures that all reports are derived from the same latest data source, thus eliminating the trouble of version control, maintaining the consistency and integrity of the data, and enhancing the efficiency of team collaboration.

[0070] S201: Generate an attribute identifier of the data in the data area according to the report template, wherein the attribute identifier is formed by combining the title data in the header area corresponding to the data.

[0071] This step aims to achieve data uniqueness and traceability by generating attribute identifiers for the data in the data area. The attribute identifiers are formed by combining the header data in the header area corresponding to the data. This step ensures that each piece of data can accurately correspond to the header information in the header area where it is located, thereby facilitating subsequent data query, statistics, and report generation.

[0072] In one embodiment, Figure 2 As shown, when generating a report, you need to create a unique attribute identifier for each data entry based on the combination of the title data, and separate each title data. For example, 119900.94@city reserve grain@grain@total@quantity@total@total@total, 26780.313@city reserve grain@grain@total@quantity@region1@enterprise1@this database, where "@" is used as a separator to connect each title data.

[0073] It should be noted that @ is only used as a separator between each title data and has no specific meaning. The present invention does not limit this. Other characters such as "#", "*", ", " can also be used for separation. For merged cells, when performing attribute identification, it is also necessary to fully identify the number of cells when they are not merged.

[0074] This attribute identifier will be used to determine the data during the data query phase and to locate the data in the report during the data return phase, thus ensuring that the required specific data items can be found quickly and accurately even when the data volume is huge.

[0075] This step not only improves the speed and accuracy of data processing, simplifies data analysis, and promotes data integration and sharing, but also provides the possibility for achieving higher-level intelligent management. It has important practical significance and development prospects.

[0076] First, from the perspective of improving data processing efficiency, traditional report processing often relies on manual data input or checking, which is time-consuming and labor-intensive, especially when faced with large amounts of data, and is extremely inefficient. By extracting attribute identifiers in an automated way, the system can quickly identify and classify data, greatly shortening the time for data processing, thereby significantly improving work efficiency. Automated processes can also enhance the accuracy of data processing. During manual operations, errors can easily be introduced due to factors such as fatigue or distraction. Generating attribute identifiers through automated tools can ensure the consistency and correctness of data, reduce data errors caused by human factors, and further improve data quality.

[0077] In addition, the generated attribute identification is of great significance for subsequent data analysis. The generation of attribute identification gives semantic labels to data, helping users quickly locate and understand the specific meaning of the data, thereby accelerating the decision-making process. Furthermore, the standardization of attribute identification also facilitates data integration and sharing. In practical applications, data often comes from different departments or platforms, with different formats, which are difficult to directly compare or merge. Through a unified attribute identification system, data exchange and integration across departments and even organizations can be easily achieved, which promotes the circulation and collaboration of information. Moreover, the automatically generated attribute identification can provide structured input for these intelligent systems, help build more efficient and intelligent information processing systems, and promote the digital transformation of enterprises.

[0078] S301: query and process data through the back end according to the attribute identifier, and return the result to the front end to form a report file.

[0079] This step aims to reduce the burden on the front-end by handing over the task of data query and processing to the back-end, and ensure the accuracy and efficiency of data processing. The main goal of this is to ensure that the data is properly processed and verified before it is displayed on the front-end to form the final report file. This not only improves the user experience, but also enhances the stability and reliability of the system.

[0080] In one embodiment, Figure 2As shown in the figure, an inventory summary table. When a user requests a report, the front end will generate corresponding attribute identifiers based on the user's request, such as "Municipal Reserve Grain@Rice@2023@Number of Cargo Spaces@Region 1@Enterprise 1@This Warehouse". These attribute identifiers will be sent to the back end for data query. The query result is 1. The result will be returned to the front end and filled into the data area to finally generate a report file.

[0081] Alternatively, when the attribute identifier is "Municipal Reserve Grain@Rice@Subtotal@Number of Cargo Units@Region 1@Enterprise 1@This Warehouse", and no data result is found in the back-end, it is processed through the attribute identifier according to the preset rules, and the processing result is returned to the front-end to form a report file.

[0082] In this step, data query and processing are performed through the backend according to the attribute identifier, and the results are returned to the frontend to form a report file. The design of performing data query and processing through the backend and returning the results to the frontend to fill the cells in the data area not only improves the efficiency and accuracy of data processing, but also reduces the burden on the frontend, enhances the flexibility and scalability of the system, ensures data consistency, improves user experience, and facilitates maintenance and upgrading. These beneficial effects work together to make the reporting system more intelligent, efficient and user-friendly.

[0083] First, by centralizing the data processing logic on the backend, the server's powerful computing power can be used to handle complex grouping subtotals, totals, and other calculation tasks, which is more efficient than executing them on the frontend. The backend can handle a large amount of data operations to ensure the accuracy of the calculation results. By placing data calculations on the backend, the frontend only needs to be responsible for data display, thereby simplifying the logic of the frontend. The frontend no longer needs to write complex function calculations and data rendering code, which reduces the complexity of frontend development and allows frontend developers to focus more on user interface design and optimization of interactive experience.

[0084] Secondly, the front end is only responsible for receiving the processed data and filling it into the cells, which can generate reports faster, shorten the waiting time for users, and improve the user experience. In addition, the back end usually has stronger computing power and storage resources, which is more suitable for large-scale data processing. By handing this part of the task to the back end, system resources can be used more effectively and the performance of the overall system can be improved. The back end is responsible for data processing, and the front end is responsible for data display. This separated architecture is conducive to system maintenance and upgrading. When the data processing logic needs to be changed, only the back end code needs to be adjusted, and the front end code can remain unchanged.

[0085] As a preferred implementation of the present invention, the header area is adjusted according to the title query data to generate a report template, specifically:

[0086] Generate a title query array according to the title query data;

[0087] According to the number of rows and columns of the title query array, the number of rows and columns of the header area are correspondingly adjusted;

[0088] According to the coordinates of the title data in the title query array, the title data are filled into the header area one by one.

[0089] This step aims to generate a report template by dynamically adjusting the header area according to the title query data. This process ensures that the report template can adaptively adjust its structure according to the actual query results, so that the generated report can accurately reflect the latest data structure and content, thereby improving the flexibility and adaptability of the report.

[0090] In one embodiment, Figure 2 As shown in the figure, an inventory summary table will query all the title data that needs to be displayed in the report from the database, and these title data will be returned in the form of an array. Based on the title query data, the generated partial title query array is as follows:

[0091]

[0092] It should be noted that due to page space limitations, the arrays corresponding to corn and wheat varieties are not shown. The area in the array that is not filled with characters is the data area.

[0093] Next, the number of rows and columns in the header area will be determined based on the number of rows and columns in the title query array. For example, if the first column of the title query array shows twelve title data, the header area will be adjusted to a one-column, twelve-row layout. The title query array is traversed from left to right by column to complete the adjustment of the header area.

[0094] Finally, fill the title data into the corresponding cells in the header area according to its position in the array. For example, the first element "Unit" in the array will be filled into the first cell in the header area, and so on.

[0095] In this step, by storing the title data in the form of an array, the report can flexibly respond to changes in data. When the report needs to display new data dimensions or adjust existing data classifications, the system simply updates the elements in the array. For example, when the city sets up a new grain storage area, a new title item can be added to the array without a large-scale reconstruction of the entire report template. This flexibility ensures that the report can quickly adapt to the needs of business development without causing the template to become invalid due to minor changes in the data structure.

[0096] Secondly, storing the title data in the form of an array makes it very intuitive and simple to count the number of rows and columns in the header area. For example, the length of the array can directly reflect the number of columns in the header area, and the nesting level of each element in the array can reflect the number of rows. In this way, the system can easily calculate the actual size of the header area and adjust the structure of the report template accordingly.

[0097] Thirdly, by filling in coordinates, we can ensure that each header data is placed in the correct cell, avoiding data misplacement caused by human error or system error. This method is especially suitable for complex reports that contain data of multiple dimensions and need to accurately locate each header data. By filling in coordinates, we can more easily implement the filling logic of the header area. This method reduces complex logical judgments, makes the code more concise and easy to understand, and also facilitates later maintenance and upgrades.

[0098] The coordinate filling method improves the efficiency of report generation by reducing unnecessary data processing steps. Filling can be done directly based on coordinates without additional intermediate steps, thus speeding up report generation.

[0099] As an example of this implementation, according to the title query data, the header area is adjusted to generate a report template, which also includes:

[0100] When the cell title data in the header area is consistent with the title data in the adjacent cell, the cell in the header area is merged with the adjacent cell.

[0101] This step aims to optimize the visual presentation and readability of the report template. By checking whether the cell title data in the header area is consistent with the title data in the adjacent cells and merging these cells if they are consistent, redundant information can be reduced, making the report more concise and clear, and improving the user's reading experience.

[0102] like Figure 2 As shown in the figure, it is an array formed by merging the same cells. For example, the "unit" in the figure is formed by merging the first four cells located at the top of the first column in the header area.

[0103] It should be noted that this step can start from the cell in the first column and the first row, and compare with the header data in the adjacent cells in turn. It can also be traversed from any cell in the header area.

[0104] This step merges repeated title data. In the present invention, the title data in adjacent cells in the header area are compared, and adjacent cells with the same value are merged to obtain a report template. This effectively improves the aesthetics, readability and logical consistency of the report, while improving the user experience and providing support for automated processing and report customization. This makes the report system more intelligent, efficient and user-friendly.

[0105] By merging adjacent cells with the same value, the header area of ​​the report will be neater. The merged cells not only reduce the visual clutter, but also make the header information clearer and easier to read, making it easier for users to quickly understand and grasp the data classification and hierarchical relationship in the report. In addition, the merge operation ensures the logical consistency of the header information and avoids confusion caused by redundant information. For example, when data items of the same level are repeated multiple times in the same column, merging these cells can reduce unnecessary repeated information and make the report structure more reasonable.

[0106] In addition, the operation of merging cells makes the report easier to understand and use. When viewing the report, users can more easily identify the relationship between data, especially when performing horizontal or vertical group subtotals and totals, the merged header can clearly indicate the location and range of each group.

[0107] Thirdly, for the process of automatically generating reports, merging cells can simplify the subsequent data processing logic. Because when generating reports, the merged headers can provide a more unified data structure, which helps the consistency of the front-end and back-end processing logic. The merge operation not only simplifies the appearance of the report, but also provides greater flexibility for customized report development. When it is necessary to dynamically generate reports according to different business scenarios, merging cells can help generate a more compact and reasonable report layout.

[0108] As a preferred implementation of the present invention, according to the attribute identifier, data query and processing are performed through the back end, and the results are returned to the front end to form a report file, specifically:

[0109] According to the attribute identifier, data query is performed through the backend;

[0110] If data is found, the data is returned to the front end so that the data is filled into the data area according to the attribute identifier;

[0111] If no data is found, the data is processed by the backend and the results are returned to the frontend.

[0112] This step aims to process data query and data processing tasks through the back-end to ensure that the data displayed on the front-end is up-to-date and accurate, and can be correctly filled into the data area of ​​the report according to the attribute identifier. This step reduces the computational burden of the front-end through the back-end data processing and improves the efficiency and accuracy of data processing.

[0113] Among them, the backend includes the server, which can handle business logic, data storage, and data processing tasks, and the frontend includes the client, which is used for user interface display and interaction with users.

[0114] Specifically, suppose we need to generate an inventory summary table that shows the quantity of different types of grain in different years, different storage companies, and different grain storage points. In order to generate this report, we need to query data based on attribute identifiers.

[0115] When a user requests a report, the corresponding attribute identifiers are generated according to the report template, such as "municipal grain reserve @ rice @ 2023 @ number of cargoes @ region 1 @ enterprise 1 @ this warehouse", and these identifiers are sent to the backend. After receiving the request, the backend performs data query based on the attribute identifiers.

[0116] If the backend finds relevant data, it will sort the query results in the order of attribute identifiers and return them to the frontend. The frontend fills the data into the data area of ​​the report according to the attribute identifiers. For example, if the corresponding data of "Municipal Reserve Grain @ Rice @ 2023 @ Number of Cargo Units @ Region 1 @ Enterprise 1 @ This Warehouse" is 1, the frontend will fill this data into the corresponding position.

[0117] If the backend fails to find the corresponding data, it will process the data. For example, if the attribute identifier contains the words "subtotal" or "total", such as the attribute identifier is "city reserve grain@rice@subtotal@number of cargo units@region1@enterprise1@this warehouse", the backend will process it according to the preset rules and return the processing results to the frontend.

[0118] In this step, by assigning the task of data query and processing to the backend, the computing power of the server can be fully utilized to handle complex data operations and improve the speed of data processing. The frontend is only responsible for displaying the processed data, which reduces the workload of the frontend and improves the response speed of the system. In addition, when the report needs to display subtotals or totals, the backend can ensure that the data is accurate. If the data processing logic is complex, it may introduce errors in the frontend, but processing it on the backend can better ensure the data quality.

[0119] In addition, moving the data processing logic to the backend can simplify the frontend implementation. The frontend only needs to focus on the logic of data display without having to worry about complex data processing algorithms. This not only reduces the difficulty of frontend development, but also helps improve the maintainability of the code.

[0120] Thirdly, processing data on the back end means that data from different data sources can be integrated more easily. For example, if a report needs to display data from multiple databases, the back end can be responsible for data integration and cleaning to ensure that the data displayed on the front end is consistent and complete.

[0121] As a preferred embodiment of this implementation, if no data is found, data processing is performed through the backend, and the result is returned to the frontend, specifically:

[0122] When the attribute identifier of the data does not contain subtotal and total identifiers, the data is identified as 0;

[0123] When the attribute identifier of the data contains subtotal and / or total identifier, the data is processed through the back end.

[0124] The purpose of this step is to properly process the unqueried data through the backend and return the processing results to the frontend to ensure the integrity and consistency of the report. Specifically, when the attribute identifier of the data does not contain the words "subtotal" and "total", the data is marked as 0; when the attribute identifier contains the words "subtotal" and / or "total", the corresponding data processing is performed through the backend.

[0125] Specifically, for an inventory summary table, when no data is found, a determination needs to be made based on the attribute identifier for further processing.

[0126] If the attribute identifier does not contain the words "subtotal" and "total", for example, "municipal grain reserve@rice@2022@number of cargo units@region1@enterprise1@this warehouse", it is judged that the relevant data is not provided, and the backend will mark the data as 0 and return the result to the frontend.

[0127] It should be noted that in this step, the data is marked as 0 only to facilitate result feedback or calculation, and is not filled in the sample table.

[0128] If the attribute identifier contains the words "subtotal" and / or "total", it means that a sum calculation is required, and the backend will perform corresponding data processing. For example, if the data identifier is "city reserve grain@rice@subtotal@number of cargo units@region1@enterprise1@this warehouse", the data for 2023 and 2022 need to be summed and the sum result returned to the frontend.

[0129] In this step, the "subtotal" and / or "total" identification words are used to determine whether the data is not provided or needs to be summed. This ensures the consistency of the data processing logic involving "subtotal" and "total" in the report, thereby facilitating automated judgment and processing and improving the automation level of this method.

[0130] In addition, when the attribute identifier does not contain the words "subtotal" and "total", the data is identified as 0. This can prevent missing data when calling the data and maintain data integrity. When processing data, no errors will be generated due to missing data, which improves the stability of this method. Moreover, when the data is identified as 0, it is not filled in the sample table, which improves the authenticity of the report. When viewing the report, users can clearly understand that some data points are not recorded.

[0131] Specifically, when the attribute identifier of the data contains subtotal and / or total identifier, the data is processed by the backend, specifically:

[0132] The attribute identifier includes a first identifier segment formed by sequentially combining the header data in the header area corresponding to the column where the data is located from top to bottom, and a second identifier segment formed by sequentially combining the header data in the header area corresponding to the row where the data is located from left to right;

[0133] Data query and summation processing are performed according to the first identification segment and the second identification segment.

[0134] This step aims to combine the title data in the header area to form an attribute identifier, and divide the attribute identifier into a first identification segment (column header combination) and a second identification segment (row header combination), so as to facilitate data query and summation processing and ensure the accuracy of data positioning.

[0135] Specifically, for the attribute identification of "Municipal grain reserve@rice@2022@number of cargoes@region 1@enterprise 1@this warehouse", the first identification segment is "Municipal grain reserve@rice@2022@number of cargoes", and the second identification segment is "region 1@enterprise 1@this warehouse".

[0136] It should be noted that the first identification segment and the second identification segment are connected by "@", and are divided by recording the number of identification characters in the first identification segment. For example, in the attribute identification of "Municipal Reserve Grain@Rice@2022@Number of Cargo Quantities@Region 1@Enterprise 1@This Warehouse", it is recorded that the first identification segment contains 4 identification characters, then the first 4 identification characters in the attribute identification are combined to form the first identification segment.

[0137] Alternatively, the first identification segment and the second identification segment are connected by other characters, such as “#” or “&”, to distinguish and identify them.

[0138] In this step, by dividing the first identification segment and the second identification segment, the backend can very accurately locate the specific location of the data. This not only improves the accuracy of data query, but also ensures the correctness of the summarized data. For example, when processing "subtotal" and "total" data, the backend can determine the columns to be summarized based on the first identification segment and the rows to be summarized based on the second identification segment, thereby ensuring the accuracy of the summarized data.

[0139] In addition, by dividing the attribute identifier into two parts, the backend processing logic becomes more concise and clear. The first identification segment clarifies the column position of the data, and the second identification segment clarifies the row position of the data, thereby simplifying the data location process. This not only improves the efficiency of data processing, but also reduces the probability of errors.

[0140] Specifically, data query and summation processing are performed according to the first identification segment and the second identification segment, specifically as follows:

[0141] When the first identification segment contains a subtotal identification word, query the data corresponding to the attribute identification words that are the same as the subtotal identification word, and perform sum processing;

[0142] When the first identification segment contains a total identification word, the total identification word in the first identification segment is replaced with a subtotal identification word, and data query is performed based on the subtotal identification word in the first identification segment, the identification word after the subtotal identification word, and the second identification segment, and summation processing is performed.

[0143] This step aims to analyze the "subtotal" and "total" identification words in the attribute identification to determine the content that needs to be summed and perform the summation, thereby improving the accuracy and consistency of data processing.

[0144] Specifically, when the attribute is identified as "Municipal grain reserve@rice@subtotal@number of cargo spaces@region 1@enterprise 1@this warehouse", the first identification segment contains the "subtotal" identification character, and the data corresponding to the attribute identification of "Municipal grain reserve@rice@X@number of cargo spaces@region 1@enterprise 1@this warehouse" (where X is an arbitrary character) is searched. In this embodiment, X is "2023" and "2022", and the search data is 1 and 0. The sum is obtained to obtain the data corresponding to the attribute identification of "Municipal grain reserve@rice@subtotal@number of cargo spaces@region 1@enterprise 1@this warehouse", which is 1.

[0145] When the attribute is identified as "Municipal grain reserve@grain@total@number of cargo spaces@region 1@enterprise 1@this warehouse", "total" is replaced with "subtotal", and data query and processing are performed in combination with the second identification segment, that is, the data with the attribute identification of "X@X@subtotal@number of cargo spaces@region 1@enterprise 1@this warehouse" is queried and summed, which is 1, 4, and 7 in this embodiment, and the sum is obtained to obtain the data corresponding to the attribute identification of "Municipal grain reserve@grain@total@number of cargo spaces@region 1@enterprise 1@this warehouse", which is 12.

[0146] It should be noted that, in the present invention, the data containing the word "subtotal" is firstly summed up, and then the data containing the word "subtotal" is summed up to obtain the data containing the word "total".

[0147] Furthermore, the present invention preferentially processes data containing the words "subtotal" and / or "total" in the first identification segment but not containing the words "subtotal" and "total" in the second identification segment, and then processes data containing the words "subtotal" or "total" in the second identification segment.

[0148] Of course, it is also possible to preferentially process the data containing the words "subtotal" and / or "total" in the second identification segment but not containing the words "subtotal" and "total" in the first identification segment, and then process the data containing the words "subtotal" or "total" in the first identification segment. The present invention is not limited to this.

[0149] In this step, it is possible to avoid the queried data being empty and avoid errors in the sum operation. For example, when the data with the "total" mark is summed first, the data with the "subtotal" mark needs to be called, and at this time the data with the "subtotal" mark is empty, which may cause errors in the sum calculation.

[0150] In addition, when the first identification segment contains a total identification word, the total identification word in the first identification segment is replaced with a subtotal identification word, and data query is performed based on the subtotal identification word in the first identification segment, the identification word after the subtotal identification word, and the second identification segment, and summation processing is performed. Repeated summation calculations are avoided, processing pressure is reduced, and data processing efficiency is improved.

[0151] The sum is calculated starting from the first identification segment, and then the data processing corresponding to the attribute identification containing "subtotal" and / or "total" in the second identification segment is performed, which also avoids the problem of empty data query or repeated calculation.

[0152] The present invention also provides a report rendering system for implementing a custom template, which is implemented based on a SpreadJS table control and includes:

[0153] Title query interface, used to provide title query data to generate report templates;

[0154] The data query interface is used to call the back-end data query and processing, and return the results to the front-end and fill them into the cells of the data area to form a report file.

[0155] By using SpreadJS table controls to implement the report rendering system, the efficiency and quality of report development can be significantly improved. Specifically, the advantages of using SpreadJS table controls to implement the report rendering system are:

[0156] Easy to write: Rich API and documentation support, rich built-in functions, powerful editing functions, visual designers, etc., make report development easier and faster;

[0157] Reduce implementation difficulty: simplify front-end development workload, unified development experience, easy integration of existing systems, high performance and response speed, support for complex data processing, flexible style customization, etc., so that developers can focus more on business logic without worrying about underlying details and technical difficulties.

[0158] Therefore, the report rendering system based on SpreadJS table control is more efficient and reliable, and can better meet the needs of enterprises for data management.

[0159] The title query interface is used to dynamically draw the table header row, and the title query data is returned in the form of a title query array; the data query interface is used to query and process data through the back end according to attribute identifiers, and return the results to the front end to form a report file.

[0160] The report template generation logic is encapsulated in the title query interface, and the data query and processing logic is encapsulated in the data query interface, making the logic of the front-end and back-end clearer and easier to maintain. In addition, the front-end focuses on the generation of report templates, and the back-end focuses on the query and processing of data, realizing the separation of the front-end and back-end and improving the maintainability of the system.

[0161] In addition, users can quickly generate report templates through the title query interface to ensure that the report title data is clear and concise, improving the readability of the report. The backend processes complex data logic and returns the processing results to the frontend for display, ensuring that users can view the report data intuitively, improving the user experience. In addition, the backend processes complex data queries and processing logic, and can quickly return results to the frontend, reducing the user's waiting time and improving the user experience.

[0162] The present invention also provides a computer-readable storage medium, the computer-readable storage medium is used to store computer instructions, the computer instructions are used to enable a computer to execute the report rendering method for implementing a custom template. Therefore, any technical effect in the above-mentioned report rendering method for implementing a custom template can be achieved, which will not be repeated here.

[0163] like Figure 3 As shown, the present invention again provides an electronic device, including:

[0164] Memory 110, for storing computer instructions;

[0165] The processor 120 is used to implement the above method for rendering a report using a custom template when executing the computer instructions. Therefore, any technical effect of the above method for rendering a report using a custom template can be achieved, which will not be described in detail here.

[0166] Anything not described in the present invention can be achieved by adopting or drawing on existing technologies.

[0167] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0168] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A report rendering method for implementing a custom template, the report includes a header area and a data area, characterized in that: The method comprises: Adjusting the header area according to the title query data to generate a report template; Generate an attribute identifier of the data in the data area according to the report template, wherein the attribute identifier is formed by combining the title data in the header area corresponding to the data; Data is queried and processed through the back end according to the attribute identifier, and the result is returned to the front end to form a report file.

2. The report rendering method for implementing a custom template according to claim 1, characterized in that: According to the title query data, the header area is adjusted to generate a report template, specifically: Generate a title query array according to the title query data; According to the number of rows and columns of the title query array, the number of rows and columns of the header area are correspondingly adjusted; According to the coordinates of the title data in the title query array, the title data are filled into the header area one by one.

3. The report rendering method for implementing a custom template according to claim 2, characterized in that: According to the title query data, the header area is adjusted to generate a report template, which also includes: When the cell title data in the header area is consistent with the title data in the adjacent cell, the cell in the header area is merged with the adjacent cell.

4. The report rendering method for implementing a custom template according to claim 1, characterized in that: According to the attribute identifier, data query and processing are performed through the back end, and the results are returned to the front end to form a report file, specifically: According to the attribute identifier, data query is performed through the backend; If data is found, the data is returned to the front end so that the data is filled into the data area according to the attribute identifier; If no data is found, the data is processed by the backend and the results are returned to the frontend.

5. The report rendering method for implementing a custom template according to claim 4, characterized in that: If no data is found, the backend processes the data and returns the result to the frontend. Specifically: When the attribute identifier of the data does not contain subtotal and total identifiers, the data is identified as 0; When the attribute identifier of the data contains subtotal and / or total identifier, the data is processed through the back end.

6. The report rendering method for implementing a custom template according to claim 5, characterized in that: When the attribute identifier of the data contains subtotal and / or total identifier, the data is processed by the backend, specifically: The attribute identifier includes a first identifier segment formed by sequentially combining the header data in the header area corresponding to the column where the data is located from top to bottom, and a second identifier segment formed by sequentially combining the header data in the header area corresponding to the row where the data is located from left to right; Data query and summation processing are performed according to the first identification segment and the second identification segment.

7. The report rendering method for implementing a custom template according to claim 6, characterized in that: The data query and summation processing are performed according to the first identification segment and the second identification segment, specifically: When the first identification segment contains a subtotal identification word, query the data corresponding to the attribute identification words that are the same as the subtotal identification word, and perform sum processing; When the first identification segment contains a total identification word, the total identification word in the first identification segment is replaced with a subtotal identification word, and data query is performed based on the subtotal identification word in the first identification segment, the identification word after the subtotal identification word, and the second identification segment, and summation processing is performed.

8. A report rendering system for implementing a custom template, characterized in that: The report rendering system for implementing a custom template is implemented based on the SpreadJS table control, including: Title query interface, used to provide title query data to generate report templates; The data query interface is used to call the back-end data query and processing, and return the results to the front-end and fill them into the cells of the data area to form a report file.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer instructions, and the computer instructions are used to enable a computer to execute the report rendering method for implementing a custom template as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: include: Memory, for storing computer instructions; A processor is used to implement the report rendering method for implementing a custom template as described in any one of claims 1 to 7 when executing the computer instructions.