Solved

Password enabled excel sheet

Posted on 2010-08-19
5
519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
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…
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 PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

635 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