i have a .net c# application in which im downloading one excel file on button click. the code im using is
using NPOI.HSSF.UserModel;
using NPOI.HSSF.Util;
using NPOI.SS.UserModel;
then some codes.
HSSFWorkbook book = new HSSFWorkbook();
var sheet = book.CreateSheet("StatusReport");
some code for formatting the excel,then some code for downloading the excel.
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Charset = "utf-16";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250");
HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "MpiDischargeReport.xls"));
HttpContext.Current.Response.ContentType = "application/ms-excel";
book.Write(HttpContext.Current.Response.OutputStream);
HttpContext.Current.ApplicationInstance.CompleteRequest();
this will help me to download the excel,but i need to make that excel as a password protected one. please help.