Solved

Password enabled excel sheet

Posted on 2010-08-19
5
505 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video teaches users how to migrate an existing Wordpress website to a new domain.
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.

760 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

19 Experts available now in Live!

Get 1:1 Help Now