Cell based protection - is this implemented?

Hi,

We have created a spreadsheet to send to clients. We have protection on our worksheet. All columns are locked, except for 3. These 3 columns are designed for the client to enter data into and send the spreadsheet back to us. All other columns have data in them to aid the client in populating the required columns.

When we insert our datatable, our protection gets overwritten. The entire worksheet is locked and the 3 columns can not have data entered into them.

Below is our code. If you require the designer file, let me know.

------------------------------------------------------------------------------

//
Excel excel = new Excel();
excel.Open(templatePath);

//
Worksheet sheet = excel.Worksheets[0];
sheet.Cells.ImportDataTable(inputTable, false, 1, 0);

//
string outputPath = @“E:” + DateTime.Now.ToString(“yyMMdd”) + “_Daily_Due_Jobs.xls”;

//
excel.Save(outputPath, FileFormatType.ExcelXP);


------------------------------------------------------------------------------

Thanks
Brendan

Hi Brendan,

Yes. Please email me your designer file. That will help me to understand your need and investigate this issue.

Thanks.

Hi Laurence,

I have emailed you our designer file. Can you please indicate if you have received this, and if so, what the progress of this issue is? The resolution of this issue will determine whether we purchase your component, or go with another provider.

Cheers
Brendan

Hi Brendan,

I will check it ASAP. And I think I could solve it within two days. Thanks for your patience.

Hi Brendan,

Have you tried our latest hotfix at

I have tested your file and haven’t found the problem you described.

If the problem still exists in your side, could you email me the worksheet protection password? That will help me to investigate your setting in the designer file.

Thanks.

@brendaningram,
Aspose.Excel is discarded now and a new product Aspose.Cells is introduced which has rich features and much better in performance. It supports all the latest features supported by current versions of MS Excel. This new product also supports protecting the cells as shown in the following sample code:

// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream("book1.xls", FileMode.Open);

// Instantiating a Workbook object
// Opening the Excel file through the file stream
Workbook excel = new Workbook(fstream);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = excel.Worksheets[0];

// Protecting the worksheet with a password
worksheet.Protect(ProtectionType.All, "aspose", null);

// Saving the modified Excel file in default format
excel.Save("output.out.xls", SaveFormat.Excel97To2003);

// Closing the file stream to free all resources
fstream.Close();

You may visit the following article where more details are available about protecting the worksheet:
Protecting Worksheets
Unprotect a Worksheet

Here is the link to the latest version of Aspose.Cells:
Aspose.Cells for .NET (Latest Version)

If you want to test the product feature readily, please download the ready to run solution here.