SpreadJS report template-based automatic generation method and device
By designing template files and dynamically generating sub-templates, the shortcomings of SpreadJS technology in dynamic form rendering are solved, achieving flexible data display and an efficient user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AISINO CORPORATION
- Filing Date
- 2022-12-21
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies struggle to effectively draw and render an unpredictable number of dynamic forms when using SpreadJS for data display, thus failing to meet the needs of dynamic form web pages.
By designing template files, including non-operable and operable web pages, web pages with a fixed number of forms and dynamically changing forms are dynamically generated. SpreadJS technology is used to generate multiple sub-templates to display data. Combined with the interaction logic between the server and the client, dynamic form rendering is achieved.
It enables flexible display of dynamic forms with an uncertain number of data, reducing the time users spend analyzing complex report data and improving work efficiency and user experience.
Smart Images

Figure CN116384358B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, and more specifically, relates to an automatic generation method and apparatus based on SpreadJS report templates. Background Technology
[0002] As business operations become increasingly diverse and complex, enterprise data volume grows ever more intricate. Users demand higher levels of data visualization, and more users seek a more intuitive understanding of an enterprise's operational status and the flow of its business. Therefore, data visualization and organization have become increasingly urgent. SpreadJS technology emerged in this context. It integrates spreadsheets into various application systems as components, consolidating complex office processes and enabling rapid analysis and organization of office data. SpreadJS provides a high-performance computing engine, optimizing data processing performance and offering rich Excel formulas to transform complex user data into visually appealing reports. This allows users to view and filter data from multiple dimensions, fulfilling various business logic requirements. However, currently, using SpreadJS for data display requires a fixed number of forms, and the report template must be fully drawn before user data can be injected into the webpage. This makes it difficult to draw and render webpages with an uncertain number of dynamic forms. Summary of the Invention
[0003] In view of this, the present invention proposes an automatic generation method and apparatus based on SpreadJS report templates, which realizes the drawing and rendering of web pages with an uncertain number of dynamic forms.
[0004] In a first aspect, this invention proposes an automatic generation method based on SpreadJS report templates, comprising:
[0005] S1: Design using SpreadJS based on the categorized business data and obtain the Excel file;
[0006] The business data includes both non-operable data and operable data;
[0007] The operable data includes operable data that is determined by the template and operable data that is not determined by the template;
[0008] S2: Import the Excel file into the user system and save it as a template, define it as a template file, and pre-set business formulas in the template file;
[0009] The template file includes:
[0010] Inoperable template file: Used to display the inoperable data as an inoperable webpage, in which all buttons are grayed out and pop-ups are disabled;
[0011] Operable template file: used to display the operable data as an operable webpage, the operable webpage including webpages with a fixed number of forms and webpages with a dynamically changing number of forms;
[0012] The webpage with a fixed number of forms is used to display operable data defined by the template;
[0013] The webpage with a dynamically changing number of forms is used to display actionable data with uncertain templates;
[0014] S3: Obtain new business data from the server, classify the new business data, and import the classified new business data into the corresponding template files for display.
[0015] Specifically, the inoperable data in the new business data is directly displayed through the inoperable webpage;
[0016] The operable data determined by the template in the new business data is directly displayed on a webpage with a fixed number of forms.
[0017] For webpages with dynamically changing form counts, the dynamically changing form count is obtained, and the location of the webpage with dynamically changing form counts is determined. The Excel file at that location is used as a copyable parent template, and the parent template is copied while preserving its style and formulas. Based on the obtained form counts and the copied parent template file, multiple sub-templates corresponding to the number of forms are dynamically generated. The webpages with dynamically changing form counts using these multiple sub-templates display the operable data in the new business data, where the template is uncertain.
[0018] Optionally, in step S1, the Excel file includes:
[0019] The document includes a title, content, and user-interactive buttons.
[0020] Optionally, the user-operable button component includes:
[0021] Interactive business button component: used to bind to corresponding functions and establish interactive business logic;
[0022] Click button component: Used to respond to click operations and display a business pop-up window associated with the button component. The pop-up window includes the position, size, page elements, and element style information of the pop-up layer modal box.
[0023] Toggle button component: Used to respond to toggle operations, showing or hiding the module content corresponding to the business logic.
[0024] Optionally, in S3, the method of copying the formula of the parent template includes:
[0025] Copy the formula from the parent template cell using the browser's copy and paste function;
[0026] When the browser's copy and paste function is unavailable, SpreadJS uses its internal copy and paste functionality: the common Sheet object is converted to JSON format data using the common sheet to JSON() method, and then the JSON format data is loaded into the current Spread using the fromJSON method. Finally, the SpreadJS UI behavior is used to copy and paste the formulas from the parent template.
[0027] In a second aspect, the present invention provides an electronic device comprising:
[0028] At least one processor; and,
[0029] A memory communicatively connected to the at least one processor; wherein,
[0030] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the automatic generation method based on SpreadJS report templates as described in any of the first aspects.
[0031] Thirdly, the present invention proposes a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the automatic generation method based on SpreadJS report templates as described in any of the first aspects.
[0032] Fourthly, this invention proposes an automatic generation device based on SpreadJS report templates, comprising:
[0033] Design module: Used to design based on categorized business data using SpreadJS and obtain an Excel file;
[0034] The business data includes both non-operable data and operable data;
[0035] The operable data includes operable data that is determined by the template and operable data that is not determined by the template;
[0036] Import and save module: Used to import the Excel file into the user system and save it as a template, defined as a template file, and pre-set business formulas in the template file;
[0037] The template file includes:
[0038] Inoperable template file: Used to display the inoperable data as an inoperable webpage, in which all buttons are grayed out and pop-ups are disabled;
[0039] Operable template file: used to display the operable data as an operable webpage, the operable webpage including webpages with a fixed number of forms and webpages with a dynamically changing number of forms;
[0040] The webpage with a fixed number of forms is used to display operable data defined by the template;
[0041] The webpage with a dynamically changing number of forms is used to display actionable data with uncertain templates;
[0042] The classification and display module is used to obtain new business data from the server, classify the new business data, and import the classified new business data into the corresponding template files for display.
[0043] Specifically, the inoperable data in the new business data is directly displayed through the inoperable webpage;
[0044] The operable data determined by the template in the new business data is directly displayed on a webpage with a fixed number of forms.
[0045] For webpages with dynamically changing form counts, the dynamically changing form count is obtained, and the location of the webpage with dynamically changing form counts is determined. The Excel file at that location is used as a copyable parent template, and the parent template is copied while preserving its style and formulas. Based on the obtained form counts and the copied parent template file, multiple sub-templates corresponding to the number of forms are dynamically generated. The webpages with dynamically changing form counts using these multiple sub-templates display the operable data in the new business data, where the template is uncertain.
[0046] Optionally, the Excel file includes:
[0047] The document includes a title, content, and user-interactive buttons.
[0048] Optionally, the user-operable button component includes:
[0049] Interactive business button component: used to bind to corresponding functions and establish interactive business logic;
[0050] Click button component: Used to respond to click operations and display a business pop-up window associated with the button component. The pop-up window includes the position, size, page elements, and element style information of the pop-up layer modal box.
[0051] Toggle button component: Used to respond to toggle operations, showing or hiding the module content corresponding to the business logic.
[0052] Optionally, the method of copying the formula of the parent template includes:
[0053] Copy the formula from the parent template cell using the browser's copy and paste function;
[0054] When the browser's copy and paste function is unavailable, SpreadJS uses its internal copy and paste functionality: the common Sheet object is converted to JSON format data using the common sheet to JSON() method, and then the JSON format data is loaded into the current Spread using the fromJSON method. Finally, the SpreadJS UI behavior is used to copy and paste the formulas from the parent template.
[0055] The beneficial effects of this invention are as follows:
[0056] This invention categorizes and processes data to refine user needs, enabling business operations such as adding, deleting, modifying, and viewing details of file data. By copying the parent template of the design template, the number of pre-designed templates can be dynamically changed. Adding and deleting templates allows for the accurate placement of uncertain data into business templates, making data visualization more flexible. This frees client-side business operations from being limited to processing data from predetermined template files, significantly reducing the time users spend analyzing complex report data, improving work efficiency, simplifying page layout linkage methods, meeting diverse user business needs, and enhancing the performance of user terminals.
[0057] The system of the present invention has other features and advantages that will be apparent from or will be set forth in detail in the accompanying drawings and following detailed description, which together serve to explain the particular principles of the invention. Attached Figure Description
[0058] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the invention.
[0059] Figure 1A flowchart illustrating the steps of an automatic generation method for a SpreadJS report template based on Embodiment 1 of the present invention is shown.
[0060] Figure 2 A flowchart illustrating the steps of an automatic generation method based on SpreadJS report templates according to Embodiment 2 of the present invention is shown.
[0061] Figure 3 A schematic diagram of a report template for setting a known number of items is shown according to Embodiment 2 of the present invention.
[0062] Figure 4 A schematic diagram of setting a parent template for a dynamic project according to Embodiment 2 of the present invention is shown.
[0063] Figure 5 A schematic diagram of loading and adjusting template data for project data according to Embodiment 2 of the present invention is shown.
[0064] Figure 6 A schematic diagram showing the report page display of a dynamic project according to Embodiment 2 of the present invention is shown.
[0065] Figure 7 A schematic diagram of a summary report file according to Embodiment 2 of the present invention is shown.
[0066] Figure 8 A schematic diagram illustrating the viewing details of a summary report file according to Embodiment 2 of the present invention is shown. Detailed Implementation
[0067] Preferred embodiments of the invention will now be described in more detail. While preferred embodiments of the invention are described below, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0068] Example 1
[0069] like Figure 1 As shown, this embodiment proposes an automatic generation method based on SpreadJS report templates, including:
[0070] S1: Design using SpreadJS based on the categorized business data and obtain the Excel file;
[0071] The business data includes non-operable data and operable data; operable data includes operable data with a defined template and operable data with an uncertain template; the application data in the business data is non-operable data, and the draft data in the business data is operable data.
[0072] Specifically, the Excel file includes:
[0073] The document includes a title, content, and user-interactive buttons.
[0074] Specifically, the user-operable button components include:
[0075] Interactive business button component: used to bind to corresponding functions and establish interactive business logic;
[0076] Click button component: Used to respond to click operations and display the business pop-up associated with the button component. The pop-up includes the position, size, page elements, and element style information of the pop-up modal box;
[0077] Toggle button component: Used to respond to toggle operations, showing or hiding the module content corresponding to the business logic.
[0078] S2: Import the Excel file into the user's system and save it as a template, define it as a template file, and pre-set business formulas in the template file;
[0079] The template file includes:
[0080] Inoperable template file: Used to display inoperable data as an inoperable webpage, gray out all buttons on the inoperable webpage, and disable pop-ups;
[0081] Operable template files: used to display operable data as operable web pages, which include web pages with a fixed number of forms and web pages with a dynamically changing number of forms;
[0082] A webpage with a fixed number of forms is used to display actionable data defined by a template;
[0083] Web pages with dynamically changing form numbers are used to display actionable data whose template is uncertain;
[0084] Preset business formulas are expressions that perform operations on values in an Excel worksheet. They can perform addition, subtraction, multiplication, and division operations on one or more business values in the table; they can also be used to reference business values.
[0085] S3: Obtain new business data from the server, classify the new business data, and import the classified new business data into the corresponding template files for display.
[0086] The new business data that has been categorized is returned to the front-end interface in the form of an array. The front-end interface corresponds the array index to the template index in sequence, for example, array 1 corresponds to template 1, array 2 corresponds to template 2, and so on.
[0087] Among these, non-operable data in the new business data is directly displayed through non-operable web pages;
[0088] The new business data is displayed directly on a webpage with a fixed number of forms, showing the actionable data defined by the template.
[0089] For web pages with dynamically changing form counts, obtain the dynamically changing form counts, locate the position of the web page with dynamically changing form counts, use the Excel file at that position as a copyable parent template, copy the parent template, and retain the style and formulas of the parent template; based on the obtained form counts and the copied parent template file, dynamically generate multiple sub-templates corresponding to the number of forms, and display the new business data with uncertain operable data through the web page with dynamically changing form counts of multiple sub-templates.
[0090] Specifically, for web pages with dynamically changing form counts, the template positions that such web pages need to reference are recorded, and the template is copied, re-rendered, and rearranged based on the changed web page state to obtain the rendered web page template. The modified web page template is the actual web page template that needs to inject data, used to receive and process data returned from the server. The data returned by the server requires the client to actively send a URL request to the server to obtain the requested data. The client receives and processes the data returned by the server to obtain the processed data, changes the state of web page elements based on the processed data, and thus changes the web page content of the template. Finally, the server data is returned to the predetermined template in sequence. If Vue's monitoring mechanism detects a change in the web page component data, it will trigger a re-render of the page, thereby updating the data rendering, and the user can then intuitively see the data returned by the server on the interface.
[0091] Specifically, in this step, the methods for copying the formulas from the parent template include:
[0092] Copy the formula from the parent template cell using the browser's copy and paste function;
[0093] When the browser's copy and paste function is unavailable, you need to use SpreadJS's internal copy and paste function: convert the common Sheet object to JSON format data using the common sheet to JSON() method, then load the JSON format data into the current Spread using the fromJSON method, and finally use SpreadJS UI behavior to complete the copy and paste of the formula in the parent template.
[0094] Example 2
[0095] like Figure 2As shown, this embodiment proposes an automatic generation method based on SpreadJS report templates, applied to enterprise planning tax report-related business. First, the business to be implemented is analyzed and designed, report functions are categorized, and initial states are set for report data that can be generated according to a certain template. Based on the initial values, the interface to be displayed is rendered. For report templates that cannot be determined in advance, we design the Excel table style and formulas of a pre-made parent template. Then, the drawn parent template is protected by measures such as making it uneditable. Finally, the styles and formulas of the report interface that needs to be generated by referring to the parent template are copied, inheriting the content of the parent template file. It should be noted that the cell formulas of the SpreadJS form cannot be copied using the browser's copy and paste function. To retain the formulas, you need to use SpreadJS's built-in copy and paste functionality. However, copying and pasting within SpreadJS must be done within the same Spread. Therefore, you need to add a common sheet to the current spread. Essentially, this involves converting the common sheet to JSON() and then using from JSON() to import it into the current spread. Finally, you can use SpreadJS's UI behavior to perform the copy and paste. The specific implementation method is as follows:
[0096] 1. Obtain the SSJSON file of the template design and load it into JSON data parsed from the ledger template file. Organize the template files returned by the server, classify the files, and convert the binary file stream into more intuitive JSON data. The specific implementation is as follows:
[0097] getAction(URL.workbookBaseInfo, { standingbookId:this.standingbookId,izEitRd:this.izEitRd,}) .then((res) => {
[0098] if (res.success &&res.result && res.result.length!=0) {
[0099] self.handleWorkbookBaseInfo(res.result)
[0100] return getAction(url, params)
[0101] }else{
[0102] self.$error({
[0103] title: 'Error',
[0104] Content: 'Backend error, returned empty data, unable to analyze related file details',
[0105] okText: 'OK',
[0106] })
[0107] self.visible=false
[0108] self.confirmLoading=false
[0109] return Promise.reject()
[0110] }
[0111] })
[0112] .then((res) => {
[0113] if (res && res.length > 0) {
[0114] this.spread.suspendPaint()
[0115] let json = ungzip(res) / / Decompress
[0116] json = JSON.parse(json) / / Process the returned ssjson file and load the JSON data parsed from the ledger template file
[0117] this.spread.fromJSON(json)
[0118] this.spread.resumePaint()
[0119] self.loadSheetNames()
[0120] } else {
[0121] this.visible = false
[0122] this.confirmLoading=false
[0123] this.$error({
[0124] title: 'Error',
[0125] content: res.message || res.toString() || res || 'Unknown error',
[0126] okText: 'OK',
[0127] })
[0128] }
[0129] }
[0130] 2. Calculate the number of dynamic sheets. By obtaining the number of dynamic sheets, locate the positions of the dynamic sheets, copy the parent template of the design template, retain the style and formulas of the parent template, and dynamically generate multiple child templates. The specific implementation is as follows:
[0131] updataSheetCount(calculateData){
[0132] let params={
[0133] periodId:this.periodId,
[0134] standingbookId:this.standingbookId
[0135] }
[0136] let url=URL.selectRdProject
[0137] getAction(url,params).then(res=>{
[0138] this.projectDataAll=res.result;
[0139] / / Get a new sheet
[0140] this.ledgerSheetNumber = res.result.length;
[0141] let num=this.ledgerSheetNumber;
[0142] Let spread = this.spread;
[0143] console.log('spread============')
[0144] console.log(spread)
[0145] / / Redraw the sheet
[0146] spread.suspendPaint();
[0147] var sheetJson = JSON.stringify(spread.getSheet(1).toJSON());
[0148] for(let i=0;i <num;i++){
[0149] spread.addSheet(i+1);
[0150] spread.getSheet(i+1).fromJSON(JSON.parse(sheetJson));
[0151] spread.getSheet(i+1).name(res.result[i].rdProjectName);
[0152] spread.getSheet(i+1).tables.all()[0].name('ledger'+(i+1));
[0153] this.sheetListDG.splice(i+1,0,{
[0154] sheetName:res.result[i].rdProjectName, / / form name
[0155] sheetIndex:i+1, / / sheet index
[0156] show:true / / Whether the form is displayed
[0157] })
[0158] this.loadingDataStorage.splice(i+1,0,{
[0159] index: i+1,
[0160] dataStartIndex:4,
[0161] description:res.result[i].rdProjectName,
[0162] loaded:false,
[0163] hidden:'0',
[0164] result:[]
[0165] })
[0166] }
[0167] let sheets = this.spread.sheets;
[0168] / / Delete the original R&D auxiliary account template
[0169] spread.removeSheet(num+1);
[0170] this.sheetList = sheets.map((ele) => ele.name())
[0171] spread.resumePaint();
[0172] / / Processing manuscript index values
[0173] for(let i=0;i <this.sheetListDG.length;i++){
[0174] if (this.sheetListDG[i].sheetName == 'Summary Table of Research and Development Expenditure Subsidiary Ledger') {
[0175] this.sheetListDG[i].sheetIndex=num+1;
[0176] }else if(this.sheetListDG[i].sheetName=='Research and Development Expense Additional Deduction Preference Details Audit Form'){
[0177] this.sheetListDG[i].sheetIndex=num+2;
[0178] }
[0179] }
[0180] this.sheetListDG = this.sheetListDG.filter(el => el.sheetName != 'R&D Expenditure Subsidiary Ledger')
[0181] this.sheetList = this.sheetList.filter(el => el != 'R&D Expenditure Subsidiary Ledger')
[0182] this.loadingDataStorage = this.loadingDataStorage.filter(el => el.description != 'R&D Expenditure Subsidiary Account')
[0183] this.sheetListSB[0].sheetIndex=num+3;
[0184] for(let i=0;i <this.loadingDataStorage.length;i++){
[0185] if (this.loadingDataStorage[i].description == 'Summary Table of Research and Development Expenditure Subsidiary Ledger') {
[0186] this.loadingDataStorage[i].index=num+1;
[0187] }else if(this.loadingDataStorage[i].description=='Research and Development Expense Additional Deduction Discount Details Audit Form'){
[0188] this.loadingDataStorage[i].index=num+2;
[0189] }else if(this.loadingDataStorage[i].description=='A107012 R&D Expense Additional Deduction Preference Details'){
[0190] this.loadingDataStorage[i].index=num+3;
[0191] }
[0192] }
[0193] / / console.log(this.loadingDataStorage)
[0194] })
[0195] },
[0196] 3. Reassign the draft and application documents. Based on the initialization state value, bind at least one button component to the corresponding function to establish business logic. Specifically, after obtaining the initialization state value, bind the corresponding function to the at least one button component, that is, bind the business processing logic to reassign the template. The specific implementation is as follows:
[0197] loadSheetNames() {
[0198] const self = this
[0199] if (this.spread) {
[0200] let sheets = this.spread.sheets;
[0201] let ledgerSheetNumber=this.ledgerSheetNumber;
[0202] this.sheetList = sheets.map((ele) => ele.name())
[0203] this.sheetListDG=[]
[0204] for(let i=0;i <ledgerSheetNumber+4;++i){
[0205] this.sheetListDG.push({
[0206] sheetName:this.sheetList[i], / / form name
[0207] sheetIndex:i, / / sheet index
[0208] show:sheets[i].visible() / / Whether the forms are displayed
[0209] })
[0210] }
[0211] this.sheetListSB=[]
[0212] for(let i=ledgerSheetNumber+4;i <sheets.length;++i){
[0213] this.sheetListSB.push({
[0214] sheetName:this.sheetList[i], / / form name
[0215] sheetIndex:ledgerSheetNumber+4, / / form index
[0216] show:sheets[i].visible() / / Whether the forms are displayed
[0217] })
[0218] }
[0219] sheets.forEach((sheet) => {
[0220] sheet.options = Object.assign(sheet.options, this.sheetOptions)
[0221] let defaultStyle = sheet.getDefaultStyle()
[0222] defaultStyle.wordWrap = true
[0223] sheet.setDefaultStyle(defaultStyle)
[0224] sheet.setActiveCell(0,0)
[0225] })
[0226] }
[0227] this.spread.options = Object.assign(this.spread.options,this.spreadOptions)
[0228] if (!this.fileId) {
[0229] / / Handling sheet copying operations
[0230] this.updataSheetCount();
[0231] this.loadAllSheetData(true) / / Retrieves all data via the calculation interface
[0232] } else {
[0233] let params={
[0234] periodId: this.periodId,
[0235] standingbookId: this.standingbookId,
[0236] }
[0237] getAction(URL.rdInformation, params).then((res) => {
[0238] if (res.success) {
[0239] res.result.myLoadDataStorage.forEach(item=>{
[0240] item.dataStartIndex=parseInt(item.dataStartIndex)
[0241] })
[0242] this.loadingDataStorage=res.result.myLoadDataStorage;
[0243] this.sheetListDG=res.result.mySheetListDG;
[0244] this.sheetListSB=res.result.mySheetListSB;
[0245] this.ledgerSheetNumber=res.result.mySheetListDG.length-3;
[0246] / / console.log('=============')
[0247] / / console.log(res.result)
[0248] let length = this.spread.getSheetCount()
[0249] for (let i = 0; i < length; ++i) {
[0250] this.sheet = this.spread.getSheet(i)
[0251] this.readDataFromFileSheet(i)
[0252] }
[0253] this.handleRadioChange(0)
[0254] this.confirmLoading=false
[0255] }})
[0256] Figure 3 This diagram illustrates a report template for setting a known number of items in this embodiment.
[0257] Figure 4 This diagram illustrates how to set the parent template for dynamic projects in this embodiment.
[0258] Figure 5 This diagram illustrates the loading and adjustment of template data for project data in this embodiment.
[0259] Figure 6 This diagram illustrates the display of the report page for dynamic projects in this embodiment.
[0260] Figure 7 A schematic diagram of the summary report file in this embodiment is shown.
[0261] Figure 8 This diagram illustrates the details of viewing the summary report file in this embodiment.
[0262] Example 3
[0263] This disclosure also provides an electronic device, which includes:
[0264] At least one processor; and,
[0265] A memory communicatively connected to the at least one processor; wherein,
[0266] The memory stores instructions that can be executed by the at least one processor, which enables the at least one processor to perform the automatic generation method of the SpreadJS report template in Embodiment 1.
[0267] An electronic device according to embodiments of the present disclosure includes a memory and a processor. The memory is used to store non-transitory computer-readable instructions. Specifically, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc.
[0268] The processor may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of this disclosure, the processor is used to execute computer-readable instructions stored in the memory.
[0269] Those skilled in the art will understand that, in order to solve the technical problem of how to achieve a good user experience, this embodiment may also include well-known structures such as communication buses and interfaces, and these well-known structures should also be included within the protection scope of this disclosure.
[0270] For a detailed description of this embodiment, please refer to the corresponding descriptions in the foregoing embodiments, which will not be repeated here.
[0271] Example 4
[0272] This disclosure provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to execute the automatic generation method based on SpreadJS report templates in Embodiment 1.
[0273] A computer-readable storage medium according to embodiments of the present disclosure stores non-transitory computer-readable instructions. When these non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the methods described in the foregoing embodiments of the present disclosure are performed.
[0274] The aforementioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or portable hard drive), media with built-in rewritable non-volatile memory (e.g., memory card), and media with built-in ROM (e.g., ROM cartridge).
[0275] Example 5
[0276] This embodiment proposes an automatic report template generation device based on SpreadJS, including:
[0277] Design module: Used to design based on categorized business data using SpreadJS and obtain an Excel file;
[0278] Business data includes both non-operable data and operable data;
[0279] Operable data includes operable data that is defined by the template and operable data that is not defined by the template;
[0280] Import and save module: Used to import Excel files into the user's system and save them as templates, defining them as template files and pre-setting business formulas in the template files;
[0281] The template file includes:
[0282] Inoperable template file: Used to display inoperable data as an inoperable webpage, gray out all buttons on the inoperable webpage, and disable pop-ups;
[0283] Operable template files: used to display operable data as operable web pages, which include web pages with a fixed number of forms and web pages with a dynamically changing number of forms;
[0284] A webpage with a fixed number of forms is used to display actionable data defined by a template;
[0285] Web pages with dynamically changing form numbers are used to display actionable data whose template is uncertain;
[0286] The categorization and display module is used to retrieve new business data from the server, categorize the new business data, and import the categorized new business data into the corresponding template files for display.
[0287] Among these, non-operable data in the new business data is directly displayed through non-operable web pages;
[0288] The new business data is displayed directly on a webpage with a fixed number of forms, showing the actionable data defined by the template.
[0289] For web pages with dynamically changing form counts, obtain the dynamically changing form count, locate the position of the web page with dynamically changing form counts, use the Excel file at that position as a copyable parent template, copy the parent template, and retain the style and formulas of the parent template; based on the obtained form count and the copied parent template file, dynamically generate multiple sub-templates corresponding to the number of forms, and display the new business data with uncertain operable templates through the web page with dynamically changing form counts of multiple sub-templates.
[0290] Optionally, the Excel file includes:
[0291] The document includes a title, content, and user-interactive buttons.
[0292] Optionally, user-operable button components include:
[0293] Interactive business button component: used to bind to corresponding functions and establish interactive business logic;
[0294] Click button component: Used to respond to click operations and display the business pop-up associated with the button component. The pop-up includes the position, size, page elements, and element style information of the pop-up modal box;
[0295] Toggle button component: Used to respond to toggle operations, showing or hiding the module content corresponding to the business logic.
[0296] Alternatively, methods for copying formulas from the parent template include:
[0297] Copy the formula from the parent template cell using the browser's copy and paste function;
[0298] When the browser's copy and paste function is unavailable, you need to use SpreadJS's internal copy and paste function: convert the common Sheet object to JSON format data using the common sheet to JSON() method, then load the JSON format data into the current Spread using the fromJSON method, and finally use SpreadJS UI behavior to copy and paste the formulas from the parent template.
[0299] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. An automatic generation method for report templates based on SpreadJS, characterized in that, include: S1: Design using SpreadJS based on the categorized business data and obtain the Excel file; The business data includes both non-operable data and operable data; The operable data includes operable data that is determined by the template and operable data that is not determined by the template; S2: Import the Excel file into the user system and save it as a template, define it as a template file, and pre-set business formulas in the template file; The template file includes: Inoperable template file: Used to display the inoperable data as an inoperable webpage, in which all buttons are grayed out and pop-ups are disabled; Operable template file: used to display the operable data as an operable webpage, the operable webpage including webpages with a fixed number of forms and webpages with a dynamically changing number of forms; The webpage with a fixed number of forms is used to display operable data defined by the template; The webpage with a dynamically changing number of forms is used to display actionable data with uncertain templates; S3: Obtain new business data from the server, classify the new business data, and import the classified new business data into the corresponding template files for display. Specifically, the inoperable data in the new business data is directly displayed through the inoperable webpage; The operable data determined by the template in the new business data is directly displayed on a webpage with a fixed number of forms. For webpages with dynamically changing form counts, the dynamically changing form count is obtained, and the location of the webpage with dynamically changing form counts is determined. The Excel file at that location is used as a copyable parent template, and the parent template is copied while preserving its style and formulas. Based on the obtained form counts and the copied parent template file, multiple sub-templates corresponding to the number of forms are dynamically generated. The webpages with dynamically changing form counts using these multiple sub-templates display the operable data in the new business data, where the template is uncertain.
2. The automatic generation method based on SpreadJS report templates according to claim 1, characterized in that, In step S1, the Excel file includes: The document includes a title, content, and user-interactive buttons.
3. The automatic generation method based on SpreadJS report templates according to claim 2, characterized in that, The user-operable button component includes: Interactive business button component: used to bind to corresponding functions and establish interactive business logic; Click button component: Used to respond to click operations and display a business pop-up window associated with the button component. The pop-up window includes the position, size, page elements, and element style information of the pop-up layer modal box. Toggle button component: Used to respond to toggle operations, showing or hiding the module content corresponding to the business logic.
4. The automatic generation method for report templates based on SpreadJS according to claim 1, characterized in that, In S3, the method for copying the formula of the parent template includes: Copy the formula from the parent template cell using the browser's copy and paste function; When the browser's copy and paste function is unavailable, SpreadJS uses its internal copy and paste functionality: it converts the common Sheet object into JSON format data, loads the JSON data into the current Spread using the fromJSON method, and then uses the SpreadJS UI behavior to copy and paste the formula from the parent template.
5. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the automatic generation method based on SpreadJS report templates as described in any one of claims 1-4.
6. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the automatic generation method based on SpreadJS report templates as described in any one of claims 1-4.
7. An automatic generation device based on SpreadJS report templates, characterized in that, include: Design module: Used to design based on categorized business data using SpreadJS and obtain an Excel file; The business data includes both non-operable data and operable data; The operable data includes operable data that is determined by the template and operable data that is not determined by the template; Import and save module: Used to import the Excel file into the user system and save it as a template, defined as a template file, and pre-set business formulas in the template file; The template file includes: Inoperable template file: Used to display the inoperable data as an inoperable webpage, in which all buttons are grayed out and pop-ups are disabled; Operable template file: used to display the operable data as an operable webpage, the operable webpage including webpages with a fixed number of forms and webpages with a dynamically changing number of forms; The webpage with a fixed number of forms is used to display operable data defined by the template; The webpage with a dynamically changing number of forms is used to display actionable data with uncertain templates; The classification and display module is used to obtain new business data from the server, classify the new business data, and import the classified new business data into the corresponding template files for display. Specifically, the inoperable data in the new business data is directly displayed through the inoperable webpage; The operable data determined by the template in the new business data is directly displayed on a webpage with a fixed number of forms. For webpages with dynamically changing form counts, the dynamically changing form count is obtained, and the location of the webpage with dynamically changing form counts is determined. The Excel file at that location is used as a copyable parent template, and the parent template is copied while preserving its style and formulas. Based on the obtained form counts and the copied parent template file, multiple sub-templates corresponding to the number of forms are dynamically generated. The webpages with dynamically changing form counts using these multiple sub-templates display the operable data in the new business data, where the template is uncertain.
8. The automatic generation device based on SpreadJS report templates according to claim 7, characterized in that, The Excel file includes: The document includes a title, content, and user-interactive buttons.
9. The automatic generation device based on SpreadJS report templates according to claim 8, characterized in that, The user-operable button component includes: Interactive business button component: used to bind to corresponding functions and establish interactive business logic; Click button component: Used to respond to click operations and display a business pop-up window associated with the button component. The pop-up window includes the position, size, page elements, and element style information of the pop-up layer modal box. Toggle button component: Used to respond to toggle operations, showing or hiding the module content corresponding to the business logic.
10. The automatic generation device based on SpreadJS report templates according to claim 7, characterized in that, Methods for copying the formulas of the parent template include: Copy the formula from the parent template cell using the browser's copy and paste function; When the browser's copy and paste function is unavailable, SpreadJS uses its internal copy and paste functionality: it converts the common Sheet object into JSON format data, loads the JSON data into the current Spread using the fromJSON method, and then uses the SpreadJS UI behavior to copy and paste the formula from the parent template.