Copy of workheet from workbook to workbook then protecting results in invalid "Unable to Edit" error

When I copy worksheets with locked cells into another workbook, cells on the first worksheet are not editable even though they aren't locked. The error message refers to a different worksheet where that particular cell is protected (ie. cell A1 on sheet one is not locked on sheet one but is locked on sheeet A2). If I go to another worksheet then come back to the first sheet in Excel, I no longer get the error message and the cells are editable.

I've attached example code exhibiting the issue. For the example to work, you have to use an Aspose.Cells.lic file, otherwise the worksheet will open to the "Evaluation" worksheet and you won't see the issue on the first worksheet. The output worksheet protectionissue.xlsx illustrates the issue. I also included a screenshot of the error message in screencapture.png.

Hi,

Please test your problem with the latest version:
Aspose.Cells for .NET v7.0.2.6 and let us know your feedback.

Still doesn’t work.

Hi,

Thanks for testing the issue with the latest version.

We have logged this issue in our database. We will look into it and fix the problem and update you asap.

This issue has been logged as CELLSNET-40083.

Hi,

As a workaround, please add a line before Saving the destination file, i.e..,
wbDestination.Worksheets.ActiveSheetIndex = 0;

It works fine as I tested.

And, we will continue to look into the issue to figure it out soon.

Thank you.

Hi,


Please try the attached version v7.0.2.7, we have fixed the issue now and you don’t need to add my suggested line any more.

Thank you.