We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ws.getProtection().setAllowDeletingRow(true) not working

Hi,

I am protecting a worksheet, and allowing the user to insert and delete rows like this:

ws.protect(ProtectionType.ALL, “password1”, null);
ws.getProtection().setAllowInsertingRow(true);
ws.getProtection().setAllowDeletingRow(true);

But after exporting the workbook, Insert row is working, but delete row is giving a error. Screenshot attached :
Screenshot (49).png (5.1 KB)

Is there a solution for this problem?

@sandipanghosh111,

Thanks for the screenshot and sample code segment.

I evaluated your scenario/ case a bit using both Aspose.Cells and MS Excel (manually). I found when I performed the same task in MS Excel, it too does not allow to delete row(s) in the sheet, I got the same error message. You may confirm this by trying to perform the same task manually in MS Excel (click Review|Protect Sheet and specify your desired options, etc.) and you will find that it too does not allow to delete a row. In short, Aspose.Cells works the same way as per MS Excel. If you could accomplish the task in MS Excel manually, kindly save the file and provide us here (you may zip the file prior attaching) and provide us here with all the details (detailed steps using MS Excel options), we will check on how to do it via Aspose.Cells APIs.

Ok. Thank you.