CN103473234A - Method, device and system for deriving report forms from web inquiring system - Google Patents

Method, device and system for deriving report forms from web inquiring system Download PDF

Info

Publication number
CN103473234A
CN103473234A CN201210186444XA CN201210186444A CN103473234A CN 103473234 A CN103473234 A CN 103473234A CN 201210186444X A CN201210186444X A CN 201210186444XA CN 201210186444 A CN201210186444 A CN 201210186444A CN 103473234 A CN103473234 A CN 103473234A
Authority
CN
China
Prior art keywords
query
page
query result
client
server
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201210186444XA
Other languages
Chinese (zh)
Other versions
CN103473234B (en
Inventor
王庆
潘易龙
何栩翊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201210186444.XA priority Critical patent/CN103473234B/en
Publication of CN103473234A publication Critical patent/CN103473234A/en
Application granted granted Critical
Publication of CN103473234B publication Critical patent/CN103473234B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了从web查询系统导出报表的方法,应用于客户端上,包括:检测到用户在当前查询结果界面上触发了报表导出操作后修改原始查询请求,在其中增加导出标识后发送给服务器,接收服务器端返回的包含报表文件的响应。还公开了相应的应用于服务器上的方法,包括:接收客户端发送的查询请求并生成查询结果页面,为查询结果页面中的表格对象设置统一的标识,如查询请求包含导出标识,将查询结果页面转换为文档对象模型,根据所述标识定位到文档对象模型中的表格对象,将文档对象模型中的表格对象转换为报表文件,携带在响应中返回到客户端。本发明能达到对服务器端查询程序无侵入,实现所见即所得的报表文件的导出,提高系统开发和维护的效率。

The invention discloses a method for exporting a report from a web query system, which is applied to a client, including: after detecting that a user has triggered a report export operation on the current query result interface, modifying the original query request, adding an export identifier and sending it to the server , to receive the response containing the report file returned by the server. A corresponding method applied on the server is also disclosed, including: receiving the query request sent by the client and generating a query result page, setting a unified identifier for the table object in the query result page, if the query request contains an export identifier, the query result The page is converted into a document object model, and the form object in the document object model is located according to the identifier, and the form object in the document object model is converted into a report file, which is carried in the response and returned to the client. The invention can achieve no intrusion to the query program at the server end, realizes the export of WYSIWYG report files, and improves the efficiency of system development and maintenance.

Description

一种从web查询系统导出报表的方法、装置及系统A method, device and system for exporting reports from a web query system

技术领域 technical field

本发明涉及计算机通信技术领域,尤其涉及的是一种从web查询系统导出报表的方法、装置及系统。The invention relates to the technical field of computer communication, in particular to a method, device and system for exporting reports from a web query system.

背景技术 Background technique

Excel格式的报表是我们当今工作和生活中使用得最广泛的一种报表格式,而通过浏览器在web应用系统中查询到用户所需数据,然后将查询结果导出到excel已经是人们普遍认为最方便的获取报表数据的方式。Reports in Excel format are the most widely used report formats in our work and life today, and it is generally believed that the data required by users can be queried in the web application system through a browser, and then exported to excel. A convenient way to obtain report data.

现有的从web查询系统导出报表的方式主要有2大类,第一类是在浏览器所在的客户端安装微软提供的excel插件,当用户在查询结果界面上点击导出按钮后,浏览器直接将当前web页面中显示的表格数据转换为excel文件。这种方式的缺陷在于:客户端必须安装excel插件,而且目前只支持InternetExplorer浏览器,不支持其他类型的浏览器。第二类是在服务器侧通过预先定义好模板,在用户查询出结果后点击导出按钮后,将相同查询条件再次发送到服务器端进行查询,将查询结果根据预定义的模板格式组装成excel文件再响应到客户端。这种方式对于开发来说具有明显的缺点:每个查询页面都要预先定义对应的模板,如果要让导出的excel文件达到所见即所得,这要求后台开发人员必须要清楚前台web页面的结构,而且还要随着前台web页面结构的变化而修改后台程序,这是非常低效的,而且还容易产生web页面显示结果与excel文件显示结果不一致。There are mainly two types of existing methods for exporting reports from the web query system. The first type is to install the excel plug-in provided by Microsoft on the client side where the browser is located. When the user clicks the export button on the query result interface, the browser directly Convert the tabular data displayed on the current web page into an excel file. The disadvantage of this method is that the client must install the excel plug-in, and currently only supports the Internet Explorer browser, and does not support other types of browsers. The second type is to use a pre-defined template on the server side, and after the user clicks the export button after querying the results, the same query conditions are sent to the server again for query, and the query results are assembled into an excel file according to the predefined template format and then response to the client. This method has obvious disadvantages for development: each query page must pre-define the corresponding template. If you want to make the exported excel file achieve what you see is what you get, this requires background developers to be clear about the structure of the front-end web page , and it is very inefficient to modify the background program as the structure of the foreground web page changes, and it is also easy to cause inconsistencies between the display results of the web page and the excel file.

因此,为了使报表导出达到所见即所得,提高web系统开发和维护的效率,现有的方法还有待改进。Therefore, in order to achieve WYSIWYG report export and improve the efficiency of web system development and maintenance, the existing methods still need to be improved.

发明内容Contents of the invention

本发明所要解决的技术问题是提供一种从web查询系统导出报表的方法、装置及系统,能够使从web查询系统导出的报表满足用户所见即所得的要求,提高web查询系统开发和维护的效率。The technical problem to be solved by the present invention is to provide a method, device and system for exporting reports from the web query system, which can make the reports derived from the web query system meet the user's WYSIWYG requirements, and improve the development and maintenance of the web query system. efficiency.

为了解决上述技术问题,本发明提供了一种从web查询系统导出报表的方法,应用于客户端上,该方法包括:In order to solve the above technical problems, the present invention provides a method for exporting reports from the web query system, which is applied to the client, and the method includes:

检测到用户在当前查询结果界面上触发了报表导出操作后,修改原始查询请求,所述修改包括:在其中增加导出标识,其中,所述原始查询请求是之前为了获取当前查询结果所提交的查询请求;After detecting that the user triggers the report export operation on the current query result interface, modify the original query request, the modification includes: adding an export identifier, wherein the original query request is the query submitted before to obtain the current query result ask;

将修改后的查询请求发送给服务器;Send the modified query request to the server;

接收服务器端返回的包含报表文件的查询响应,所述报表文件记录了要导出的查询结果页面中的表格对象。A query response including a report file is received from the server, and the report file records the table objects in the query result page to be exported.

进一步地,所述修改原始查询请求,还包括:如果用户触发的报表导出操作是要导出全部查询结果且当前查询页面是分页的数据,则将原始查询请求中的当前页码设置为首页,且将每页记录数目设置为查询系统性能允许的最大值。Further, the modification of the original query request also includes: if the report export operation triggered by the user is to export all query results and the current query page is paged data, then setting the current page number in the original query request as the home page, and setting The number of records per page is set to the maximum value allowed by the query system performance.

为了解决上述技术问题,本发明还提供了一种从web查询系统导出报表的方法,应用于服务器上,该方法包括:In order to solve the above technical problems, the present invention also provides a method for exporting reports from the web query system, which is applied to the server, and the method includes:

接收到客户端发送的查询请求,获取查询结果并生成查询结果页面,在生成查询结果页面时为查询结果页面中的表格对象设置统一的标识;Receive the query request sent by the client, obtain the query result and generate a query result page, and set a unified identifier for the table objects in the query result page when generating the query result page;

如所述查询请求包含导出标识,将所述查询结果页面转换为文档对象模型,根据所述统一的标识定位到文档对象模型中的表格对象,将所述文档对象模型中的表格对象转换为报表文件;If the query request includes an export identifier, convert the query result page into a document object model, locate the table object in the document object model according to the unified identifier, and convert the table object in the document object model into a report document;

将所述报表文件携带在查询响应中返回到客户端。The report file is carried in the query response and returned to the client.

进一步地,所述报表文件为EXCEL格式的报表文件。Further, the report file is a report file in EXCEL format.

为了解决上述技术问题,本发明还提供了一种从web查询系统导出报表的方法,该方法包括:In order to solve the above-mentioned technical problems, the present invention also provides a method for exporting reports from the web query system, the method comprising:

客户端执行上述应用于客户端上的从web查询系统导出报表的方法;The client executes the above-mentioned method for exporting reports from the web query system applied to the client;

服务器端执行上述应用于服务器上的从web查询系统导出报表的方法。The server executes the above-mentioned method for exporting reports from the web query system applied to the server.

为了解决上述技术问题,本发明还提供了一种从web查询系统导出报表的装置,应用于客户端上,包括:In order to solve the above technical problems, the present invention also provides a device for exporting reports from the web query system, which is applied to the client, including:

检测模块,用于检测到用户在当前查询结果界面上触发了报表导出操作后,修改原始查询请求,所述修改包括:在其中增加导出标识,其中,所述原始查询请求是之前为了获取当前查询结果所提交的查询请求;The detection module is used to modify the original query request after detecting that the user triggers the report export operation on the current query result interface, the modification includes: adding an export identifier, wherein the original query request was previously used to obtain the current query result of the submitted query request;

发送模块,用于将修改后的查询请求发送给服务器;A sending module, configured to send the modified query request to the server;

接收模块,用于接收服务器端返回的包含报表文件的查询响应,所述报表文件记录了要导出的查询结果页面中的表格对象。The receiving module is used to receive the query response returned by the server and includes the report file, and the report file records the table objects in the query result page to be exported.

进一步地,所述修改原始查询请求,还包括:如果用户触发的报表导出操作是要导出全部查询结果且当前查询页面是分页的数据,则将原始查询请求中的当前页码设置为首页,且将每页记录数目设置为查询系统性能允许的最大值。Further, the modification of the original query request also includes: if the report export operation triggered by the user is to export all query results and the current query page is paged data, then setting the current page number in the original query request as the home page, and setting The number of records per page is set to the maximum value allowed by the query system performance.

为了解决上述技术问题,本发明还提供了一种从web查询系统导出报表的装置,应用于服务器上,包括:In order to solve the above technical problems, the present invention also provides a device for exporting reports from the web query system, which is applied to the server, including:

接收模块,用于接收到客户端发送的查询请求,获取查询结果并生成查询结果页面,在生成查询结果页面时为查询结果页面中的表格对象设置统一的标识;The receiving module is used to receive the query request sent by the client, obtain the query result and generate a query result page, and set a unified identification for the table object in the query result page when generating the query result page;

转换模块,用于如所述查询请求包含导出标识,将所述查询结果页面转换为文档对象模型,根据所述统一的标识定位到文档对象模型中的表格对象,将所述文档对象模型中的表格对象转换为报表文件;The conversion module is configured to convert the query result page into a document object model if the query request includes an export identifier, locate the table object in the document object model according to the unified identifier, and convert the table object in the document object model to Table objects are converted to report files;

发送模块,用于将所述报表文件携带在查询响应中返回到客户端。A sending module, configured to carry the report file in the query response and return it to the client.

进一步地,所述报表文件为EXCEL格式的报表文件。Further, the report file is a report file in EXCEL format.

为了解决上述技术问题,本发明还提供了一种从web查询系统导出报表的系统,包括:In order to solve the above technical problems, the present invention also provides a system for exporting reports from the web query system, including:

上述应用于客户端上的从web查询系统导出报表的装置;及上述应用于服务器上的从web查询系统导出报表的装置。The above-mentioned device for exporting reports from the web query system applied to the client; and the above-mentioned device for exporting reports from the web query system applied to the server.

与现有技术相比,本发明提供的从web查询系统导出报表的方法、装置及系统,通过对客户端在检测到用户触发了导出报表的操作后对查询请求的过滤处理,服务器端在判断出查询请求中携带导出标识后对查询结果页面的响应拦截,将响应转换为文档对象模型,在文档对象模型中定位到表格对象,将表格对象转换为报表文件作为响应返回到客户端。利用本发明实现报表导出,可以达到对服务器端查询程序无侵入,不受服务端编程语言类型的限制,不受后台数据来源的限制,可以让系统以最小的改动实现所见即所得的报表文件的导出,大大提高web查询系统开发和维护的效率。Compared with the prior art, the method, device and system for exporting reports from the web query system provided by the present invention, through the filtering process of the query request after the client detects that the user has triggered the export report operation, the server side is judging Intercept the response to the query result page after carrying the export identifier in the query request, convert the response into a document object model, locate the form object in the document object model, convert the form object into a report file and return it to the client as a response. Utilizing the present invention to achieve report export can achieve no intrusion into the server-side query program, is not limited by the type of server-side programming language, and is not limited by the source of background data, allowing the system to realize WYSIWYG report files with minimal changes The export can greatly improve the efficiency of web query system development and maintenance.

附图说明 Description of drawings

图1为本发明实施例的从web查询系统导出报表的方法流程图(应用于客户端上)。FIG. 1 is a flowchart of a method for exporting a report from a web query system (applied to a client) according to an embodiment of the present invention.

图2为图1实施例的查询结果页面显示示例。FIG. 2 is a display example of the query result page of the embodiment in FIG. 1 .

图3为本发明实施例的从web查询系统导出报表的方法流程图(应用于服务器上)。Fig. 3 is a flowchart of a method for exporting reports from a web query system (applied to a server) according to an embodiment of the present invention.

图4为图2的查询结果页面的表格数据的DOM结构图。FIG. 4 is a DOM structure diagram of tabular data in the query result page of FIG. 2 .

图5为本发明实施例的从web查询系统导出报表的方法流程图(包括客户端和服务器)。FIG. 5 is a flowchart of a method for exporting a report from a web query system (including a client and a server) according to an embodiment of the present invention.

图6为本发明实施例的从web查询系统导出报表的装置结构示意图(应用于客户端上)。FIG. 6 is a schematic structural diagram of a device for exporting reports from a web query system (applied to a client) according to an embodiment of the present invention.

图7为本发明实施例的从web查询系统导出报表的装置结构示意图(应用于服务器上)。FIG. 7 is a schematic structural diagram of a device for exporting reports from a web query system (applied to a server) according to an embodiment of the present invention.

图8为本发明实施例的从web查询系统导出报表的系统结构示意图(包括客户端和服务器)。FIG. 8 is a schematic structural diagram of a system (including a client and a server) for exporting reports from a web query system according to an embodiment of the present invention.

具体实施方式 Detailed ways

为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.

如图1所示,本发明实施例提供了一种从web查询系统导出报表的方法,应用于客户端上,该方法包括:As shown in Figure 1, the embodiment of the present invention provides a method for exporting reports from the web query system, which is applied to the client, and the method includes:

S10,检测到用户在当前查询结果界面上触发了报表导出操作后,修改原始查询请求,所述修改包括:在其中增加导出标识,其中,所述原始查询请求是之前为了获取当前查询结果所提交的查询请求;S10, after detecting that the user triggers the report export operation on the current query result interface, modify the original query request, the modification includes: adding an export identifier, wherein the original query request is submitted before to obtain the current query result query request;

S20,将修改后的查询请求发送给服务器;S20, sending the modified query request to the server;

S30,接收服务器端返回的包含报表文件的查询响应,所述报表文件记录了要导出的查询结果页面中的表格对象。S30, receiving the query response returned by the server and including the report file, the report file records the table objects in the query result page to be exported.

步骤S10进一步包括下述特点:Step S10 further includes the following features:

其中,所述修改原始查询请求,还包括:如果用户触发的报表导出操作是要导出全部查询结果且当前查询页面是分页的数据,则将原始查询请求中的当前页码设置为首页,且将每页记录数目设置为查询系统性能允许的最大值,实际情况中指定查询条件下的记录总数不会超过所述的最大值;Wherein, the modification of the original query request also includes: if the report export operation triggered by the user is to export all query results and the current query page is paged data, then setting the current page number in the original query request as the home page, and setting each The number of page records is set to the maximum value allowed by the performance of the query system. In actual situations, the total number of records under the specified query conditions will not exceed the maximum value;

本发明在当前查询页面是分页的数据时,无论当前页面是哪一页时,都能通过修改查询请求中的当前页码和每页记录数目来导出全部查询结果;When the current query page is paged data, no matter which page the current page is, all query results can be derived by modifying the current page number and the number of records per page in the query request;

比如,当前查询结果的页面显示样例如图2所示,用户在当前查询界面“年龄”文本框中输入“23”,点击“查询”按钮后得到列表数据,用户再点击“导出报表”按钮触发报表导出操作。优选地,“导出报表”的按钮可以包括“导出全部报表”的子选项,如果用户不选择“导出全部报表”的子选项,则系统默认导出当前查询结果界面上显示的列表数据;For example, the page display sample of the current query results is shown in Figure 2. The user enters "23" in the "Age" text box of the current query interface, clicks the "Query" button to get the list data, and then clicks the "Export Report" button to trigger Report export operation. Preferably, the "Export Report" button may include the sub-option "Export All Reports", if the user does not select the sub-option "Export All Reports", the system will export the list data displayed on the current query result interface by default;

步骤S30进一步包括下述特点:Step S30 further includes the following features:

其中,所述报表文件记录了要导出的查询结果页面中的表格对象,也即,所述报表文件记录的表格与查询结果页面中的表格,二者的显示完全一样;Wherein, the report file records the table object in the query result page to be exported, that is, the table recorded in the report file is exactly the same as the table in the query result page;

如图3所示,本发明实施例提供了一种从web查询系统导出报表的方法,应用于服务器上,该方法包括:As shown in Figure 3, the embodiment of the present invention provides a method for exporting reports from the web query system, which is applied on the server, and the method includes:

S10,接收到客户端发送的查询请求,获取查询结果并生成查询结果页面,在生成查询结果页面时为查询结果页面中的表格对象设置统一的标识;S10, receiving the query request sent by the client, obtaining the query result and generating a query result page, and setting a unified identifier for the table objects in the query result page when generating the query result page;

S20,如所述查询请求包含导出标识,将所述查询结果页面转换为文档对象模型,根据所述统一的标识定位到文档对象模型中的表格对象,将所述文档对象模型中的表格对象转换为报表文件;S20, if the query request includes an export identifier, convert the query result page into a document object model, locate a table object in the document object model according to the unified identifier, and convert the table object in the document object model for the report file;

S30,将所述报表文件携带在查询响应中返回到客户端。S30. Carry the report file in the query response and return it to the client.

步骤S10进一步包括下述特点:Step S10 further includes the following features:

其中,服务器根据所述查询请求获取查询结果,包括:服务器查询程序根据查询请求到数据库、文件系统或者第三方系统查询数据,获取查询结果;比如,用户提交的查询请求是:查询年龄为23岁的人员姓名,服务器获得的查询结果是:年龄为23岁的人员姓名列表,则由该姓名列表生成的html格式的查询结果页面的树形文档结构如下:Wherein, the server obtains the query result according to the query request, including: the server query program queries the data in the database, file system or third-party system according to the query request, and obtains the query result; for example, the query request submitted by the user is: the query age is 23 years old The name of the person, the query result obtained by the server is: a list of names of people whose age is 23 years old, then the tree document structure of the query result page in html format generated by the name list is as follows:

Figure BDA00001738447800061
Figure BDA00001738447800061

其中“contentTable”为固定的ID编号,是生成查询结果页面时为查询结果页面中的表格对象设置的统一的标识;也即,所有查询结果页面的树形文档结构中,查询结果表格对象具有相同的固定标识。Among them, "contentTable" is a fixed ID number, which is a unified identifier set for the table objects in the query result page when the query result page is generated; that is, in the tree document structure of all query result pages, the query result table objects have the same fixed identifier.

其中,服务器侧的查询程序根据查询请求中的当前页码和每页记录数目的指示获取对应的查询结果,该处理方式属于现有技术的内容。Wherein, the query program on the server side obtains the corresponding query result according to the indication of the current page number and the number of records per page in the query request, and this processing method belongs to the content of the prior art.

步骤S20进一步包括下述特点:Step S20 further includes the following features:

其中,判断所述查询请求是否包含导出标识,如果不包含,则将所述查询结果页面作为响应返回到客户端,其中,将所述查询结果页面作为查询响应返回到客户端是现有技术中服务器端响应客户端查询请求的常规处理方式;Wherein, judging whether the query request includes an export identifier, if not, returning the query result page to the client as a response, wherein returning the query result page to the client as a query response is a prior art The normal processing method for the server to respond to the query request of the client;

其中,将查询结果页面响应信息转化为文档对象模型(Document ObjectModel,DOM),在该文档对象模型中根据所述统一的标识定位到表格对象,将所述表格对象转换为报表文件;Wherein, the query result page response information is converted into a Document Object Model (Document ObjectModel, DOM), in which the form object is located according to the unified identification, and the form object is converted into a report file;

其中,所述报表文件记录的表格与查询结果页面中的表格,二者的显示完全一样;Wherein, the table recorded in the report file is exactly the same as the table in the query result page;

其中,所述报表文件为EXCEL格式的报表文件;Wherein, the report file is a report file in EXCEL format;

比如,如图4所示,以HTML格式的查询结果页面响应为例,由于html格式的页面文件是一种树形结构的文档,因此能够先将其转换为DOM结构的对象,在DOM对象模型中找到ID属性为“contentTable”的表格对象,根据该表格对象的行列信息创建excel报表文件对象,循环获取所述表格对象中的每一行和每一列,将列数据写入到excel报表文件中的单元格。For example, as shown in Figure 4, taking the query result page response in HTML format as an example, since the page file in HTML format is a tree-structured document, it can be converted into an object of DOM structure first, and in the DOM object model Find the table object whose ID attribute is "contentTable", create an excel report file object according to the row and column information of the table object, loop through each row and column in the table object, and write the column data into the excel report file Cell.

步骤S30进一步包括下述特点:Step S30 further includes the following features:

其中,服务器将报表文件以数据流的方式返回到客户端,供客户端进行文件下载。Wherein, the server returns the report file to the client in the form of data stream for the client to download the file.

如图5所示,本发明实施例提供了一种从web查询系统导出报表的方法,该方法包括:As shown in Figure 5, an embodiment of the present invention provides a method for exporting a report form from a web query system, the method comprising:

S10,客户端检测到用户在当前查询结果界面上触发了报表导出操作后,修改原始查询请求,所述修改包括:在其中增加导出标识,其中,所述原始查询请求是之前为了获取当前查询结果所提交的查询请求;将修改后的查询请求发送给服务器;接收服务器端返回的包含报表文件的查询响应,所述报表文件记录了要导出的查询结果页面中的表格对象;S10, after the client detects that the user has triggered the report export operation on the current query result interface, it modifies the original query request, the modification includes: adding an export identifier, wherein the original query request is for obtaining the current query result The submitted query request; sending the modified query request to the server; receiving the query response returned by the server and including the report file, the report file records the form object in the query result page to be exported;

S20,服务器接收到客户端发送的查询请求,获取查询结果并生成查询结果页面,在生成查询结果页面时为查询结果页面中的表格对象设置统一的标识;如所述查询请求包含导出标识,将所述查询结果页面转换为文档对象模型,根据所述统一的标识定位到文档对象模型中的表格对象,将所述文档对象模型中的表格对象转换为报表文件;将所述报表文件携带在查询响应中返回到客户端。S20, the server receives the query request sent by the client, obtains the query result and generates a query result page, and sets a unified identifier for the table objects in the query result page when generating the query result page; if the query request includes an export identifier, the The query result page is converted into a document object model, and the form object in the document object model is located according to the unified identification, and the form object in the document object model is converted into a report file; the report file is carried in the query The response is returned to the client.

如图6所示,本发明实施例提供了一种从web查询系统导出报表的装置,应用于客户端上,该装置包括:As shown in Figure 6, the embodiment of the present invention provides a device for exporting reports from the web query system, which is applied to the client, and the device includes:

检测模块,用于检测到用户在当前查询结果界面上触发了报表导出操作后,修改原始查询请求,所述修改包括:在其中增加导出标识,其中,所述原始查询请求是之前为了获取当前查询结果所提交的查询请求;The detection module is used to modify the original query request after detecting that the user triggers the report export operation on the current query result interface, the modification includes: adding an export identifier, wherein the original query request was previously used to obtain the current query result of the submitted query request;

发送模块,用于将修改后的查询请求发送给服务器;A sending module, configured to send the modified query request to the server;

接收模块,用于接收服务器端返回的包含报表文件的查询响应,所述报表文件记录了要导出的查询结果页面中的表格对象。The receiving module is used to receive the query response returned by the server and includes the report file, and the report file records the table objects in the query result page to be exported.

其中,所述修改原始查询请求,还包括:如果用户触发的报表导出操作是要导出全部查询结果且当前查询页面是分页的数据,则将原始查询请求中的当前页码设置为首页,且将每页记录数目设置为查询系统性能允许的最大值。Wherein, the modification of the original query request also includes: if the report export operation triggered by the user is to export all query results and the current query page is paged data, then setting the current page number in the original query request as the home page, and setting each The number of page records is set to the maximum value allowed by the query system performance.

如图7所示,本发明实施例提供了一种从web查询系统导出报表的装置,应用于服务器上,该装置包括:As shown in Figure 7, the embodiment of the present invention provides a device for exporting reports from the web query system, which is applied to the server, and the device includes:

接收模块,用于接收到客户端发送的查询请求,获取查询结果并生成查询结果页面,为查询结果页面中的表格对象设置统一的标识;The receiving module is used to receive the query request sent by the client, obtain the query result and generate a query result page, and set a unified identification for the table object in the query result page;

转换模块,用于如所述查询请求包含导出标识,将所述查询结果页面转换为文档对象模型,根据所述统一的标识定位到文档对象模型中的表格对象,将所述文档对象模型中的表格对象转换为报表文件;The conversion module is configured to convert the query result page into a document object model if the query request includes an export identifier, locate the table object in the document object model according to the unified identifier, and convert the table object in the document object model to Table objects are converted to report files;

发送模块,用于将所述报表文件携带在查询响应中返回到客户端。A sending module, configured to carry the report file in the query response and return it to the client.

其中,所述报表文件为EXCEL格式的报表文件。Wherein, the report file is a report file in EXCEL format.

如图8所示,本发明实施例提供了一种从web查询系统导出报表的系统,该系统包括:As shown in Figure 8, an embodiment of the present invention provides a system for exporting reports from a web query system, the system includes:

客户端,用于检测到用户在当前查询结果界面上触发了报表导出操作后,修改原始查询请求,所述修改包括:在其中增加导出标识,其中,所述原始查询请求是之前为了获取当前查询结果所提交的查询请求;将修改后的查询请求发送给服务器;接收服务器端返回的包含报表文件的查询响应,所述报表文件记录了要导出的查询结果页面中的表格对象;The client is used to modify the original query request after detecting that the user has triggered the report export operation on the current query result interface. result submitted query request; send the modified query request to the server; receive the query response returned by the server and include the report file, the report file records the form object in the query result page to be exported;

服务器,用于接收到客户端发送的查询请求,获取查询结果并生成查询结果页面,在生成查询结果页面时为查询结果页面中的表格对象设置统一的标识;如所述查询请求包含导出标识,将所述查询结果页面转换为文档对象模型,根据所述统一的标识定位到文档对象模型中的表格对象,将所述文档对象模型中的表格对象转换为报表文件;将所述报表文件携带在查询响应中返回到客户端。The server is configured to receive the query request sent by the client, obtain the query result and generate a query result page, and set a unified identifier for the table object in the query result page when generating the query result page; if the query request includes an export identifier, Converting the query result page into a document object model, locating the form object in the document object model according to the unified identification, converting the form object in the document object model into a report file; carrying the report file in returned to the client in the query response.

上述实施例提供的一种从web查询系统导出报表的方法和装置,通过客户端在检测到用户触发了导出报表的操作后对查询请求的过滤处理,服务器端在判断出查询请求中携带导出标识后对查询结果页面响应的拦截,将响应转换为文档对象模型,在文档对象模型中定位到表格对象,将表格对象转换为报表文件作为响应返回到客户端。利用本发明实现报表导出,可以达到对服务器端查询程序无侵入,不受服务端编程语言类型的限制,不受后台数据来源的限制,可以让系统以最小的改动实现所见即所得的报表文件的导出,大大提高web查询系统开发和维护的效率。In the method and device for exporting reports from the web query system provided by the above embodiments, the client filters the query request after detecting that the user triggers the operation of exporting the report, and the server determines that the query request carries an export identifier After intercepting the response to the query result page, convert the response into a document object model, locate the form object in the document object model, convert the form object into a report file and return it to the client as a response. Utilizing the present invention to achieve report export can achieve no intrusion into the server-side query program, is not limited by the type of server-side programming language, and is not limited by the source of background data, allowing the system to realize WYSIWYG report files with minimal changes The export can greatly improve the efficiency of web query system development and maintenance.

本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现,相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本发明不限制于任何特定形式的硬件和软件的结合。Those skilled in the art can understand that all or part of the steps in the above method can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk or an optical disk, and the like. Optionally, all or part of the steps in the above embodiments can also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiments can be implemented in the form of hardware, or can be implemented in the form of software function modules. The form is realized. The present invention is not limited to any specific combination of hardware and software.

需要说明的是,本发明还可有其他多种实施例,在不背离本发明精神及其实质的情况下,熟悉本领域的技术人员可根据本发明作出各种相应的改变和变形,但这些相应的改变和变形都应属于本发明所附的权利要求的保护范围。It should be noted that the present invention can also have other various embodiments, without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and deformations according to the present invention, but these Corresponding changes and deformations should belong to the scope of protection of the appended claims of the present invention.

Claims (10)

1. a method that derives form from the web inquiry system, be applied on client, and the method comprises:
After the user being detected and having triggered form derive operation on current Query Result interface, revise original query, described modification comprises: increases therein and derives sign, wherein, the inquiry request that described original query is submitted in order to obtain current Query Result before being;
Amended inquiry request is sent to server;
The inquiry response that comprises report file that the reception server end returns, described report file has recorded the table objects in the Query Result page that will derive.
2. the method for claim 1 is characterized in that:
Described modification original query also comprises:
If it is will derive whole Query Results and current query page is the data of paging that the form that the user triggers is derived operation, the current page number in original query is set to homepage, and every page of record count is set to the maximal value that the inquiry system performance allows.
3. a method that derives form from the web inquiry system, be applied on server, and the method comprises:
Receive the inquiry request that client sends, obtain Query Result generated query results page, be that the table objects in the Query Result page arranges unified sign when the generated query results page;
As described in inquiry request comprise and derive sign, by described Query Result conversion of page, be DOM Document Object Model, to the table objects in DOM Document Object Model, the table objects in described DOM Document Object Model is converted to report file according to described unified mark location;
Described report file is carried in inquiry response and turns back to client.
4. method as claimed in claim 3 is characterized in that:
The report file that described report file is the EXCEL form.
5. a method that derives form from the web inquiry system, the method comprises:
The be applied to method from web inquiry system derivation form client on of client executing described in claim 1 or 2;
Server end is carried out the method from web inquiry system derivation form on server that is applied to described in claim 3 or 4.
6. a device of deriving form from the web inquiry system is applied to, on client, comprising:
Detection module, for detection of triggered form derivation operation on current Query Result interface to the user after, revise original query, described modification comprises: increase therein derivation and identify, wherein, the inquiry request that described original query is submitted in order to obtain current Query Result before being;
Sending module, for sending to server by amended inquiry request;
Receiver module, the inquiry response that comprises report file returned for the reception server end, described report file has recorded the table objects in the Query Result page that will derive.
7. device as claimed in claim 6 is characterized in that:
Described modification original query also comprises:
If it is will derive whole Query Results and current query page is the data of paging that the form that the user triggers is derived operation, the current page number in original query is set to homepage, and every page of record count is set to the maximal value that the inquiry system performance allows.
8. a device of deriving form from the web inquiry system is applied to, on server, comprising:
Receiver module, the inquiry request sent for receiving client, obtain Query Result generated query results page, when the generated query results page, is that the table objects in the Query Result page arranges unified sign;
Modular converter, for as described in inquiry request comprise and derive sign, be DOM Document Object Model by described Query Result conversion of page, according to described unified mark location, to the table objects in DOM Document Object Model, the table objects in described DOM Document Object Model be converted to report file;
Sending module, turn back to client for described report file is carried to inquiry response.
9. device as claimed in claim 8 is characterized in that:
The report file that described report file is the EXCEL form.
10. a system that derives form from the web inquiry system comprises:
The device from web inquiry system derivation form be applied on client as described as claim 6 or 7; Reach the device from web inquiry system derivation form be applied to as claimed in claim 8 or 9 on server.
CN201210186444.XA 2012-06-07 2012-06-07 A kind of method, apparatus and system from web-query system export report Expired - Fee Related CN103473234B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210186444.XA CN103473234B (en) 2012-06-07 2012-06-07 A kind of method, apparatus and system from web-query system export report

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210186444.XA CN103473234B (en) 2012-06-07 2012-06-07 A kind of method, apparatus and system from web-query system export report

Publications (2)

Publication Number Publication Date
CN103473234A true CN103473234A (en) 2013-12-25
CN103473234B CN103473234B (en) 2018-07-06

Family

ID=49798090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210186444.XA Expired - Fee Related CN103473234B (en) 2012-06-07 2012-06-07 A kind of method, apparatus and system from web-query system export report

Country Status (1)

Country Link
CN (1) CN103473234B (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105446944A (en) * 2015-11-12 2016-03-30 国云科技股份有限公司 Method of Exporting HTML Table to EXCEL Based on JavaScript
CN107463623A (en) * 2017-07-06 2017-12-12 积成电子股份有限公司 A kind of dynamic query method of transformer station's historical events database
CN107784085A (en) * 2017-09-30 2018-03-09 平安科技(深圳)有限公司 The deriving method and its terminal of a kind of data list
CN109885729A (en) * 2019-02-20 2019-06-14 北京奇艺世纪科技有限公司 A kind of method, apparatus and system showing data
CN110737711A (en) * 2019-10-14 2020-01-31 平安医疗健康管理股份有限公司 Report exporting method and device, computer equipment and storage medium
CN110807056A (en) * 2019-10-28 2020-02-18 长城计算机软件与系统有限公司 Excel-based report processing method, Excel-based report processing device, Excel-based report processing medium and electronic equipment
CN111352951A (en) * 2020-02-26 2020-06-30 苏宁云计算有限公司 Data export method, device and system
CN111556039A (en) * 2020-04-21 2020-08-18 南京行者易智能交通科技有限公司 Web data export method and device for general microservice
CN112632165A (en) * 2020-12-22 2021-04-09 平安普惠企业管理有限公司 Page form export EXCEL method and device, computer equipment and storage medium
CN112632006A (en) * 2020-12-18 2021-04-09 平安普惠企业管理有限公司 Electronic report file export method, device, equipment and storage medium
CN112836148A (en) * 2021-02-26 2021-05-25 腾讯科技(深圳)有限公司 Report display method and device, storage medium and electronic equipment
CN115544416A (en) * 2022-09-26 2022-12-30 百卓网络科技有限公司 Custom export method based on WEB terminal HTML (hypertext markup language) to Excel (Excel)
CN118302753A (en) * 2021-09-24 2024-07-05 谷歌有限责任公司 Self-service spreadsheet creation
US12493738B2 (en) 2021-09-24 2025-12-09 Google Llc Personalized autonomous spreadsheets
US12547823B2 (en) 2021-09-24 2026-02-10 Google Llc Dynamically and selectively updated spreadsheets based on knowledge monitoring and natural language processing

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588369A (en) * 2004-09-06 2005-03-02 杭州恒生电子股份有限公司 Relation type data base system and its search and report method
CN101727436A (en) * 2008-10-29 2010-06-09 华为技术有限公司 Report data processing method, report system and related device
CN101650712A (en) * 2009-08-18 2010-02-17 深圳市科陆电子科技股份有限公司 Generating management method and system of self-defined report
CN101650745A (en) * 2009-09-10 2010-02-17 中兴通讯股份有限公司 Method and device for rapidly generating WEB page based on data definition

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘伟: "基于XML技术的WEB报表生成", 《中国优秀博硕士学位论文全文数据库》 *
沈才梁: "WEB页面动态表格数据导入Excel的JavaScrip实现", 《电脑开发与应用》 *

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105446944A (en) * 2015-11-12 2016-03-30 国云科技股份有限公司 Method of Exporting HTML Table to EXCEL Based on JavaScript
CN107463623A (en) * 2017-07-06 2017-12-12 积成电子股份有限公司 A kind of dynamic query method of transformer station's historical events database
CN107463623B (en) * 2017-07-06 2020-06-09 积成电子股份有限公司 Dynamic query method for historical item database of transformer substation
CN107784085B (en) * 2017-09-30 2021-04-13 平安科技(深圳)有限公司 Data list exporting method and terminal thereof
CN107784085A (en) * 2017-09-30 2018-03-09 平安科技(深圳)有限公司 The deriving method and its terminal of a kind of data list
WO2019062019A1 (en) * 2017-09-30 2019-04-04 平安科技(深圳)有限公司 Data list exporting method and terminal using same
CN109885729A (en) * 2019-02-20 2019-06-14 北京奇艺世纪科技有限公司 A kind of method, apparatus and system showing data
CN109885729B (en) * 2019-02-20 2021-07-20 北京奇艺世纪科技有限公司 Method, device and system for displaying data
CN110737711A (en) * 2019-10-14 2020-01-31 平安医疗健康管理股份有限公司 Report exporting method and device, computer equipment and storage medium
CN110807056A (en) * 2019-10-28 2020-02-18 长城计算机软件与系统有限公司 Excel-based report processing method, Excel-based report processing device, Excel-based report processing medium and electronic equipment
CN111352951A (en) * 2020-02-26 2020-06-30 苏宁云计算有限公司 Data export method, device and system
CN111556039B (en) * 2020-04-21 2021-04-09 南京行者易智能交通科技有限公司 Web data export method and device for general microservice
CN111556039A (en) * 2020-04-21 2020-08-18 南京行者易智能交通科技有限公司 Web data export method and device for general microservice
CN112632006A (en) * 2020-12-18 2021-04-09 平安普惠企业管理有限公司 Electronic report file export method, device, equipment and storage medium
CN112632165A (en) * 2020-12-22 2021-04-09 平安普惠企业管理有限公司 Page form export EXCEL method and device, computer equipment and storage medium
CN112836148A (en) * 2021-02-26 2021-05-25 腾讯科技(深圳)有限公司 Report display method and device, storage medium and electronic equipment
CN112836148B (en) * 2021-02-26 2023-12-12 腾讯科技(深圳)有限公司 Report display method and device, storage medium and electronic equipment
CN118302753A (en) * 2021-09-24 2024-07-05 谷歌有限责任公司 Self-service spreadsheet creation
US12493738B2 (en) 2021-09-24 2025-12-09 Google Llc Personalized autonomous spreadsheets
US12499307B2 (en) 2021-09-24 2025-12-16 Google Llc Autonomous spreadsheet creation
US12547823B2 (en) 2021-09-24 2026-02-10 Google Llc Dynamically and selectively updated spreadsheets based on knowledge monitoring and natural language processing
CN115544416A (en) * 2022-09-26 2022-12-30 百卓网络科技有限公司 Custom export method based on WEB terminal HTML (hypertext markup language) to Excel (Excel)

Also Published As

Publication number Publication date
CN103473234B (en) 2018-07-06

Similar Documents

Publication Publication Date Title
CN103473234B (en) A kind of method, apparatus and system from web-query system export report
CN103631969B (en) A kind of generation method and device of report data
CN111782731B (en) Data synchronization method and device
CN110162408B (en) Data processing method, device, equipment and machine-readable medium
CN109033406B (en) Method, apparatus and storage medium for searching blockchain data
CN102164186B (en) Method and system for realizing cloud search service
CN106202096A (en) Customer terminal webpage rendering intent and device
US8713368B2 (en) Methods for testing OData services
US10430490B1 (en) Methods and systems for providing custom crawl-time metadata
CN108762743A (en) Data table operation code generation method and device
CN108228743A (en) Real-time big data search engine system
CN111339171A (en) Data query method, device and device
CN103020322A (en) Query method
CN105468511A (en) Web page script error positioning method and apparatus
CN104598622A (en) Method and system for implementing data modification log as well as application server
CN112417225A (en) Joint query method and system for multi-source heterogeneous data
CN111078213A (en) Code generation method and code generation device
CN115061851A (en) Data verification method and device, storage medium and electronic equipment
US8954438B1 (en) Structured metadata extraction
CN111611011B (en) JSON syntax extension method and analysis method and device supporting Blob data types
CN103793464A (en) Method for exporting reports on basis of neutral formats
US12536165B2 (en) Systems and methods for querying multiple databases
CN110851346B (en) Query statement boundary problem detection method, device, equipment and storage medium
CN112527976B (en) A data processing method and device
CN113157726A (en) Database processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180706