You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using NPOI version 2.5.5 and have run into an issue while attempting to write a value to a locked cell. I am using a simple test project with a workbook that contains Sheet1 and Sheet2. Sheet1 is protected, hidden and contains one cell which is locked and hidden. The workbook structure is password protected as well.
'cell.CellStyle.IsLocked' always returns false, even if the cell is locked in the workbook.
after setting the cell value in the last line and saving file, when opening in excel, the workbook structure protection is lost and the cell style is set to unlocked. The value is written correctly.
The text was updated successfully, but these errors were encountered:
I am using NPOI version 2.5.5 and have run into an issue while attempting to write a value to a locked cell. I am using a simple test project with a workbook that contains Sheet1 and Sheet2. Sheet1 is protected, hidden and contains one cell which is locked and hidden. The workbook structure is password protected as well.
`IWorkbook wb = new XSSFWorkbook(file);
ISheet sheet = wb.GetSheet("Sheet1");
IRow row = sheet.GetRow(0);
ICell cell = row.GetCell(0);
bool locked = cell.CellStyle.IsLocked; // Always returns false
cell.CellStyle.IsLocked = true; // Will set style to locked
locked = cell.CellStyle.IsLocked;
bool hidden = cell.CellStyle.IsHidden;
string value = cell.StringCellValue;
cell.SetCellValue("LOCKED");`
Using the code above I have found:
The text was updated successfully, but these errors were encountered: