Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Password enabled excel sheet

Posted on 2010-08-19
5
Medium Priority
?
521 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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
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.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

688 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