简体   繁体   中英

Excel Interop - Protect sheet excluding column

Hi I'd like to protect a worksheet excluding a column or a range of cells, any one have any idea's on how to accomplish this without resorting to going in manually after generation and unprotecting them?

Thanks ahead of time ^_^

The definition of whether a cell stays locked is present within the cells themselves, so you can at best define the ranges that aren't supposed to be locked after you generate the worksheet but before you protect it:

Worksheet wks = new Worksheet();
wks.Range["F:F"].Locked = false;
wks.Protect();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM