简体   繁体   English

C#如何打开保存在MemoryStream中的文件(工作簿)而不将其实际保存在服务器中?

[英]C# How to open a file(workbook) which u saved in a MemoryStream without having it saved actually in a server?

I want to Open a file (show an Excel file for user) without having it saved in my computer/server to open it from memory. 我想打开一个文件(显示用户的Excel文件)而不将其保存在我的计算机/服务器中以从内存中打开它。 So far i came up with this code which saves file to MemoryStream: 到目前为止,我想出了这个将文件保存到MemoryStream的代码:

MemoryStream memoryStream = new MemoryStream();
wb.SaveAs(memoryStream);

So how to open/show a Excel file which is saved in the memory stream 那么如何打开/显示保存在内存流中的Excel文件

The Excel application can't read from a MemoryStream. Excel应用程序无法从MemoryStream中读取。

You will have to write the file onto disk, maybe into a temporary directory. 您必须将文件写入磁盘,也可以写入临时目录。

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

相关问题 C#Memorystream没有完全保存到文件 - C# Memorystream is not fully saved to the file 如何在asp.net C#应用程序中打开保存在本地目录/文件夹中的文件 - How to open file which saved on local directory/ folder in asp.net C# application 如何将ac#对象附加到excel工作表并在保存工作簿时保存它 - how to attach a c# object to an excel worksheet and have it saved when the workbook is saved 如何在C#中对DigitalPersona u.ere.u 4500的指纹进行序列化/反序列化并保存到数据库 - How to Serialize-Deserialize the fingerprint of DigitalPersona u.ere.u 4500 in C# and saved to a database 自动保存已使用计时器保存的C#文件 - auto save file which is already saved C# using timer 如何将保存到文件的数据与保存到另一个文件的其他数据绑定 c# - How to bind data that is saved to a file with other data that is saved to another file c# C#Sql Server Express未永久保存 - C# Sql Server Express not Saved Permanently 如何将新项目附加到保存在C#文本文件中的KeyValuePair中 - How to append new items to KeyValuePair saved in text file in C# 如何在C#MVC中包含保存的xml文件 - How to include saved xml file in c# MVC 如何匹配以字节c#保存的数据库上所有保存的指纹 - How to match all saved fingerprints on database saved in bytes c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM