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
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
CrishPosted Dec 10, 2010, 6:08 AM
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
Gomathi PalaniswamyPosted Dec 7, 2010, 7:41 AM
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);
}