hi i have exported a datagrid to excel using asp4.0 , c#, now i need to protect that .xls file save on disk with a password through my code.
can any one send me the piece of code
thanks in advance
fazy
Setting pasword on a excel file
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Dec 7, 2010, 2:41 AM EST
Try this
public void SaveFile()
{
this.excelWorkbook.SaveAs(
this.excelWorkbook.FullName,
vk_format,
"",
vk_write_res_password,
vk_read_only,
null,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
null,
vk_add_to_mru,
null,null,vk_local);
}
CrishRank #1,487 · 1.1K reputationPosted Dec 10, 2010, 1:08 AM EST
This is very important thing.If you want to get more detail about setting password on a excel file just check this below link.
http://www.oraxcel.com/projects/encoffice/help/protect_excel.html