Solved

Password enabled excel sheet

Posted on 2010-08-19
5
507 Views
Last Modified: 2012-05-10
Hi,

I am creating an excel file in asp.net using xml schema defined by microsoft and downloading it ,everything is fine.I am able to create worksheet with data.But is there any way so that I can set password on any worksheet  i.e. protect worksheet as it happens in Microsoft excel.
It means when user try to open that excel file and try to modify the sheet password should be asked.



thanks
0
Comment
Question by:manujtechno
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 33472992
If you want an Excel password all you need is something like this:

using Microsoft.Office.Interop.Excel
 
//create your spreadsheet here...
 
WorkbookObject.Password = password;
WorkbookObject.SaveAs("spreadsheet.xls")



Workbook.Protect Method
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.protect(VS.80).aspx
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 33472999
Implementing Password Security on Excel Workbooks Using Visual Studio .NET
http://www.codeproject.com/KB/office/Excel_Security.aspx
0
 

Author Comment

by:manujtechno
ID: 33473054

Dear Dhaest,

In my above given problem I am not using excel object (excell.dll)....using xml schema in stringbuilder to create excel file.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 33473064
In that case, I'm not sure if it's possible....
0
 

Accepted Solution

by:
manujtechno earned 0 total points
ID: 33473164
After working a lot I go through the following way that I Create an Excel Workbook, set passwords, and then attempt to save it as an XML Spreadsheet. A dialog box appear informing  that password protected file can not be saved as xml.
I think this is ok because xml file is simply text file.So In my opinion password can not be set in this way.please go through message in bmp file.
passwordProtected.bmp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now