Solved

Password enabled excel sheet

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
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.

734 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