Protection

dotnet-poi supports both sheet-level and workbook-level protection. Password hashing is not implemented.

Sheet Protection

sheet.protectSheet("password");  // lock the sheet with a password
sheet.protectSheet(null);        // remove protection

When protected, users cannot modify locked cells, insert/delete rows or columns, or change sheet structure.

To check protection:

var isProtected = sheet.getProtect();  // bool

Cell-Level Locking

By default, all cells are locked when a sheet is protected. To allow editing on specific cells:

var style = wb.createCellStyle();
style.setLocked(false);       // cell can be edited even when sheet is protected
cell.setCellStyle(style);

Workbook Protection

// Protect workbook structure (prevents add/delete/move sheets)
wb.getSheetAt(0).protectSheet("password");  // applied per-sheet

Limitations

Full Runnable Example

See examples/UsageSamples/Program.cs:

examples/UsageSamples