Reg: style.setLockedfalse) issue for merged cells

Hi,

On setting style.setLocked(false) for the merged cell,The cell alllows the user to edit but the protection message is thrown on clicking delete button.This issue does not exist for single cell,am able to delete content on clicking delete button.Can u plz provide solution for this .This is very critical for us.

Thanks & regards,

Geetha

Hi,


I think you are using Aspose.Cells for Java. Please give us your sample code and attach your template file(s) to show the issue, we will check your issue soon.

Thank you.

Hi,

It is because only part of cells in the merged cells have been set to unlocked in the merged areas. In fact this is Ms Excel’s behavior and you can reproduce it in excel manually:

Set A1 as unlocked, then merged A1:B2, then protect sheet. Now you can edit the content of merged area but cannot delete it.

To solve this issue, please make all cells in the merged area as unlocked, code may like:

Java


style = wb.createStyle();

style.setLocked(false);

cells.merge(0, 0, 2, 2);

for(int i=0; i<2; i++)

{

for(int j=0; j<2; j++)

{

cell = cells.get(i, j);

cell.setStyle(style);

}

}



Thanks Shakeel.. The issue got resolved.

Regards,

Geetha

Hi,

It’s good to know your issue is resolved now.

If you find any other problem or get any question, please feel free to ask, we will help you asap.