简体   繁体   English

如何使用C#.net为Windows应用程序和使用C#ASP.NET的Web应用程序生成Excel文件

[英]how to generate excel file for a windows application using C# .net and a web application using C# ASP.NET

How to generate Excel file in the following 2 scenarios: 在以下两种情况下如何生成Excel文件:

  1. For a Windows application using C# or VB .NET 对于使用C#或VB .NET的Windows应用程序
  2. For a Web application using C# or VB ASP.NET 对于使用C#或VB ASP.NET的Web应用程序

BUT without creating a local copy of the file. 但是不创建文件的本地副本。 I want the Excel file to be generated in memory and open the file when generated. 我希望在内存中生成Excel文件,并在生成时打开文件。 In case of the Web application I want it to show the download prompt before opening the generated Excel file. 对于Web应用程序,我希望它在打开生成的Excel文件之前显示下载提示。

An example would be really appreciated. 一个例子将不胜感激。

Thanks 谢谢

SpreadsheetGear 2012 for .NET could do this. .NET的SpreadsheetGear 2012可以做到这一点。 As far as a web application goes, take a look at any of the Excel Reporting Samples , which all dynamically generate a workbook file, starting either from scratch or from an existing template workbook file. 就Web应用程序而言,请看一下任何Excel Reporting Samples ,它们都从头开始或从现有模板工作簿文件开始动态生成工作簿文件。 In either case, a "local copy" of the workbook is not generated on disk; 在这两种情况下,都不会在磁盘上生成工作簿的“本地副本”。 instead, a file is saved directly to Response.OutputStream , which would prompt the end-user to download the workbook file. 而是将文件直接保存到Response.OutputStream ,这将提示最终用户下载工作簿文件。

As far as a windows application goes, SpreadsheetGear 2012 for .NET can read/write workbook files from disk/byte array/stream as well as, if desired, provide a rich interactive spreadsheet UI via the WorkbookView and FormulaBar controls for Windows Forms and WPF. 就Windows应用程序而言,SpreadsheetGear 2012 for .NET可以从磁盘/字节数组/流中读取/写入工作簿文件,并且,如果需要,可以通过适用于Windows窗体和WPF的WorkbookView和FormulaBar控件提供丰富的交互式电子表格UI。 。 You might take a look at the following page for more information on these controls: http://www.spreadsheetgear.com/support/samples/windowsforms.aspx 您可以查看以下页面,以获取有关这些控件的更多信息: http : //www.spreadsheetgear.com/support/samples/windowsforms.aspx

Disclaimer: I work for SpreadsheetGear. 免责声明:我为SpreadsheetGear工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用C#在ASP.net Web应用程序的div中动态生成imagebutton? - How to dynamically generate imagebutton in div in ASP.net web application using C#? 如何在使用C#作为服务器代码的ASP.NET Web应用程序中使用WF(Windows Workflow Foundation) - How to use WF (Windows Workflow Foundation) in a ASP.NET web application using C# as Server Code 将XPath与ASP.NET C#Web应用程序一起使用 - Using XPath with ASP.NET C# Web Application 使用C#和asp.net的Web应用程序中的进度栏 - Progress bar in web application using C# and asp.net 使用asp.net C#Javascript使用Finerprint登录到Asp.net Web应用程序 - Login into Asp.net Web application with Finerprint using asp.net C# Javascript 如何在Web窗体应用程序中使用asp.net c#将Excel数据上载到具有自动递增ID字段的SQL Server表中? - How to upload Excel data into a SQL Server table with an auto incremented Id field using asp.net c# in a web forms application? c#使用asp.net web应用程序每天通过电子邮件发送上传的文件 - c# send uploaded file through email daily using asp.net web application 如何使用Asp.net 3.5和C#3.0创建动态多语言Web应用程序 - How to create dynamic multilingual web application using Asp.net 3.5 and c# 3.0 如何使用 asp.net 和 c# 从 web 应用程序向手机发送短信? - how to send sms to mobile from web application using asp.net and c#? 像asp.net中的会话一样,如何使用c#登录Windows应用程序? - How to login windows application using c# just like sessions in asp.net?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM