WO2019119624A1 - 基于Excel表的计算方法、装置、设备及存储介质 - Google Patents

基于Excel表的计算方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2019119624A1
WO2019119624A1 PCT/CN2018/075011 CN2018075011W WO2019119624A1 WO 2019119624 A1 WO2019119624 A1 WO 2019119624A1 CN 2018075011 W CN2018075011 W CN 2018075011W WO 2019119624 A1 WO2019119624 A1 WO 2019119624A1
Authority
WO
WIPO (PCT)
Prior art keywords
excel
java
calculation
formula
value
Prior art date
Application number
PCT/CN2018/075011
Other languages
English (en)
French (fr)
Inventor
储斌
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019119624A1 publication Critical patent/WO2019119624A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Definitions

  • the present application relates to the field of computer technology, and in particular, to a calculation method, device, device, and storage medium based on an Excel table.
  • the calculation of many product quotations is done through the Excel table, that is, the quotation related data is first recorded in the Excel table, and then the quotation is automatically calculated by the calculation function provided by Excel.
  • the way Excel calculates quotes is generally: first through poi (poi is a powerful office operation component that provides an application programming interface to Java programs to Microsoft The Office format file performs read and write functions.
  • the Excel table is parsed, and the value of the target cell is calculated according to the target calculation formula.
  • the above calculation process will iterate the cells of Excel.
  • the above calculation process will generate a lot of Java calculation objects, and the generated objects will occupy a large amount of memory.
  • the garbage collection mechanism of the Java virtual machine will be Constantly scan objects that can be reclaimed in memory, and before the calculation results come out, these calculated objects are all referenced and cannot be recycled. Therefore, backlog in memory can easily cause system downtime and result in inefficient calculation.
  • the main purpose of the present application is to provide an Excel table-based calculation method, device, device and computer readable storage medium, which aims to reduce the memory consumption in the Excel table calculation process and improve the calculation efficiency.
  • the present application provides a calculation method based on an Excel table, the method comprising the following steps:
  • the Java method corresponding to the sub-formula is invoked according to the correspondence between the formula function of the preset Excel macro and the Java method, and the value of the Java object is substituted into the Java method for calculation, and the target calculation is obtained.
  • the present application further provides a computing device based on an Excel table, the device comprising:
  • a splitting module configured to acquire a target calculation formula when the calculation instruction is received, and split the target calculation formula into a plurality of sub-formulas
  • An obtaining module configured to read a configuration file of the Excel table, locate a Java object in the sub-form in the configuration file according to a preset MAP collection class, and obtain a value of the Java object;
  • a calculation module configured to invoke a Java method corresponding to the sub-form according to a correspondence between a formula function of the preset Excel macro and a Java method, and substitute the value of the Java object into the Java method for calculation, A calculation result of the target calculation formula is obtained, wherein the Java method is used to represent an operation rule based on the Java object.
  • the present application further provides an Excel table-based computing device, the device comprising: a memory, a processor, and an Excel-based table stored on the memory and operable on the processor A calculation program that implements the steps of the Excel table-based calculation method as described above when executed by the processor by the Excel table.
  • the present application further provides a computer readable storage medium, where the Excel table-based calculation program is stored, and the Excel table-based calculation program is implemented by a processor. The steps of the Excel table based calculation method as described above.
  • the application When receiving the calculation instruction, the application obtains the target calculation formula, and splits the target calculation formula into a plurality of sub-formulas; reads the configuration file of the Excel table, and locates the configuration file in the configuration file according to the preset MAP collection class. Determining a Java object in the formula, and obtaining a value of the Java object; calling a Java method corresponding to the sub-form according to a correspondence between a formula function of the preset Excel macro and a Java method, the Java method The value of the object is substituted into the Java method for calculation, and the calculation result of the target calculation formula is obtained, wherein the Java method is used to represent an operation rule based on the Java object.
  • the present application separates the target calculation formula, and then calculates the value of each sub-formula according to the preset Java method, and obtains the final calculation result.
  • the calculation method avoids multiple times for the Excel cell. After iteration, and the calculation of the sub-form is completed, the corresponding calculation object can be recovered normally, thereby reducing the memory consumption in the Excel table calculation process and improving the calculation efficiency.
  • FIG. 1 is a schematic structural diagram of a terminal in a hardware operating environment involved in a solution according to an embodiment of the present application
  • FIG. 2 is a schematic flow chart of a first embodiment of a calculation method based on an Excel table according to the present application
  • FIG. 3 is a schematic flow chart of a second embodiment of a calculation method based on an Excel table according to the present application
  • FIG. 4 is a schematic flow chart of a third embodiment of a calculation method based on an Excel table according to the present application.
  • FIG. 5 is a schematic diagram showing the refinement step of step S22 in FIG. 4.
  • the main solution of the embodiment of the present application is: when receiving the calculation instruction, acquiring the target calculation formula, splitting the target calculation formula into a plurality of sub-formulas; reading the configuration file of the Excel table according to the preset MAP collection class Locating the Java object in the sub-formula in the configuration file, and acquiring the value of the Java object; calling the sub-form corresponding to the correspondence between the formula function of the preset Excel macro and the Java method a Java method for substituting the value of the Java object into the Java method for calculation, and obtaining a calculation result of the target calculation formula, wherein the Java method is used to represent an operation rule based on the Java object.
  • the existing Excel-based calculation process will iterate the cells of Excel.
  • the above calculation process will generate a lot of Java calculation objects, and the generated objects will occupy a large amount of memory.
  • Java virtual The machine's garbage collection mechanism will continuously scan the objects that can be recycled in the memory. Before the calculation results come out, these calculated objects are all referenced and cannot be recycled. Therefore, the backlog in the memory can easily cause the system to crash. Lead to inefficient calculations.
  • the present application separates the target calculation formula, and then calculates the value of each sub-formula according to the preset Java method, and obtains the final calculation result.
  • the calculation method avoids multiple times for the Excel cell. After iteration, and the calculation of the sub-form is completed, the corresponding calculation object can be recovered normally, thereby reducing the memory consumption in the Excel table calculation process and improving the calculation efficiency.
  • the application provides a calculation method based on an Excel table.
  • FIG. 1 is a schematic structural diagram of a terminal in a hardware operating environment involved in an embodiment of the present application.
  • the terminal in the embodiment of the present application may be a PC, or may be a portable terminal device having a display function, such as a smart phone or a tablet portable computer.
  • the terminal may include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection communication between these components.
  • the user interface 1003 can include a display, an input unit such as a keyboard, and the optional user interface 1003 can also include a standard wired interface, a wireless interface.
  • the network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage.
  • the memory 1005 can also optionally be a storage device independent of the aforementioned processor 1001.
  • the terminal may further include a camera, RF (Radio) Frequency, RF) circuits, sensors, audio circuits, WiFi modules, and more.
  • sensors such as light sensors, motion sensors, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display according to the brightness of the ambient light, and the proximity sensor may turn off the display and/or when the mobile terminal moves to the ear. Backlighting.
  • the gravity acceleration sensor can detect the magnitude of acceleration in each direction (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the mobile terminal (such as horizontal and vertical screen switching, Related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. No longer.
  • terminal structure shown in FIG. 1 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements.
  • a memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a calculation program based on an Excel table.
  • the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server;
  • the user interface 1003 is mainly used to connect the client (user end), and perform data communication with the client;
  • the processor 1001 may be used to call an Excel table-based calculation program stored in the memory 1005, and perform the following operation operations in the Excel table-based calculation method embodiment.
  • FIG. 2 is a schematic flowchart diagram of a first embodiment of a method for calculating an Excel table according to the present application, where the method includes:
  • Step S10 when receiving the calculation instruction, acquiring a target calculation formula, and splitting the target calculation formula into a plurality of sub-formulas;
  • Excel is a common commercial office software. Its own computing function provides great convenience for users to statistically analyze data. However, with the development of business, some target parameters (such as quotation, investment, income) are calculated. The formula is also more and more complicated, and the conventional Excel table-based calculation method can not meet the calculation requirements of the complex formula. For this reason, the present embodiment provides a new calculation method based on the Excel table.
  • the terminal when displaying the Excel table, receives the calculation instruction of the user based on the target cell, and acquires a target calculation formula carried in the calculation instruction, wherein the target calculation formula is pre-edited by the user according to the formula edit format of Excel. After obtaining the target calculation formula, the terminal splits the target calculation formula into several independent sub-formulas. In the specific implementation, the split rule and the number of split sub-formulas can be flexibly set in advance. For example, the terminal may split the target calculation formula according to the type of the formula function in the Excel macro. When the target calculation formula is composed of four operation rules of addition, subtraction, multiplication, and division, the target calculation formula may be split into plus.
  • the target calculation formula can also be split into two sub-formulas, one of which contains addition and subtraction, and the other sub-form contains multiplication and division. Operation.
  • Step S20 reading a configuration file of the Excel table, locating the Java object in the sub-form in the configuration file according to a preset MAP collection class, and acquiring the value of the Java object;
  • the terminal can pass SAX (Simple API for XML) reads the configuration file of the Excel table, which contains the cell information in the Excel table and the content information in the cell.
  • SAX is both an interface and a software package.
  • SAX is different from DOM parsing. It scans documents line by line, parsing while scanning, and because it only parses data when reading data, it does not need to store all data in memory. This is a huge advantage for the parsing of large documents. By parsing Excel through SAX, the entire Excel will not be loaded into memory, and it will not take up a lot of Java virtual machine memory.
  • the terminal locates the Java object in the sub-form in the configuration file according to the preset MAP collection class, and obtains the value of the Java object.
  • the MAP collection class is one of the most commonly used collection classes in Java.
  • the elements in the MAP collection class are stored in the form of key-value pairs, and each key corresponds to the same or different key values.
  • the manner of locating the Java object in the sub-formula according to the preset MAP collection class may be: first, converting the label used to identify the Excel cell in the Excel configuration file into a key value defined in the MAP collection class, for example, Excel
  • the label of a certain identification cell in the configuration file is sheet1, D4, and can be converted into the key value form of Calculation, BP, 4 according to the key type defined in the MAP collection class, and then the key value obtained according to the conversion is located.
  • the Java object in the sub-formula and obtain the value of the Java object. For example, for a Java object in the sub-formula, Calculation!$BP$4, you can directly locate the value according to the MAP level.
  • the first layer takes the key value as the Calculation. In the sheet page, the second layer takes the BP column, and the third layer takes the value of the fourth row, thereby obtaining the value of the Java object.
  • Step S30 according to the correspondence between the formula function of the preset Excel macro and the Java method, calling the Java method corresponding to the sub-form, substituting the value of the Java object into the Java method for calculation, and obtaining the The calculation result of the target calculation formula, wherein the Java method is used to represent an operation rule based on the Java object.
  • the terminal invokes the Java method corresponding to the sub-form according to the correspondence between the formula function of the preset Excel macro and the Java method, for example, the formula function of the sub-form is required to calculate the sub-form, and the formula function of the Excel macro is SUMPRODUCT (condition) Summation, you can call the corresponding "excelFunSUMPRODUCT" Java method, which also implements conditional summation. Then, the value of the Java object in step S20 is substituted into the above Java method for calculation, and the value of each sub-formula is obtained, and then the calculation result of the target calculation formula is obtained.
  • each sub-formula the process of calculating the values of each sub-formula is independent of each other and does not affect each other.
  • the Java virtual machine's garbage collection mechanism can recover the Java objects in the sub-formula. This avoids a large number of Java objects in the memory backlog, ensuring the smooth progress of the calculation process.
  • the method may further include the step of: displaying the calculation result in a user interaction interface of the Excel table.
  • the result value can be displayed on the user interaction interface of the Excel table.
  • the calculated final quotation can be displayed on the result page of the user upload page for the user to refer to.
  • the target calculation formula when receiving the calculation instruction, acquiring the target calculation formula, splitting the target calculation formula into a plurality of sub-formulas; reading the configuration file of the Excel table, according to the preset MAP collection class in the configuration Positioning the Java object in the sub-formula in the file, and obtaining the value of the Java object; calling the Java method corresponding to the sub-form according to the correspondence between the formula function of the preset Excel macro and the Java method, Substituting the value of the Java object into the Java method for calculation, and obtaining a calculation result of the target calculation formula.
  • the target calculation formula is split, and then the value of each sub-formula is separately calculated according to a preset Java method, and the final calculation result is obtained.
  • the calculation method avoids more Excel cells. After the iteration, and the calculation of the sub-form is completed, the corresponding calculation object can be recovered normally, thereby reducing the memory consumption in the Excel table calculation process and improving the calculation efficiency.
  • FIG. 3 is a schematic flowchart of a second embodiment of a calculation method based on an Excel table according to the present application. Based on the embodiment shown in FIG. 2, before step S10, the method may further include:
  • Step S40 acquiring a formula function of the Excel macro, and compiling the formula function into a corresponding Java method
  • the developer needs to exhaust all the formula functions of the excel macro, and then compile it into the corresponding java method.
  • the terminal can obtain the formula function of the Excel macro according to the compiler instruction of the developer, and compile the corresponding Java method, for example, the method of compiling the formula function “SUMPRODUCT” in excel into “excelFunSUMPRODUCT”, etc. , thus rewriting all formula functions in the excel macro to java methods.
  • Step S50 establishing a correspondence between the formula function and the Java method.
  • the subsequent terminal can calculate the value of the target formula through the newly compiled Java method, thereby avoiding the formula function directly using the excel macro.
  • FIG. 4 is a schematic flowchart of a third embodiment of a calculation method based on an Excel table according to the present application. Based on the embodiment shown in FIG. 2 above, step S20 may include:
  • Step S21 reading a configuration file of the Excel table, and identifying a label in the configuration file for identifying an Excel cell;
  • the terminal first reads the configuration file of the Excel table, and identifies the label used to identify the Excel cell in the configuration file.
  • the label “sheet1, D4” indicates the cell located in the fourth row of column D of sheet1;
  • Step S22 converting the label into a key value defined in a preset MAP collection class
  • Step S23 converting the Java object in the sub-formula into a corresponding key value according to a correspondence between a preset key value and a Java object;
  • Step S24 matching the key value converted by the tag with the key value converted by the Java object, to obtain an Excel cell corresponding to the Java object in the configuration file, and the The value of the Excel cell is taken as the value of the Java object.
  • the terminal converts the above label into a key value defined in the preset MAP collection class, so as to calculate the value later, for example, the label "sheet1, D4" can be converted into the key value form of Calculation, BP, 4;
  • the mapping between the preset key value and the Java object converts the Java object in the sub-formula into a corresponding key value. For example, for the Java object Calculation!$BP$4 in the sub-form, it can be converted into a corresponding key.
  • the key value converted by the tag is matched with the key value converted by the Java object to obtain an Excel cell corresponding to the Java object in the configuration file, and the The value of the Excel cell is used as the value of the Java object.
  • the key value obtained by converting the label sheet1, D4" is Calculation, BP, 4, and the key value of the Java object Calculation!$BP$4 converted in the sub-formula For the same as Calculation, BP, 4, the two match.
  • the Excel cell corresponding to the Java object Calculation!$BP$4 in the Excel table configuration file "sheet1, D4" can be obtained. , I.e., a cell at row 4 column D, i.e., the value of the cell as Java objects Calculation! $ BP value of $ 4.
  • FIG. 5 is a schematic diagram of the refinement step of step S22 in FIG. 4, and step S22 may include:
  • Step S221 respectively acquiring characters of the label for identifying the number of pages, columns, and rows of the Excel cell and the values of the corresponding Excel cells;
  • Step S222 converting the character into a preset key type of the MAP set class for indicating the number of pages, the number of columns, and the number of rows of the Excel table, and converting according to the value of the Excel cell.
  • the key type is assigned.
  • the obtained label "sheet1, D4" and its corresponding cell takes a value of 100
  • the defined key type includes page, column, and row
  • the defined key type includes page, column, and row
  • the first layer of Calculation represents sheet1 page
  • the second layer of BP represents column D
  • the third layer Represents row 4 of column D, and then assigns the value of Calculation, BP, 4 to 100.
  • the application also provides a computing device based on an Excel table, the device comprising:
  • a splitting module configured to acquire a target calculation formula when the calculation instruction is received, and split the target calculation formula into a plurality of sub-formulas
  • An obtaining module configured to read a configuration file of the Excel table, locate a Java object in the sub-form in the configuration file according to a preset MAP collection class, and obtain a value of the Java object;
  • a calculation module configured to invoke a Java method corresponding to the sub-form according to a correspondence between a formula function of the preset Excel macro and a Java method, and substitute the value of the Java object into the Java method for calculation, A calculation result of the target calculation formula is obtained, wherein the Java method is used to represent an operation rule based on the Java object.
  • the device further includes:
  • a compiling module configured to obtain a formula function of the Excel macro, compiling the formula function into a corresponding Java method
  • a module is created for establishing a correspondence between the formula function and the Java method.
  • the obtaining module is further configured to:
  • the obtaining module is further configured to:
  • the device further includes:
  • a display module configured to display the calculation result in a user interaction interface of the Excel table.
  • the application also provides a computer readable storage medium.
  • the computer readable storage medium of the present application stores a calculation program based on an Excel table, and the Excel table-based calculation program is executed by the processor to implement the steps of the Excel table-based calculation method as described above.
  • the method implemented when the Excel table-based calculation program running on the processor is executed may refer to various embodiments of the calculation method based on the Excel table in the present application, and details are not described herein again.
  • the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM as described above). , a disk, an optical disk, including a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in the various embodiments of the present application.
  • a terminal device which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

一种基于Excel表的计算方法、计算装置、设备和一种计算机可读存储介质,该方法包括:当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式(S10);读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值(S20);按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则(S30)。该方法能够缩减Excel表计算过程中对内存的消耗,同时提高计算效率。

Description

基于Excel表的计算方法、装置、设备及存储介质
本申请要求于2017年12月21日提交中国专利局、申请号为201711415048.9、发明名称为“基于Excel表的计算方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及基于Excel表的计算方法、装置、设备及存储介质。
背景技术
目前很多产品报价的计算是通过Excel表完成的,即首先将报价相关数据记录在Excel表中,然后通过Excel提供的运算功能自动计算报价。Excel表计算报价的方式一般为:首先通过poi(poi是一种强大的office操作组件,其提供应用程序编程接口给Java程序对Microsoft Office格式档案进行读和写的功能)解析Excel表,进而根据目标计算公式计算目标单元格的值。
上述计算过程会对Excel的单元格进行迭代,当报价计算公式很复杂时,上述计算过程会由此产生很多Java计算对象,产生的对象将大量占用内存,此时Java虚拟机的垃圾回收机制会不断扫描内存中可以回收的对象,而在计算结果出来前,这些计算的对象都是被引用的,无法进行回收,因此在内存中积压,很容易造成系统宕机,且导致计算效率低下。
发明内容
本申请的主要目的在于提出一种基于Excel表的计算方法、装置、设备及计算机可读存储介质,旨在缩减Excel表计算过程中对内存的消耗,同时提高计算效率。
为实现上述目的,本申请提供一种基于Excel表的计算方法,所述方法包括如下步骤:
当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
此外,为实现上述目的,本申请还提供一种基于Excel表的计算装置,所述装置包括:
拆分模块,用于当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
获取模块,用于读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
计算模块,用于按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
此外,为实现上述目的,本申请还提供一种基于Excel表的计算设备,所述设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的基于Excel表的计算程序,所述基于Excel表的计算程序被所述处理器执行时实现如上所述的基于Excel表的计算方法的步骤。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有基于Excel表的计算程序,所述基于Excel表的计算程序被处理器执行时实现如上所述的基于Excel表的计算方法的步骤。
本申请当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。本申请通过对目标计算公式进行拆分,进而根据预设的Java方法分别计算每个子公式的值,并得到最终计算结果,相对于现有技术,该计算方式避免了对Excel单元格进行多次迭代,且子公式计算完成后,相应的计算对象可以被正常回收,从而缩减了Excel表计算过程中对内存的消耗,同时提高了计算效率。
附图说明
图1是本申请实施例方案涉及的硬件运行环境的终端结构示意图;
图2为本申请基于Excel表的计算方法第一实施例的流程示意图;
图3为本申请基于Excel表的计算方法第二实施例的流程示意图;
图4为本申请基于Excel表的计算方法第三实施例的流程示意图;
图5为图4中步骤S22的细化步骤示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例的主要解决方案是:当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
现有的基于Excel表的计算过程会对Excel的单元格进行迭代,当报价计算公式很复杂时,上述计算过程会由此产生很多Java计算对象,产生的对象将大量占用内存,此时Java虚拟机的垃圾回收机制会不断扫描内存中可以回收的对象,而在计算结果出来前,这些计算的对象都是被引用的,无法进行回收,因此在内存中积压,很容易造成系统宕机,且导致计算效率低下。
本申请通过对目标计算公式进行拆分,进而根据预设的Java方法分别计算每个子公式的值,并得到最终计算结果,相对于现有技术,该计算方式避免了对Excel单元格进行多次迭代,且子公式计算完成后,相应的计算对象可以被正常回收,从而缩减了Excel表计算过程中对内存的消耗,同时提高了计算效率。
本申请提供一种基于Excel表的计算方法。
如图1所示,图1是本申请实施例方案涉及的硬件运行环境的终端结构示意图。
本申请实施例终端可以是PC,也可以是智能手机、平板电脑便携计算机等具有显示功能的可移动式终端设备。
如图1所示,该终端可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
优选地,终端还可以包括摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。其中,传感器比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示屏的亮度,接近传感器可在移动终端移动到耳边时,关闭显示屏和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别移动终端姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;当然,移动终端还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
本领域技术人员可以理解,图1中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及基于Excel表的计算程序。
在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的基于Excel表的计算程序,并执行以下基于Excel表的计算方法实施例中的操作操作。
基于上述硬件结构,提出本申请基于Excel表的计算方法实施例。
参照图2,图2为本申请基于Excel表的计算方法第一实施例的流程示意图,所述方法包括:
步骤S10,当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
Excel是目前常见的商业办公软件,其自带的计算功能为用户对数据进行统计分析提供了极大的方便,然而,随着商业的发展,一些目标参数(如报价、投资、收益)的计算公式也越来越复杂,常规的基于Excel表的计算方法已不能满足复杂公式的计算需求,为此,本实施例提供一种新的基于Excel表的计算方法。
在本实施例中,终端在展示Excel表格时,接收用户基于目标单元格的计算指令,并获取该计算指令中携带的目标计算公式,其中目标计算公式是用户根据Excel的公式编辑格式预先编辑的;在获取到目标计算公式后,终端将该目标计算公式拆分为若干个独立的子公式,具体实施时,拆分规则以及拆分后的子公式数量可预先进行灵活设置。比如,终端可以按照Excel宏中的公式函数的类型对目标计算公式进行拆分,当目标计算公式由加、减、乘、除四种运算规则组成时,可以将该目标计算公式拆分为加运算、减运算、乘运算、除运算等4个子公式,当然也可以将该目标计算公式拆分为2个子公式,其中一个子公式包含加运算和减运算,另一个子公式包含乘运算和除运算。
步骤S20,读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
在进行公式拆分后,终端可以通过SAX(Simple API for XML)读取Excel表的配置文件,该配置文件中包含了Excel表格中的单元格信息和单元格中的内容信息。SAX既是一种接口,也是一种软件包,SAX不同于DOM解析,它逐行扫描文档,一边扫描一边解析,由于只是在读取数据时解析数据,因此不需要将所有数据存储在内存中,这对于大型文档的解析是个巨大优势,通过SAX解析Excel,就不会整篇Excel加载到内存中,不会占用大量的Java虚拟机内存。
在读取上述配置文件的过程中,终端按照预设的MAP集合类在该配置文件中定位所述子公式中的Java对象,并获取Java对象的取值。其中,MAP集合类是Java中最常用的集合类之一,MAP集合类中的元素以键值对的形式存储,每个键对应相同或不同的键值。具体地,按照预设的MAP集合类定位子公式中的Java对象的方式可以为:首先将Excel配置文件中用于标识Excel单元格的标签转化为MAP集合类中定义的键值,比如,Excel配置文件中某一标识单元格的标签为sheet1,D4,则可以按照MAP集合类中定义的键值类型将其转换为Calculation,BP,4的键值形式,然后根据该转换得到的键值定位子公式中的Java对象,并获取Java对象的取值,比如针对子公式中某一Java对象Calculation!$BP$4,可以直接按照MAP的层级进行定位取值,第一层取键值为Calculation的sheet页,第二层取BP列,第三层取第4行的值,由此得到该Java对象的取值。
步骤S30,按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
该步骤中,终端按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用与子公式对应的Java方法,比如某一子公式计算需要用到Excel宏的公式函数为SUMPRODUCT(条件求和),则可以调用对应的“excelFunSUMPRODUCT”的Java方法,该Java方法同样实现条件求和。之后,将步骤S20中Java对象的取值代入上述Java方法中进行计算,即可得到每个子公式的值,并进而得到目标计算公式的计算结果。
需要说明的是,计算各子公式的值的过程相互独立且互不影响,当一个子公式的值计算完成之后,Java虚拟机的垃圾回收机制便可将该子公式中的Java对象进行回收,从而避免了大量的Java对象在内存中积压,保证了计算过程的顺利进行。
进一步地,在步骤S30之后,还可以包括步骤:将所述计算结果在所述Excel表的用户交互界面中进行展示。
在计算得出结果值之后,可以将结果值显示Excel表的用户交互界面,比如在计算产品报价时,可将计算得到的最终报价展示在用户上载页的结果页面供用户参考。
在本实施例中,当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果。本实施例通过对目标计算公式进行拆分,进而根据预设的Java方法分别计算每个子公式的值,并得到最终计算结果,相对于现有技术,该计算方式避免了对Excel单元格进行多次迭代,且子公式计算完成后,相应的计算对象可以被正常回收,从而缩减了Excel表计算过程中对内存的消耗,同时提高了计算效率。
进一步地,参照图3,图3为本申请基于Excel表的计算方法第二实施例的流程示意图。基于上述图2所示的实施例,在步骤S10之前,还可以包括:
步骤S40,获取Excel宏的公式函数,将所述公式函数编译为对应的Java方法;
该步骤中,为保证后续计算的顺利进行,开发人员需穷举excel宏的所有公式函数,然后将其编译为对应的java方法。具体地,终端可以根据开发人员的编译指令获取Excel宏的公式函数,并将编译为对应的Java方法,比如将excel中的公式函数“SUMPRODUCT(条件求和)”编译为“excelFunSUMPRODUCT”的方法等,由此将excel宏中的所有公式函数重写为java方法。
步骤S50,建立所述公式函数和所述Java方法之间的对应关系。
之后,建立excel宏的公式函数和Java方法之间的对应关系,由此保证某一excel宏的公式函数和其对应的Java方法可以实现相同的运算功能。
本实施例中,通过穷举excel宏的所有公式函数并将其编译为对应的Java方法,后续终端便可通过新编译的Java方法计算目标公式的值,从而避免了直接使用excel宏的公式函数进行计算所导致的内存占用过高、计算效率低下的问题。
进一步地,参照图4,图4为本申请基于Excel表的计算方法第三实施例的流程示意图。基于上述图2所示的实施例,步骤S20可以包括:
步骤S21,读取Excel表的配置文件,识别所述配置文件中用于标识Excel单元格的标签;
该步骤中,终端首先读取Excel表的配置文件,并识别配置文件中用于标识Excel单元格的标签,比如标签“sheet1,D4”即表示位于sheet1页D列第4行的单元格;
步骤S22,将所述标签转换为预设的MAP集合类中定义的键值;
步骤S23,按照预设的键值和Java对象之间的对应关系,将所述子公式中的Java对象转换为对应的键值;
步骤S24,将由所述标签转换得到的所述键值与由所述Java对象转换得到的所述键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值。
然后,终端将上述标签转换为预设的MAP集合类中定义的键值,以便于后续计算取值,比如可以将标签“sheet1,D4”转换为Calculation,BP,4的键值形式;然后按照预设的键值和Java对象之间的对应关系,将子公式中的Java对象转换为对应的键值,比如对于子公式中的Java对象Calculation!$BP$4,可以将其转换为对应的键值形式Calculation,BP,4;之后,将由该标签转换得到的键值与由Java对象转换得到的键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值,比如上述标签sheet1,D4”转换得到的键值为Calculation,BP,4,子公式中的Java对象Calculation!$BP$4转换得到的键值为也为Calculation,BP,4,两者相匹配,此时根据该匹配结果就可以得到Excel表的配置文件中与Java对象Calculation!$BP$4对应的Excel单元格“sheet1,D4”,即第1页D列4行的单元格,该单元格的取值即作为Java对象Calculation!$BP$4的取值。
进一步地,参照图5,图5为图4中步骤S22的细化步骤示意图,步骤S22可以包括:
步骤S221,分别获取所述标签中用于标识Excel单元格所在页数、列数和行数的字符及对应的Excel单元格的取值;
步骤S222,将所述字符转换为预设的MAP集合类中分别用于表示Excel表的页数、列数和行数的键值类型,并根据所述Excel单元格的取值为转换得到的所述键值类型进行赋值。
比如,获取到标签“sheet1,D4”及其对应的单元格取值为100,而对于预先定义的三级MAP集合类,其定义的键值类型包括页、列、行,则对于上述标签“sheet1,D4”,可以按照MAP集合类中定义的键值类型将其转换为Calculation,BP,4的键值形式,其中第一层Calculation代表sheet1页,第二层BP代表D列,第三层代表D列第4行,然后将Calculation,BP,4的键值赋值为100。
在本实施例中,通过预先定义三级MAP集合类,进而将标签转换为预设的MAP集合类中定义的键值,从而实现了对Excel单元格的标记,为后续子公式的计算取值提供了前提保证。
本申请还提供一种基于Excel表的计算装置,所述装置包括:
拆分模块,用于当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
获取模块,用于读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
计算模块,用于按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
进一步地,所述装置还包括:
编译模块,用于获取Excel宏的公式函数,将所述公式函数编译为对应的Java方法;
建立模块,用于建立所述公式函数和所述Java方法之间的对应关系。
进一步地,所述获取模块还用于:
读取Excel表的配置文件,识别所述配置文件中用于标识Excel单元格的标签;
将所述标签转换为预设的MAP集合类中定义的键值;
按照预设的键值和Java对象之间的对应关系,将所述子公式中的Java对象转换为对应的键值;
将由所述标签转换得到的所述键值与由所述Java对象转换得到的所述键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值。
进一步地,所述获取模块还用于:
分别获取所述标签中用于标识Excel单元格所在页数、列数和行数的字符及对应的Excel单元格的取值;
将所述字符转换为预设的MAP集合类中分别用于表示Excel表的页数、列数和行数的键值类型,并根据所述Excel单元格的取值为转换得到的所述键值类型进行赋值。
进一步地,所述装置还包括:
展示模块,用于将所述计算结果在所述Excel表的用户交互界面中进行展示。
上述各功能模块实现的方法可参照本申请基于Excel表的计算方法实施例,此处不再赘述。
本申请还提供一种计算机可读存储介质。
本申请计算机可读存储介质上存储有基于Excel表的计算程序,所述基于Excel表的计算程序被处理器执行时实现如上所述的基于Excel表的计算方法的步骤。
其中,在所述处理器上运行的基于Excel表的计算程序被执行时所实现的方法可参照本申请基于Excel表的计算方法各个实施例,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种基于Excel表的计算方法,其特征在于,所述方法包括如下步骤:
    当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
    读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
    按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
  2. 如权利要求1所述的基于Excel表的计算方法,其特征在于,所述当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式的步骤之前,还包括:
    获取Excel宏的公式函数,将所述公式函数编译为对应的Java方法;
    建立所述公式函数和所述Java方法之间的对应关系。
  3. 如权利要求1所述的基于Excel表的计算方法,其特征在于,所述读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值的步骤包括:
    读取Excel表的配置文件,识别所述配置文件中用于标识Excel单元格的标签;
    将所述标签转换为预设的MAP集合类中定义的键值;
    按照预设的键值和Java对象之间的对应关系,将所述子公式中的Java对象转换为对应的键值;
    将由所述标签转换得到的所述键值与由所述Java对象转换得到的所述键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值。
  4. 如权利要求3所述的基于Excel表的计算方法,其特征在于,所述将所述标签转换为预设的MAP集合类中定义的键值的步骤包括:
    分别获取所述标签中用于标识Excel单元格所在页数、列数和行数的字符及对应的Excel单元格的取值;
    将所述字符转换为预设的MAP集合类中分别用于表示Excel表的页数、列数和行数的键值类型,并根据所述Excel单元格的取值为转换得到的所述键值类型进行赋值。
  5. 如权利要求1所述的基于Excel表的计算方法,其特征在于,所述按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果的步骤之后,还包括:
    将所述计算结果在所述Excel表的用户交互界面中进行展示。
  6. 一种基于Excel表的计算装置,其特征在于,所述装置包括:
    拆分模块,用于当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
    获取模块,用于读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
    计算模块,用于按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
  7. 如权利要求6所述的基于Excel表的计算装置,其特征在于,所述装置还包括:
    编译模块,用于获取Excel宏的公式函数,将所述公式函数编译为对应的Java方法;
    建立模块,用于建立所述公式函数和所述Java方法之间的对应关系。
  8. 如权利要求6所述的基于Excel表的计算装置,其特征在于,所述获取模块还用于:
    读取Excel表的配置文件,识别所述配置文件中用于标识Excel单元格的标签;
    将所述标签转换为预设的MAP集合类中定义的键值;
    按照预设的键值和Java对象之间的对应关系,将所述子公式中的Java对象转换为对应的键值;
    将由所述标签转换得到的所述键值与由所述Java对象转换得到的所述键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值。
  9. 如权利要求8所述的基于Excel表的计算装置,其特征在于,所述获取模块还用于:
    分别获取所述标签中用于标识Excel单元格所在页数、列数和行数的字符及对应的Excel单元格的取值;
    将所述字符转换为预设的MAP集合类中分别用于表示Excel表的页数、列数和行数的键值类型,并根据所述Excel单元格的取值为转换得到的所述键值类型进行赋值。
  10. 如权利要求6所述的基于Excel表的计算装置,其特征在于,所述装置还包括:
    展示模块,用于将所述计算结果在所述Excel表的用户交互界面中进行展示。
  11. 一种基于Excel表的计算设备,其特征在于,所述设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的基于Excel表的计算程序,所述基于Excel表的计算程序被所述处理器执行时实现如下步骤:
    当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
    读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
    按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
  12. 如权利要求11所述的基于Excel表的计算设备,其特征在于,所述基于Excel表的计算程序被所述处理器执行时还实现如下步骤:
    获取Excel宏的公式函数,将所述公式函数编译为对应的Java方法;
    建立所述公式函数和所述Java方法之间的对应关系。
  13. 如权利要求11所述的基于Excel表的计算设备,其特征在于,所述基于Excel表的计算程序被所述处理器执行时还实现如下步骤:
    读取Excel表的配置文件,识别所述配置文件中用于标识Excel单元格的标签;
    将所述标签转换为预设的MAP集合类中定义的键值;
    按照预设的键值和Java对象之间的对应关系,将所述子公式中的Java对象转换为对应的键值;
    将由所述标签转换得到的所述键值与由所述Java对象转换得到的所述键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值。
  14. 如权利要求13所述的基于Excel表的计算设备,其特征在于,所述基于Excel表的计算程序被所述处理器执行时还实现如下步骤:
    分别获取所述标签中用于标识Excel单元格所在页数、列数和行数的字符及对应的Excel单元格的取值;
    将所述字符转换为预设的MAP集合类中分别用于表示Excel表的页数、列数和行数的键值类型,并根据所述Excel单元格的取值为转换得到的所述键值类型进行赋值。
  15. 如权利要求11所述的基于Excel表的计算设备,其特征在于,所述基于Excel表的计算程序被所述处理器执行时还实现如下步骤:
    将所述计算结果在所述Excel表的用户交互界面中进行展示。
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有基于Excel表的计算程序,所述基于Excel表的计算程序被处理器执行时实现如下步骤:
    当接收到计算指令时,获取目标计算公式,将所述目标计算公式拆分为若干个子公式;
    读取Excel表的配置文件,按照预设的MAP集合类在所述配置文件中定位所述子公式中的Java对象,并获取所述Java对象的取值;
    按照预设的Excel宏的公式函数和Java方法之间的对应关系,调用所述子公式对应的Java方法,将所述Java对象的取值代入所述Java方法中进行计算,得到所述目标计算公式的计算结果,其中,所述Java方法用于表示基于所述Java对象的运算规则。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述基于Excel表的计算程序被处理器执行时还实现如下步骤:
    获取Excel宏的公式函数,将所述公式函数编译为对应的Java方法;
    建立所述公式函数和所述Java方法之间的对应关系。
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述基于Excel表的计算程序被处理器执行时还实现如下步骤:
    读取Excel表的配置文件,识别所述配置文件中用于标识Excel单元格的标签;
    将所述标签转换为预设的MAP集合类中定义的键值;
    按照预设的键值和Java对象之间的对应关系,将所述子公式中的Java对象转换为对应的键值;
    将由所述标签转换得到的所述键值与由所述Java对象转换得到的所述键值进行匹配,得到所述配置文件中与所述Java对象对应的Excel单元格,将所述Excel单元格的取值作为所述Java对象的取值。
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述基于Excel表的计算程序被处理器执行时还实现如下步骤:
    分别获取所述标签中用于标识Excel单元格所在页数、列数和行数的字符及对应的Excel单元格的取值;
    将所述字符转换为预设的MAP集合类中分别用于表示Excel表的页数、列数和行数的键值类型,并根据所述Excel单元格的取值为转换得到的所述键值类型进行赋值。
  20. 如权利要求16所述的计算机可读存储介质,其特征在于,所述基于Excel表的计算程序被处理器执行时还实现如下步骤:
    将所述计算结果在所述Excel表的用户交互界面中进行展示。
PCT/CN2018/075011 2017-12-21 2018-02-02 基于Excel表的计算方法、装置、设备及存储介质 WO2019119624A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711415048.9 2017-12-21
CN201711415048.9A CN108170638A (zh) 2017-12-21 2017-12-21 基于Excel表的计算方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2019119624A1 true WO2019119624A1 (zh) 2019-06-27

Family

ID=62524018

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/075011 WO2019119624A1 (zh) 2017-12-21 2018-02-02 基于Excel表的计算方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN108170638A (zh)
WO (1) WO2019119624A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783554A (zh) * 2018-12-13 2019-05-21 重庆金融资产交易所有限责任公司 excel文档解析方法、装置及计算机可读存储介质
CN110738027B (zh) * 2019-10-15 2023-07-14 深圳逻辑汇科技有限公司 生成电子表格公式的计算机实现的方法、设备和存储介质
CN110826297A (zh) * 2019-11-05 2020-02-21 北京锐安科技有限公司 一种数据导出方法、装置、设备及存储介质
CN111126015B (zh) * 2019-11-25 2023-12-26 金蝶软件(中国)有限公司 一种报表编制方法、设备
CN111144082B (zh) * 2019-12-23 2023-05-12 中国建设银行股份有限公司 多表格迭代计算方法、装置、电子设备及存储介质
CN112486463A (zh) * 2020-12-03 2021-03-12 安徽经邦软件技术有限公司 一种基于公式财务指标智能计算的方法及系统
CN113157717A (zh) * 2021-05-26 2021-07-23 深圳平安智汇企业信息管理有限公司 长数据链路的缓存刷新方法、装置、设备及存储介质
CN115080819A (zh) * 2022-05-13 2022-09-20 山东鲁软数字科技有限公司 薪酬数据分析管理方法及平台
CN115981610B (zh) * 2023-03-17 2023-06-02 科大国创软件股份有限公司 一种基于Lua脚本实现的光伏储能系统的综合运算平台

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7730025B1 (en) * 2004-11-30 2010-06-01 Oracle America, Inc. Migrating documents
CN103049280A (zh) * 2011-10-14 2013-04-17 浪潮乐金数字移动通信有限公司 一种实现按键宏定义功能的方法与移动终端
CN103617045A (zh) * 2013-12-12 2014-03-05 用友软件股份有限公司 基于自定义Excel函数的插件开发系统和插件开发方法
CN104090780A (zh) * 2014-07-31 2014-10-08 广州视源电子科技股份有限公司 自动配置方法以及云编译系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649220A (zh) * 2016-11-29 2017-05-10 中科曙光信息技术无锡有限公司 一种在线excel公式解析方法
CN107203500A (zh) * 2017-01-10 2017-09-26 大连交通大学 基于递归替换展开回溯的excel公式面向对象语言的自动转换方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7730025B1 (en) * 2004-11-30 2010-06-01 Oracle America, Inc. Migrating documents
CN103049280A (zh) * 2011-10-14 2013-04-17 浪潮乐金数字移动通信有限公司 一种实现按键宏定义功能的方法与移动终端
CN103617045A (zh) * 2013-12-12 2014-03-05 用友软件股份有限公司 基于自定义Excel函数的插件开发系统和插件开发方法
CN104090780A (zh) * 2014-07-31 2014-10-08 广州视源电子科技股份有限公司 自动配置方法以及云编译系统

Also Published As

Publication number Publication date
CN108170638A (zh) 2018-06-15

Similar Documents

Publication Publication Date Title
WO2019119624A1 (zh) 基于Excel表的计算方法、装置、设备及存储介质
WO2019165691A1 (zh) 自动生成测试案例的方法、装置、设备及可读存储介质
WO2018205545A1 (zh) 数据生成方法、装置、终端及计算机可读存储介质
WO2019218444A1 (zh) 测试报告的生成方法、装置、设备及存储介质
WO2016032288A1 (en) Scrapped information providing method and apparatus
WO2017039341A1 (en) Display apparatus and control method thereof
WO2015135443A1 (en) Method and apparatus for simulating sound in virtual scenario, and terminal
WO2016114609A1 (en) Electronic device and method of processing information in electronic device
WO2019019714A1 (zh) 一种微信客户行为反馈方法、设备及存储介质
WO2017007217A1 (en) Method for displaying web content and electronic device supporting the same
WO2018164378A1 (en) Electronic apparatus for compressing language model, electronic apparatus for providing recommendation word and operation methods thereof
WO2016027983A1 (en) Method and electronic device for classifying contents
WO2020096172A1 (en) Electronic device for processing user utterance and controlling method thereof
WO2019235793A1 (en) Electronic device and method for providing information related to image to application through input unit
WO2019041832A1 (zh) 修改源数据库表结构的方法、服务器、系统及存储介质
EP3906553A1 (en) Electronic device for providing graphic data based on voice and operating method thereof
WO2019075944A1 (zh) 基于用户行为的信息屏蔽方法、装置、终端和存储介质
WO2019080401A1 (zh) 脚本语句转换方法、装置及计算机可读存储介质
WO2020180034A1 (ko) 사용자 선택 기반의 정보를 제공하는 방법 및 장치
WO2018201774A1 (zh) 数据审批方法、装置、设备和计算机可读存储介质
WO2019004670A1 (en) METHOD AND ELECTRONIC DEVICE FOR RENDERING SVG CONTENT
WO2013166805A1 (zh) 选择电视机网络应用的方法及装置
WO2020233078A1 (zh) 用户信息表单的构建方法、装置、设备及存储介质
WO2019127869A1 (zh) 漏洞信息收集方法、装置、设备及可读存储介质
WO2019024472A1 (zh) 数据操作方法、装置及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18892409

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 21.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18892409

Country of ref document: EP

Kind code of ref document: A1