I have a weird problem :
in src/main/resources i have a "template.xlsx" file.
If i do this :
InputStream is = new ClassPathResource("template.xlsx").getInputStream();
Or this :
InputStream is = ClassLoader.getSystemResourceAsStream("template.xlsx");
Or this :
InputStream is = getClass().getResourceAsStream("/template.xlsx");
When i try to create a workbook :
Workbook wb = new XSSFWorkbook(is);
I get this error :
java.util.zip.ZipException: invalid block type
BUT, when i get my file like this :
InputStream is = new FileInputStream("C:/.../src/main/resources/template.xlsx");
It works !
What is wrong ? I can't hardcode the fullpath to the file.
Can someone help me with this ?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…