在WCF服务中导出为ex​​cel代码 [英] Export to excel code in WCF service

查看:64
本文介绍了在WCF服务中导出为ex​​cel代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将数据导出到WCF服务中。想要在单个呼叫中生成超过10,000的excel文件。这个操作应该很快。



我尝试过:





我创建了单向WCF服务。我在服务端处理了所有数据。

我也使用本地报告(用于格式化和导出的rdlc)将数据导出到excel但是没有。时间(即超过10000)我将数据导出到excel,这需要花费大量时间使用rdlc生成,并且rdlc也有内存泄漏问题。



那么有什么解决方案吗?请帮忙。



谢谢。

How export data to excel in WCF Service. Want to generate excel file more than 10,000 in single call. This operation should be fast.

What I have tried:

Hi,
I created one way WCF service. In which I processed all data at service side.
Also I was exporting data to excel using local report (rdlc used for formatting and exporting) but for no. of times (i.e more than 10000) I'm exporting data to excel, which takes a lot of time to generate using rdlc and also rdlc have memory leak problem.

So is there any solution ? Please help.

Thanks.

推荐答案

这是我做的第一种方式:



0)向服务器发送请求以生成文件。



1)正如 F-ES Sitecore [ ^ ],让服务器使用Excel ODBC驱动程序生成Excel文件,并使用以下命令保存文件名称的GUID,例如 EE430293-3460-4251-AD14-84E4E99B6E8E.xlsx (不可猜测且始终唯一)。



2)文件准备好后联系客户端(在消息中提供文件名)



3)然后客户端可以使用一些安全的方法,比如SFTP。



4)经过一段时间(24小时?)后,服务器可以自动删除文件是为了自我维护。



这样,您的服务器完成了创建文件的所有工作,并且只允许客户端知道文件名,这一点,可以请求(由客户)实际转移。



另一种选择,而不是使用实际的Excel文件,是让数据库将结果集作为XML返回,也是一种与Excel兼容的格式。这样,根本不需要ODBC(甚至可能更快)。
This is the first way I would do it:

0) Send a request to the server to generate the file.

1) As mention by F-ES Sitecore[^], have the server generate the Excel file using the Excel ODBC driver, and save the file using a GUID for the name, such as EE430293-3460-4251-AD14-84E4E99B6E8E.xlsx (un-guessable and always unique).

2) Contact the client when the file is ready (providing the filename in the message)

3) The client can then transfer the file using some secure means, such as SFTP.

4) After a certain amount of time (24 hours?), the server can automatically delete the file in the interest of self-maintenance.

This way, your the server does all the work creating the file, and simply allows the client to know the filename, at which point, an actual transfer can be requested (by the client).

Another option instead of using an actual Excel file is to have the database return the result set as XML, with is an Excel-compatible format as well. That way, there's no need for ODBC at all (and it might even be faster).


这篇关于在WCF服务中导出为ex​​cel代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆