views:

162

answers:

2

Hello,

I need to export DataSet result to Excel file (using dataset, XSLT transformation and XML generation => XML spreadsheet). That's work, but I'd like to protect this sheet. The reader can only make change in some dropdown, in some cell but other change are not allowed. The only changes allowed are some specific cells (value or dropdown).

How can I do this ?

Thanks,

A: 

You could always lock the cells and protect the sheet with the Excel Interop. Somthing similar to:

sheet.get_Range("A1, N1").Locked = true;
sheet.Protect(....);
jwarzech
it's an XML spreadsheet and not an sheet created by Excel Interop
Kris-I
I'm assuming your talking about an Excel 2003 XML spreadsheet? You should still be able to connect to it via interop after its created and then do the locking as a final step.
jwarzech
A: 

For Excel 2003 and above you can develop the solution by saving a sample workbook as XML to provide a template as the basis for your XSLT template. If you protect the worksheet and add your drop downs etc. before saving, you should be able to work out what styles to give each cell in your generated data.

Excel 2003 does not allow the worksheet to be password protected but 2007 may have some encryption magic that gets round this.

mikemay