如何在Windows应用程序中打开c#中的excel文件 [英] how to open a excel file in c# in windows application

查看:60
本文介绍了如何在Windows应用程序中打开c#中的excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows应用程序中的c#中打开excel文件

how to open a excel file in c# in windows application

推荐答案

请尝试使用 GOOGLE [ ^ ]



http://www.dotnetperls.com/excel [ ^ ]

http ://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.open.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/ms173186(v=vs.80).aspx [ ^ ]

使用C#进行Excel导航和导航 [ ^ ]
Please try to use GOOGLE[^]

http://www.dotnetperls.com/excel[^]
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.open.aspx[^]
http://msdn.microsoft.com/en-us/library/ms173186(v=vs.80).aspx[^]
Opening and Navigating Excel with C#[^]


string excelFilePath =YourExcelFilePath;

System.IO.FileInfo file = new System.IO.FileInfo(excelFilePath);



if(file.Exists)

{

Response.Clear();

Response.AddHeader(Content-Disposition,附件; filename =+ file.Name);

Response.AddHeader(Content-Length,file.Length.ToString());

Response.ContentType =application / octet-stream;

Response.WriteFile(file.FullName);

Response.End();

}
string excelFilePath = "YourExcelFilePath";
System.IO.FileInfo file = new System.IO.FileInfo(excelFilePath);

if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}


这篇关于如何在Windows应用程序中打开c#中的excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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