NPOI 操作Excel方法
(一)控件单元格只读
List<int> array = new List<int>(); int[] i ={1,2,3}; //指定那些列需要修改,当然剩下的列就是你希望只读的列了 array.AddRange(i); for (int i = 0; i < array.Count; i++) { HSSFCellStyle _cellstyle = workbook.CreateCellStyle(); _cellstyle.IsLocked = false;//解除锁定 short m=(short)array[i]; sheet.SetDefaultColumnStyle(m, _cellstyle); sheet.ProtectSheet("MD5"); }
NPOI Excel 单元格背景颜色对照表 https://www.cnblogs.com/Brainpan/p/5804167.html
https://www.cnblogs.com/lenglife/p/8258315.html