string path = @"E:\tes1t.xls"; //刚用excel新建的模板文件
FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read);
Biff8EncryptionKey.CurrentUserPassword = "12345"; //打开前调用
HSSFWorkbook hssfworkbook = new HSSFWorkbook(file);
hssfworkbook.WriteProtectWorkbook("123456", ""); //设置新密码
file.Close();
ISheet sheet = hssfworkbook.GetSheetAt(0);
{"success":true,"msg":"Unable to construct record instance","code":-1,"data":{}}
可以试试其他方案:https://blog.csdn.net/Miaonly/article/details/84922345