导出Excel保护 [英] Export Excel with protection

查看:47
本文介绍了导出Excel保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要将gridview导出为ex​​cel。我使用以下代码同样

 Response.ClearContent(); 

Response.AddHeader(


content -disposition attachment; filename = MyExcelFile.xls);

Response.ContentType =


application / EXCEL;




StringWriter sw = new StringWriter();




HtmlTextWriter htw = new HtmlTextWriter(sw);

Gridview1.RenderControl(htw);

Response.Write(sw.ToString());

Response.End();









它从网格视图导出到excel.but excel需要是生成密码的受保护工作表,并隐藏代码中的一列。这是工资单..



谢谢..

解决方案

看看下面的链接可能会有所帮助

使用Visual Studio .NET在Excel工作簿上实现密码安全性 [ ^ ]


请参阅此内容以隐藏YOur Grid中的列:



http://aspsnippets.com/Articles/ASPNet-GridView-Export-to-Excel---Hide-Columns.aspx [ ^

Hi all,

I need to export gridview to excel .I am using the following code for the same

Response.ClearContent();
 
Response.AddHeader(
 

"content-disposition", "attachment; filename=MyExcelFile.xls"); 
 
Response.ContentType =
 

"application/excel";
 

 

StringWriter sw = new StringWriter();
 

 

HtmlTextWriter htw = new HtmlTextWriter(sw);
 
Gridview1.RenderControl(htw);
 
Response.Write(sw.ToString());
 
Response.End();





It gets exported from the grid view to the excel.but the excel needs to be protected sheet with the password generated and hide one column from the code.This is for payroll..

Thanks..

解决方案

Have a look at the below link may be it helps
Implementing Password Security on Excel Workbooks Using Visual Studio .NET[^]


Refer this For hide a column in YOur Grid:

http://aspsnippets.com/Articles/ASPNet-GridView-Export-to-Excel---Hide-Columns.aspx[^]


这篇关于导出Excel保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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