Hello all,
Ho can we write to Excel file using the username and password programmatically in asp.net C#
So, the Excel file has in its security one username that can be mentioned in the code with its password
Thanks
Maan
Hi askmaan,
I think you could use
WorkbookObject.Password = password; WorkbookObject.SaveAs("spreadsheet.xls")
to protect your excel, for more things you could refer to the following links.
http://forums.asp.net/t/1818309.aspx?Export+Excel+with+password+protected+sheet+in+asp+net+c+
http://stackoverflow.com/questions/915999/password-protecting-an-excel-file-in-c-sharp
I hope it’s useful to you.
Best Regards,
Weibo Zhang
Hi askmaan
Try this:
http://www.codeproject.com/Articles/14243/Implementing-Password-Security-on-Excel-Workbooks
You will have to use Microsoft.Interop.Office.Excel to use features of excel
See an example on it
http://dotnetmentors.com/c-sharp/how-to-export-sql-data-to-excel-using-microsoft-office-interop.aspx
you can use workbook.password property to set password.
If you just want to convert your DataTable to CSV
http://dotnetmentors.com/adonet/convert-datatable-to-csv-or-list-or-json-string.aspx