Document Generation Method, Device, Electronic Device and Medium with Customized Charts
By directly including template charts and identification information in the document, obtaining variable collections and changing style information, the problem of cumbersome and error-prone chart configuration in the existing technology is solved, and a customized chart that is consistent with the template is quickly generated.
Patent Information
- Application Number
- CN202111630001.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-12-28
AI Technical Summary
The prior art is cumbersome and error-prone in generating chart configuration in specific documents, especially when configuring chart styles, which makes the user inconvenient and inefficient.
By directly including template charts and identification information in the document, obtaining variable collections and changing style information according to the initial elements, and directly inserting the tag location, avoiding the cumbersome configuration process under link mode.
It realizes the rapid and easy generation of customized charts consistent with the template chart style, which improves user operation ease and reduces the possibility of configuration errors.
Smart Images

Figure CN114282499B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of document generation. Specifically, it relates to a document method, device, electronic device, and computer-readable storage medium with customized charts. Background Art
[0002] In daily office work, documents are usually used as carriers to display data. Therefore, many business software requires specific documents containing specific format charts.
[0003] In the existing technology, there are mainly the following ways to generate specific documents. The first way is to achieve it through a configuration file. The disadvantage of this technology is that the configuration process is cumbersome. If only the title and chart data are configured, it will be relatively simple. However, if the chart style also needs to be configured, the configuration process will be very cumbersome and error-prone. The second way is to make template charts, mainly by inserting the template charts into the document in a linked manner. The disadvantage of this way is that the document needs to be manually opened and "Yes" or "Update Link" needs to be clicked for the document data to be updated and displayed according to the chart data document. When closing the document, a prompt of "Do you want to save" will also appear, and the same process will be experienced when reopening it next time, which is a cumbersome process. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide a customized chart generation method, device, electronic device, and storage medium, which can quickly and directly generate customized charts in a document without a cumbersome configuration process.
[0005] In a first aspect, the embodiments of this application provide a document generation method with customized charts. The method includes:
[0006] Generate a template document, where the template document includes a template chart and identification information;
[0007] Obtain the underlying storage file corresponding to the template document;
[0008] Obtain the identification information in the underlying storage file;
[0009] Obtain a variable set according to the identification information;
[0010] Obtain the corresponding location of the element in the variable set in the template chart;
[0011] Change the style information of the element according to the initial element corresponding to the element in the template chart;
[0012] Insert the element into the corresponding location of the label.
[0013] In the above implementation process, a document including a template chart is obtained. Different from the prior art, the document directly includes the template chart, and the template chart does not exist in the document in the form of a link, which enables the user not to click frequently during the process of generating a customized chart, improving the simplicity of user operation. According to the identification information, a variable set can be obtained without the user actively obtaining the variable set. By changing the style information of the element according to the initial element corresponding to the element in the template chart, the style of the generated customized chart can be kept consistent with that of the template chart. Based on the above embodiments, a customized chart with the same style as the template chart can be generated quickly and simply.
[0014] Further, the step of generating the template document includes:
[0015] Create an Excel document;
[0016] Create a template chart in the Excel document;
[0017] Create a Word document or a PowerPoint document;
[0018] Copy the template chart to the Word document or the PowerPoint document;
[0019] Insert the identification information into the Word document or the PowerPoint document;
[0020] Save the Word document or the PowerPoint document to obtain the template document.
[0021] In the above implementation process, first, a document including a template chart is obtained. The present application first creates a template chart in an EXCEl document, inserts identification information below the template chart, and then creates a Word document or a PowerPoint document; copies the template chart to the Word document or the document; saves the Word document or the PowerPoint document to obtain the template document. Based on the above embodiments, the Word document or the PowerPoint document includes the template chart and the identification information, and the entire creation process is based on common office software without the need for additional configuration files, and is not prone to errors.
[0022] Further, the step of generating the template document includes:
[0023] Create a Word document or a PowerPoint document;
[0024] Create a template chart in the Word or the PowerPoint document;
[0025] Obtain the data table corresponding to the template chart;
[0026] Insert the identification information into the data table, save the Word document or the PowerPoint document, and obtain the template document.
[0027] In the above implementation process, first create a Word document or a PowerPoint document, then create a template chart in the Word or PowerPoint document, and obtain the data table corresponding to the template chart; insert the identification information into the data table, save the Word document or the PowerPoint document, and obtain a document including the template chart. Based on the above embodiments, the Word document or the PowerPoint document includes a template chart, and the chart template includes identification information. The entire creation process is based on common office software, does not require an additional configuration file, and is not prone to errors.
[0028] Further, the step of obtaining the variable set according to the identification information includes:
[0029] Obtain the variable set according to the identification information;
[0030] Obtain the category series name in the template chart from the underlying storage file;
[0031] Obtain the category series subset and the value series subset from the variable set according to the category series name;
[0032] The step of inserting an element into the corresponding label position includes:
[0033] Insert the elements of the series subset and the elements of the value series subset into their corresponding label positions.
[0034] In the above implementation process, the template chart includes series and the values corresponding to the series. Therefore, the variable set includes two subsets, namely the category series subset and the value series set; the category series name can be obtained in the template chart to obtain the category series subset, and the value series subset can be obtained according to the value series name.
[0035] Further, the step of obtaining the variable set according to the identification information includes:
[0036] Obtain the category series subset and the value series subset according to the identification information;
[0037] The step of inserting an element into the corresponding label position includes:
[0038] Insert the elements of the series subset and the elements of the value series subset into their corresponding label positions.
[0039] In the above implementation process, since the identification information is within the label position corresponding to the template chart, the series sub - set and the value series sub - set can be directly obtained according to the identification information, and the elements of the two sub - sets are inserted into their corresponding label positions to obtain a customized chart.
[0040] Further, the step of changing the style information of the element according to the initial element corresponding to the element in the template chart includes:
[0041] Obtain the initial index of the initial element in the template chart;
[0042] Determine whether the initial index is the same as the set index of the element in the variable set;
[0043] If not, obtain the style text of the initial element from the underlying storage file according to the initial index;
[0044] Modify the index in the style text to the set index.
[0045] In the above implementation process, in order to obtain a customized chart with the same style as the template chart, the key is to keep the style of all replaced elements the same as the style of the initial elements in the template chart. Therefore, obtain the initial index of the initial element in the template chart from the underlying storage file; determine whether the initial index is the same as the set index of the element in the set variable set. If they are the same, it means that the style of the element does not need to be modified. If they are different, modification is required. The specific modification method is to obtain the style text of the initial element from the underlying storage file according to the initial index, and modify the index in the style text to the set index, so as to make the scope of action of the style text point to the label position where it is located.
[0046] Further, there are multiple template charts in the template document;
[0047] The identification information includes serial number information;
[0048] The step of obtaining the variable set according to the identification information includes:
[0049] Obtain the variable set according to the serial number information.
[0050] In the above implementation process, considering that in different office scenarios, different tables are needed to display different data, multiple charts are set in the template chart, and the identification information includes serial number information. In the process of specifically generating a customized chart, the variable set is obtained according to the serial number information, so as to generate a customized chart that meets the requirements.
[0051] In a second aspect, an embodiment of the present application provides a document generation device with a customized chart, including:
[0052] A generation module for generating a template document, where the template document includes a template chart and identification information;
[0053] A bottom-layer storage file acquisition module for acquiring the bottom-layer storage file corresponding to the template document;
[0054] An identification information acquisition module for acquiring identification information in the bottom-layer storage file;
[0055] A variable set acquisition module for acquiring a variable set according to the identification information;
[0056] A location-of-label acquisition module for acquiring the location of the label in the template chart where the element in the variable set is located;
[0057] A style information modification module for modifying the style information of the label location according to the initial element corresponding to the element in the template;
[0058] An insertion module for inserting an element into the location of the label.
[0059] In the above implementation process, a document including a template chart is acquired. Different from the prior art, the document directly includes the template chart, and the template chart does not exist in the document in the form of a link, which makes it unnecessary for the user to click frequently during the process of generating a customized chart, improving the simplicity of user operation. According to the identification information, a variable set can be acquired without the user actively acquiring the variable set. Modifying the style information of the element according to the initial element corresponding to the element in the template chart can make the style of the generated customized chart consistent with that of the template chart. Based on the above embodiments, a customized chart consistent with the style of the template chart can be generated quickly and simply.
[0060] In a third aspect, an electronic device provided in an embodiment of the present application includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method according to any one of the first aspects are implemented.
[0061] In a fourth aspect, a computer-readable storage medium provided in an embodiment of the present application has instructions stored thereon. When the instructions run on a computer, the computer is caused to execute the method according to any one of the first aspects.
[0062] Other features and advantages disclosed in the present application will be described in the subsequent description, or, some features and advantages can be inferred from the description or determined without doubt, or can be learned by implementing the above technologies disclosed in the present application.
[0063] To make the above objects, features, and advantages of the present application more obvious and understandable, the following provides preferred embodiments in conjunction with the accompanying drawings and describes them in detail as follows. Description of the Drawings
[0064] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other relevant drawings can also be obtained based on these drawings.
[0065] Figure 1 Flow diagram of the document generation method with customized charts provided for the embodiments of the present application;
[0066] Figure 2 Flow diagram of the method for generating a template document provided for the embodiments of the present application;
[0067] Figure 3 Schematic diagram of the template chart provided for the embodiments of the present application;
[0068] Figure 4 Another schematic diagram of the template chart provided for the embodiments of the present application;
[0069] Figure 5 Flow diagram of the second method for generating a template document provided for the embodiments of the present application;
[0070] Figure 6 Another schematic diagram of the template chart provided for the embodiments of the present application;
[0071] Figure 7 Another schematic diagram of the template chart provided for the embodiments of the present application;
[0072] Figure 8 Another schematic diagram of the template chart provided for the embodiments of the present application;
[0073] Figure 9 Schematic diagram of the structure of the document device with customized charts provided for the embodiments of the present application;
[0074] Figure 10 Schematic diagram of the structure of the electronic device provided for the embodiments of the present application. Detailed Embodiments
[0075] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application.
[0076] It should be noted that similar reference numerals and letters indicate similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, terms such as "first" and "second" are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0077] Embodiment 1
[0078] Refer to Figure 1 , the embodiment of this application provides a document generation method with customized charts, including:
[0079] S1: Generate a template document, where the template document includes a template chart and identification information;
[0080] S2: Obtain the underlying storage file corresponding to the template document;
[0081] S3: Obtain the identification information in the underlying storage file;
[0082] S4: Obtain a variable set according to the identification information;
[0083] S5: Obtain the location of the label corresponding to the element in the variable set in the template chart;
[0084] S6: Change the style information of the element according to the initial element corresponding to the element in the template chart;
[0085] S7: Insert the element into the location of the corresponding label.
[0086] In the above embodiment, the underlying storage file generally refers to an Extensible Markup Language (XML) document. The variable set is an ordered set composed of multiple elements and has different names in different computer languages. The label location refers to the location corresponding to the element in the variable set in the underlying storage file of the template chart.
[0087] A document including a template chart is obtained. Different from the prior art, the document directly includes the template chart, and the template chart does not exist in the document in a linked manner, which makes it unnecessary for the user to click frequently during the process of generating a customized chart, improving the simplicity of user operation. The variable set can be obtained according to the identification information without the user actively obtaining the variable set. Changing the style information of the element according to the initial element corresponding to the element in the template chart can make the generated customized chart consistent with the style of the template chart. Based on the above implementation, a customized chart consistent with the style of the template chart can be generated quickly and simply.
[0088] Refer to Figure 2, the embodiments of the present application provide two methods for generating a template document. The first method includes:
[0089] S101: Create an Excel document;
[0090] S102: Create a template chart in the Excel document;
[0091] S103: Create a Word document or a PowerPoint document;
[0092] S104: Copy the template chart to the Word document or the PowerPoint document;
[0093] S105: Insert identification information into the Word document or the PowerPoint document;
[0094] S106: Save the Word document or the PowerPoint document to obtain the template document.
[0095] In the above implementation process, first obtain a document including a template chart. The present application first creates a template chart in an EXCEl document, inserts identification information below the template chart, and then creates a Word document or a PowerPoint document; copies the template chart to the Word document or the document; saves the Word document or the PowerPoint document to obtain the template document. Based on the above embodiments, the Word document or the PowerPoint document includes the template chart and the identification information. The entire creation process is based on common office software and does not require additional configuration files, making it not easy to make mistakes.
[0096] Exemplarily, refer to Figure 3 、 Figure 4 , which is a schematic diagram of creating a template chart in Excel and then copying the template chart into a Word document. Figure 4 is adding identification information on the basis of Figure 3 , and the identification information in Figure 4 is ${chart1:data}. In addition, a title identifier ${title} can be inserted into the template chart, and the title variable of the template icon can be obtained according to ${title}.
[0097] Refer to Figure 5 , the second method for generating a template document includes:
[0098] S210: Create a Word document or a PowerPoint document;
[0099] S211: Create a template chart in the Word or PowerPoint document;
[0100] S212: Obtain the data table corresponding to the template chart;
[0101] S213: Insert identification information into the data table, save the Word document or PowerPoint document, and obtain the template document.
[0102] In the above implementation process, first create a Word document or PowerPoint document, then create a template chart in the Word or PowerPoint document, obtain the data table corresponding to the template chart; insert identification information into the data table, save the Word document or PowerPoint document, and obtain the document including the template chart. Based on the above embodiments, the Word document or PowerPoint document includes the template chart, and the chart template includes identification information. The entire creation process is based on common office software, does not require additional configuration files, and is not prone to errors.
[0103] Exemplarily, refer to Figure 6 、 Figure 7 , which is a schematic diagram of creating a template document in PowerPoint using the above method provided by this application. Figure 6 The figure shows the rendering effect of editing and designing the chart in the PowerPoint document, Figure 7 The figure shows a screenshot of the PowerPoint template. It should be noted that Figures 6 to 7 When changing, elements such as "Beijing" are deleted. However, in the underlying storage file, the information of "Beijing" still exists. Figure 7 The identification information in
[0104] This application provides a third method for generating a template document, creating a template chart in Excel, obtaining the data table corresponding to the template chart, and adding identification information to the data table.
[0105] Refer to Figure 8 , in a possible implementation manner, based on the first method for generating a template document above, an implementation manner of S4 provided by an embodiment of this application includes:
[0106] S401: Obtain a variable set according to the identification information;
[0107] S402: Obtain the category series name in the template chart from the underlying storage file;
[0108] S403: Obtain the category series subset and value series subset from the variable set according to the category series name.
[0109] Meanwhile, the present application provides an implementation manner of S5, including: inserting the elements of the series subset and the elements of the value series subset into their corresponding label positions.
[0110] In the above implementation process, the elements of the series subset and the elements of the value series subset are inserted into their corresponding label positions.
[0111] Exemplarily, refer to Figure 4 , first find Table 1 according to ${chart1:data}, and then obtain the variable set according to data. Then, the variable set is divided into a category series subset and a value series subset. Obtain the category subset in the underlying file, and the corresponding category is the region. Thus, obtain the region subset in the variable set, where the elements in the region subset include: Others, Guangdong, Zhejiang, Jiangsu, Beijing, Sichuan, Shanghai, Henan, Fujian, Shandong, Liaoning. Since in the above figure, only two data categories and numerical values are included, the remaining set in the variable set is the value series subset.
[0112] In a possible implementation manner, based on the second method for generating the template document above, an implementation manner of S4 provided by an embodiment of the present application includes: obtaining a category series subset and a value series subset according to identification information;
[0113] The step of inserting elements into the corresponding label positions includes: inserting the elements of the series subset and the elements of the value series subset into their corresponding label positions.
[0114] Exemplarily, refer to Figure 6 , the label positions in the template chart have identification information ${region} and ${sales}, and according to this identification information, the corresponding region subset and sales subset of this column can be obtained.
[0115] It should be noted that in the process of S5, the step of inserting multiple elements into the label positions can be to traverse the rows of the table and fill the elements row by row, or, for each column, traverse and fill by row as the unit.
[0116] In the above implementation process, since the identification information is within the corresponding label position of the template chart, therefore, the series subset and the value series subset can be directly obtained according to the identification information, and the elements of the two subsets are inserted into their corresponding label positions to obtain a customized chart.
[0117] Considering that if only the above steps are performed, once the chart in the PowerPoint document is selected and the Edit Data is clicked in the foreground, the display content of the chart will be restored to the appearance of the PowerPoint template.
[0118] To solve the above problems. In a possible implementation, after S412, it further includes: finding the corresponding underlying storage file in the memory area, and obtaining the identification information in the underlying storage file; obtaining a subset and a value series subset according to the identification information, copying the template row where the identification information is located a first number of times, the first number being the length of the series subset, to obtain the label content corresponding to multiple table rows, and replacing the variables in the label content corresponding to the table rows with the elements in the series subset or the value series subset.
[0119] In a possible implementation, based on the third method of generating a template document above, an embodiment of the present application provides an implementation manner of S4, including:
[0120] Obtaining a category series subset and a value series subset according to the identification information;
[0121] Traversing the label positions of non-formula cells in the underlying storage file, and replacing the identification information with the elements in the variable set.
[0122] In a possible implementation, S6 includes the following sub-steps:
[0123] S601: Obtaining the initial index of the initial element in the template chart;
[0124] S602: Judging whether the initial index is the same as the set index of the element in the variable set; if not, execute S603;
[0125] S603: Obtaining the style text of the initial element in the underlying storage file according to the initial index;
[0126] S604: Modifying the index in the style text to the set index.
[0127] Exemplarily, in the XML document corresponding to the template document <c:dlbls>The content within the label specifies the legend style, and the id within the parentheses specifies the label position corresponding to the style. Figure 6 In the template, Beijing is on the second line of the template chart, with an initial index of 1. If the set index of Beijing in the regional subset is 3, the two are different. Therefore, according to the list index, the initial index in the style text is obtained, and the index of the style text is modified to the set index, so that the color of Beijing in the template chart can be the same as the color of Beijing in the customized chart.
[0128] In the above implementation process, in order to obtain a customized chart with the same style as the template chart, the key is to keep the styles of all replacement elements the same as the styles of the initial elements in the template chart. Therefore, the initial index of the initial element in the template chart is obtained from the underlying storage file; it is judged whether the initial index is the same as the set index of the element in the set variable set. If they are the same, it means that the style of the element does not need to be modified. If they are different, modification is required. The specific modification method is to obtain the style text of the initial element from the underlying storage file according to the initial index, and modify the index in the style text to the set index, so as to make the scope of the style text point to the label position where it is located.
[0129] Furthermore, there are multiple template charts in the template document;
[0130] The identification information includes serial number information;
[0131] The steps for obtaining the set of variables according to the identification information include:
[0132] Obtaining the set of variables according to the serial number information.
[0133] In the above implementation process, considering that in different office scenarios, different tables are needed to display different data, multiple charts are set in the template chart, and the identification information is set to include serial number information. In the process of specifically generating a customized chart, the set of variables is obtained according to the serial number information, so as to generate a customized chart that meets the requirements.
[0134] Exemplarily, see Figure 3 , chart1 in ${chart1:data} is the serial number information.
[0135] Embodiment 2
[0136] See Figure 9 , this application embodiment provides a document generation device with a customized chart, including:
[0137] A generation module 1, configured to generate a template document, where the template document includes a template chart and identification information;
[0138] The underlying storage file acquisition module 2 acquires the underlying storage file corresponding to the template document;
[0139] The identification information acquisition module 3 is used to acquire identification information from the underlying storage file;
[0140] The variable set acquisition module 4 is used to acquire a variable set according to the identification information;
[0141] The location of the label where the element is located acquisition module 5 is used to acquire the location of the label where the element in the variable set is located in the template chart;
[0142] The style information modification module 6 is used to modify the style information of the label location according to the initial element corresponding to the element in the template;
[0143] The insertion module 7 is used to insert the element into the location of the label where it is located.
[0144] In the above embodiment, a document including a template chart is acquired. Different from the prior art, the template chart is directly included in the document, and the template chart does not exist in the document in the form of a link, which makes it unnecessary for the user to click frequently during the process of generating a customized chart, improving the simplicity of user operation. According to the identification information, a variable set can be acquired without the user actively acquiring the variable set. Modifying the style information of the element according to the initial element corresponding to the element in the template chart can make the style of the generated customized chart consistent with that of the template chart. Based on the above implementation manner, a customized chart with the same style as the template chart can be generated quickly and simply.
[0145] In a possible implementation manner, the generation module 1 is used to create an Excel document;
[0146] Create a template chart in the Excel document;
[0147] Create a Word document or a PowerPoint document;
[0148] Copy the template chart to the Word document or the PowerPoint document;
[0149] Insert the identification information into the Word document or the PowerPoint document;
[0150] Save the Word document or the PowerPoint document to obtain a template document.
[0151] In a possible implementation, the generation module 1 is used to create a Word document or a PowerPoint document; create a template chart in the Word or PowerPoint document; obtain the data table corresponding to the template chart; insert identification information into the data table, and save the Word document or the PowerPoint document to obtain a template document.
[0152] In a possible implementation, the variable set acquisition module 4 is used to obtain a variable set according to the identification information; obtain the category series name and the value series name in the template chart from the underlying storage file; obtain the category series subset and the value series subset in the variable set according to the category series name; the insertion module 7 is used to insert the elements of the series subset and the value series subset into their corresponding label positions.
[0153] In a possible implementation, the variable set acquisition module 4 is used to obtain the category series subset and the value series subset according to the identification information;
[0154] The insertion module 7 is further used to insert the elements of the series subset and the value series subset into their corresponding label positions.
[0155] In a possible implementation, the style information change module 6 is further used to obtain the initial index of the initial element in the template chart; determine whether the initial index is the same as the set index of the element in the variable set; if not, obtain the style text of the initial element from the underlying storage file according to the initial index; modify the index in the style text to the set index.
[0156] In a possible implementation, obtain the variable set according to the serial number information.
[0157] Embodiment 3
[0158] This application also provides an electronic device. Please refer to Figure 10 , Figure 10 which is a structural block diagram of an electronic device provided by an embodiment of this application. The electronic device may include a processor 101, a communication interface 102, a memory 103, and at least one communication bus 104. Among them, the communication bus 104 is used to realize the direct connection communication between these components. Among them, the communication interface 102 of the electronic device in the embodiment of this application is used to communicate with other node devices for signaling or data. The processor 101 may be an integrated circuit chip with signal processing capabilities.
[0159] The above-mentioned processor 101 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor 101 may also be any conventional processor, etc.
[0160] The memory 103 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 103 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 101, the electronic device can execute each step involved in the above method embodiments.
[0161] Optionally, the electronic device may further include a storage controller and an input / output unit.
[0162] The memory 103, the storage controller, the processor 101, the peripheral interface, and the input / output unit are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 104. The processor 101 is used to execute the executable module stored in the memory 103, such as the software function module or computer program included in the electronic device.
[0163] The input / output unit is used to provide the user with the ability to create tasks and create a start optional period or a preset execution time for the task to achieve interaction between the user and the server. The input / output unit may be, but is not limited to, a mouse, a keyboard, etc.
[0164] It can be understood that Figure 10 The structure shown is only schematic, and the electronic device may further include more or fewer components than Figure 10 shown therein, or have a structure different from Figure 10 The different configurations shown. Figure 10 Each component shown in can be implemented by hardware, software, or a combination thereof.
[0165] The embodiments of the present application also provide a computer-readable storage medium, on which instructions are stored. When the instructions run on a computer, the computer program, when executed by a processor, implements the method described in the method embodiments. To avoid repetition, it will not be elaborated here.
[0166] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the drawings show the possible architectures, functions, and operations of the apparatus, method, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0167] In addition, in each embodiment of the present application, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0168] If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs, etc., which can store program codes.
[0169] The above are only embodiments of the present application and are not intended to limit the protection scope of the present application. For those skilled in the art, various modifications and changes can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application. It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0170] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, and all of them should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0171] It should be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.< / c:dlbls>
Claims
1. A document generation method with customized charts, characterized in that, Including: Generate a template document, where the template document includes a template chart and identification information; Obtain the underlying storage file corresponding to the template document; Obtain the identification information in the underlying storage file; Obtain a variable set according to the identification information; Obtain the corresponding location of the element in the variable set in the template chart; Change the style information of the element according to the initial element corresponding to the element in the template chart; Insert the element into the corresponding location; The step of generating the template document includes: Create a Word document or a PowerPoint document; Create a template chart in the Word or PowerPoint document; Obtain the data table corresponding to the template chart; Insert the identification information into the data table, save the Word document or the PowerPoint document, and obtain the template document; The step of obtaining the variable set according to the identification information includes: Obtain a category series subset and a value series subset according to the identification information; The step of inserting the element into the corresponding location includes: Insert the elements of the series subset and the elements of the value series subset into their corresponding locations in the template chart; Find the corresponding underlying storage file in the memory area, obtain the identification information in the underlying storage file, obtain the subset and the value series subset according to the identification information, copy the template row where the identification information is located by a first quantity, the first quantity is the length of the series subset, to obtain the label contents corresponding to multiple table rows, and replace the variables in the label contents corresponding to the table rows with the elements in the series subset or the value series subset.
2. The method for generating a document with a customized chart according to claim 1, wherein The step of generating the template document includes: Create an Excel document; Create a template chart in the Excel document; Create a Word document or a PowerPoint document; Copy the template chart to the Word document or the PowerPoint document; Insert the identification information into the Word document or the PowerPoint document; Save the Word document or the PowerPoint document to obtain the template document.
3. The method for generating a document with a customized chart according to claim 2, wherein The step of obtaining the variable set according to the identification information includes: Obtain the variable set according to the identification information; Obtain the category series name in the template chart in the underlying storage file; Obtain a category series subset and a value series set in the variable set according to the category series name; The step of inserting the element into the corresponding location includes: Insert the elements of the series subset and the elements of the value series subset into their corresponding upper locations.
4. The method for generating a document with a customized chart according to any one of claims 1-3, characterized in that, The step of changing the style information of the element according to the initial element corresponding to the element in the template chart includes: Obtain the initial index of the initial element in the template chart; Determine whether the initial index is the same as the set index of the element in the variable set; Otherwise, obtain the style text of the initial element from the underlying storage file according to the initial index; Modify the index in the style text to the set index.
5. The method for generating a document with a customized chart according to claim 4, wherein There are multiple template charts in the template document; The identification information includes serial number information; The step of obtaining the variable set according to the identification information includes: Obtain the variable set according to the serial number information.
6. A document generation device with customized charts, characterized in that, including: A generation module for generating a template document, the template document including a template chart and identification information; An underlying storage file acquisition module for acquiring the underlying storage file corresponding to the template document; An identification information acquisition module for acquiring identification information from the underlying storage file; A variable set acquisition module for acquiring a variable set according to the identification information; A location-of-label acquisition module for acquiring the location of the element in the variable set in the template chart where the label is located; A style information modification module for modifying the style information of the label location according to the initial element corresponding to the element in the template; An insertion module for inserting an element into the location where the label is located; The generation module is specifically used for: Create a Word document or a PowerPoint document; Create a template chart in the Word or PowerPoint document; Obtain the data table corresponding to the template chart; Insert the identification information into the data table, save the Word document or the PowerPoint document, and obtain the template document; The variable set acquisition module is specifically used for: Obtain a category series subset and a value series subset according to the identification information; The insertion module is specifically used for: Insert the elements of the series subset and the elements of the value series subset into their corresponding locations where the label is located; Find the corresponding underlying storage file in the memory area, obtain the identification information from the underlying storage file, obtain the subset and the value series subset according to the identification information, copy the template row where the identification information is located by a first quantity, the first quantity being the length of the series subset, to obtain the label content corresponding to multiple table rows, and replace the variables in the label content corresponding to the table rows with the elements in the series subset or the value series subset.
7. An electronic device, characterized in that, including: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating a customized chart according to any one of claims 1-6 is implemented.
8. A computer-readable storage medium, characterized in that, Instructions are stored on the computer-readable storage medium, and when the instructions run on the computer, the computer is caused to execute the method for generating a customized chart according to any one of claims 1-6.
Citation Information
Patent Citations
Method and device for generating arbitration electronic documents
CN111145051A