如何用POI导出带有密码的excel的表格(打开excel需要密码)
public static void main(String[] args) throws Exception{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("11");
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell(0);
cell.setCellValue("各种值");
FileOutputStream fos = null;
String filePath = "d:\\3.xls";
File file = new File(filePath);
if(file.exists()){
//导出具体路径
fos = new FileOutputStream(file);
}else{
file.createNewFile();
//导出具体路径
fos = new FileOutputStream(file);
}
wb.write(fos);
fos.close();
}
那么在NPOI里面应该有参数设置密码吧,在EPPLUS里面是有的