If you already have SQL Server, then you've got SQL Server Reporting Services. It doesn't require any additional licensing. It can export to PDF, Excel and more.
Edit: I should add that there is a bit of a learning curve if you've never worked with reporting tools such as Crystal before.
另请查看Data Dynamics 的 Active Reports.Net。它的成本比 SQL Server Reporting Services 稍高,但更易于使用,直接集成到 Visual Studio 中,并且输出只是现有程序集中的更多 IL 代码,或者成为解决方案一部分的另一个托管代码 IL 程序集。 ..当然可以自由分发且免版税。
Also check out Active Reports.Net from Data Dynamics. It costs a bit more than SQL server Reporting Services, but it is easier to use, integrates directly into Visual Studio, and the output is just more IL code in your existing assembly, or another managed code IL assembly that becomes part of your solution... which is of course freely distributable and royalty free.
也就是说,随着 Office 2007 和基于 XML 的格式(在 Office 2003 中也可用)的广泛采用,生成 EXCEL 文档并不那么困难,尽管学习所需的 XML 文件可能会很耗时。好消息是,这对于 winforms/WPF 和 ASP.NET 应用程序都可以完成。
现在,要从 ASP.NET 应用程序获取 PDF,您有多种选择,其中包括手动生成 PDF(PDF 是开放标准)或使用诸如 iText.Net。就我个人而言,我总是对 iText.Net 及其兄弟库保持警惕,因为我的经验表明它们是资源消耗者。
If this is a WINFORMS or WPF application (i.e. NOT ASP.NET) then you can get that functionality from the native REPORTING controls from within .NET. The winforms REPORT control exports to both EXCEL and PDF, though the EXCEL export is not exactly as... functional as one would expect. Be aware, I'm not certain how much of this functionality is available on ASP.NET without utilizing the full SQL SERVER Reporting Services.
That said, with the somewhat wide-scale adoption of Office 2007 and the XML-based formats (which are also available in Office 2003) generating an EXCEL document is not that hard, though learning the required XML files can be time consuming. The good news is that this can be done for both winforms/WPF and ASP.NET applications.
Now to get PDFs from an ASP.NET application, then you've got a number of options, among them generating it manually (PDF is an open standard) or using a library such as iText.Net. Personally, I'm always wary of iText.Net and its sibling libraries as my experience have shown that they are something of resource hogs.
A few open source options I have used for Excel Reports:
If XLSX is a must: ExcelPackage is a good start but died off when the developer quit working on it. ExML picked up from there and added a few features. ExML isn't a bad option, I'm still using it in a couple of production websites.
For all of my new projects, though, I'm using NPOI, the .NET port of Apache POI. It doesn't have XLSX support yet but it is the only one under active development. It's also the fastest of the 3 options.
Also, take a look at the other answers on this question.
发布评论
评论(6)
如果您已经拥有 SQL Server,那么您就拥有了 SQL Server Reporting Services。它不需要任何额外的许可。它可以导出为 PDF、Excel 等。
编辑:我应该补充一点,如果您以前从未使用过 Crystal 等报告工具,那么会有一点学习曲线。
If you already have SQL Server, then you've got SQL Server Reporting Services. It doesn't require any additional licensing. It can export to PDF, Excel and more.
Edit: I should add that there is a bit of a learning curve if you've never worked with reporting tools such as Crystal before.
另请查看Data Dynamics 的 Active Reports.Net。它的成本比 SQL Server Reporting Services 稍高,但更易于使用,直接集成到 Visual Studio 中,并且输出只是现有程序集中的更多 IL 代码,或者成为解决方案一部分的另一个托管代码 IL 程序集。 ..当然可以自由分发且免版税。
Also check out Active Reports.Net from Data Dynamics. It costs a bit more than SQL server Reporting Services, but it is easier to use, integrates directly into Visual Studio, and the output is just more IL code in your existing assembly, or another managed code IL assembly that becomes part of your solution... which is of course freely distributable and royalty free.
如果这是一个 WINFORMS 或 WPF 应用程序(即不是 ASP.NET),那么您可以从 .NET 内的本机 REPORTING 控件获取该功能。 winforms REPORT 控件可以导出到 EXCEL 和 PDF,尽管 EXCEL 导出功能并不完全像人们所期望的那样。请注意,如果不使用完整的 SQL SERVER 报告服务,我不确定 ASP.NET 上可以使用多少此功能。
也就是说,随着 Office 2007 和基于 XML 的格式(在 Office 2003 中也可用)的广泛采用,生成 EXCEL 文档并不那么困难,尽管学习所需的 XML 文件可能会很耗时。好消息是,这对于 winforms/WPF 和 ASP.NET 应用程序都可以完成。
现在,要从 ASP.NET 应用程序获取 PDF,您有多种选择,其中包括手动生成 PDF(PDF 是开放标准)或使用诸如 iText.Net。就我个人而言,我总是对 iText.Net 及其兄弟库保持警惕,因为我的经验表明它们是资源消耗者。
If this is a WINFORMS or WPF application (i.e. NOT ASP.NET) then you can get that functionality from the native REPORTING controls from within .NET. The winforms REPORT control exports to both EXCEL and PDF, though the EXCEL export is not exactly as... functional as one would expect. Be aware, I'm not certain how much of this functionality is available on ASP.NET without utilizing the full SQL SERVER Reporting Services.
That said, with the somewhat wide-scale adoption of Office 2007 and the XML-based formats (which are also available in Office 2003) generating an EXCEL document is not that hard, though learning the required XML files can be time consuming. The good news is that this can be done for both winforms/WPF and ASP.NET applications.
Now to get PDFs from an ASP.NET application, then you've got a number of options, among them generating it manually (PDF is an open standard) or using a library such as iText.Net. Personally, I'm always wary of iText.Net and its sibling libraries as my experience have shown that they are something of resource hogs.
在我们的场景中,我们使用 iTextSharp 生成 PDF,并依靠 Excel 读取 HTML 格式表格的能力来生成电子表格。
我们提供扩展名为 .xls 的 HTML 文档,Excel 会读取它。
In our scenario we used iTextSharp for PDF generation and relied on Excel's ability to read a HTML formatted table for spread sheet generation.
We deliver an HTML document with the .xls extension and Excel reads it in.
我用于 Excel 报告的一些开源选项:
如果 XLSX 是必须的: ExcelPackage 是一个好的开始,但当开发人员停止开发它时就消失了。 ExML 借鉴了那里的经验并添加了一些功能。 ExML 不是一个坏选择,我仍在几个生产网站中使用它。
不过,对于我的所有新项目,我使用的是 NPOI,Apache POI。它尚不支持 XLSX,但它是唯一一个正在积极开发的产品。它也是 3 个选项中最快的。
另外,请查看此问题的其他答案。
A few open source options I have used for Excel Reports:
If XLSX is a must: ExcelPackage is a good start but died off when the developer quit working on it. ExML picked up from there and added a few features. ExML isn't a bad option, I'm still using it in a couple of production websites.
For all of my new projects, though, I'm using NPOI, the .NET port of Apache POI. It doesn't have XLSX support yet but it is the only one under active development. It's also the fastest of the 3 options.
Also, take a look at the other answers on this question.
如果您不需要传输公式,只需传输 Excel 中的数据,一个快速但肮脏的 Web 解决方案是这样的:
ASPX 页面:
代码隐藏:
这将在 Excel 中作为 CVS 打开。
YMMV,这是一个问答黑客。
If you don't need to transmit formulae, just data in Excel, a quick and dirty web solution is this:
ASPX page:
Code Behind:
This will open in excel as a CVS.
YMMV, it is a q&d hack.