We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

XlsIO doesn't respect Excel's "Allow users to edit ranges" option when loading excel files

Thread ID:





144011 Apr 14,2019 08:38 PM UTC Apr 15,2019 12:59 PM UTC UWP 1
Tags: XlsIO
Muhammad Yaseen
Asked On April 14, 2019 08:38 PM UTC

I want the users to be able to mark certain areas to be locked in their templates, but it seems that Xlsio sets Range.CellStyle.Locked property to false by default even if you mark the range to be editable in Excel. Is there a way to fix that?
Here is my code:

ExcelEngine excelEngine = new ExcelEngine();
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Template.xlsx", UriKind.Absolute));
//Loads or open an existing workbook
IWorkbook workbook = await excelEngine.Excel.Workbooks.OpenAsync(file);
workbook.Version = ExcelVersion.Excel2013;
workbook.Protect(true, true, "111");
foreach(var sheet in workbook.Worksheets)
//Initializes FileSavePicker
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "output";
savePicker.FileTypeChoices.Add("Excel Files", new List() { ".xlsx" });
//Creates a storage file from FileSavePicker
StorageFile outputStorageFile = await savePicker.PickSaveFileAsync();
//Saves changes to the specified storage file
await workbook.SaveAsAsync(outputStorageFile);

Attachment: XlsioProtectRepro_90df710e.zip

Abirami Varadharajan [Syncfusion]
Replied On April 15, 2019 12:59 PM UTC

Hi Muhammad,

We don’t have support for “Allow users to edit ranges” feature. However, you can edit the desired range in the worksheet by unlocking it(i.e., by setting Locked property of CellStyle to false). We have modified the sample as per your requirement which can be downloaded from following link. 

Kindly try and let us know if this helps at your end. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon