I saw the post : I've got the same trouble when I save my document. Every cells that I allow users to edit ranges simply disappear. Since this post was written in 2005, maybe there is a fix in the new version ? I'm currently using Aspose.Cells for .NET v220.127.116.11.
I'm working in Societe Generale and we need this functionality to purchase the licence.
What I'm doing :
1. Creation of a template ProtectSheetTemplate.xlsm in which I only allow users to edit ranges (Columns D and E)
2. In my code I open the template and apply protection (I'm not using the Protect method)
This is my code:
Workbook workbook = new Workbook();
string templateFileName = Environment.CurrentDirectory + "\\ProtectSheetTemplate.xlsm";
Worksheet worksheet = workbook.Worksheets;
worksheet.Protection.Password = "test";
worksheet.Protection.IsFilteringAllowed = true;
worksheet.Protection.IsSelectingLockedCellsAllowed = true;
worksheet.Protection.IsSelectingUnlockedCellsAllowed = true;
worksheet.Protection.IsDeletingColumnsAllowed = false;
worksheet.Protection.IsDeletingRowsAllowed = false;
worksheet.Protection.IsEditingContentsAllowed = false;
worksheet.Protection.IsEditingObjectsAllowed = false;
worksheet.Protection.IsEditingScenariosAllowed = false;
worksheet.Protection.IsFormattingCellsAllowed = false;
worksheet.Protection.IsFormattingColumnsAllowed = false;
worksheet.Protection.IsFormattingRowsAllowed = false;
worksheet.Protection.IsInsertingColumnsAllowed = false;
worksheet.Protection.IsInsertingHyperlinksAllowed = false;
worksheet.Protection.IsInsertingRowsAllowed = false;
worksheet.Protection.IsSortingAllowed = false;
worksheet.Protection.IsUsingPivotTablesAllowed = false;
workbook.Save(Environment.CurrentDirectory + "\\ProtectSheet.xls", FileFormatType.ExcelXP);
Even if I only open the template and save the file with another name, all the edit ranges I previously allowed have simply disappeared in the output document.
My template is in attach file:
Thanks for your response.
This message was posted using Page2Forum (attachment) from Advanced Protection Settings since Excel XP - Aspose.Cells for .NET