- Code: Select all
InputStream stream = this.getClass().getResourceAsStream("test.docx");
WordprocessingMLPackage a = WordprocessingMLPackage.load(stream);
Unfortunately, this gives me the following exception:
- Code: Select all
org.docx4j.openpackaging.exceptions.Docx4JException: Error processing zip file (is it a zip file?)
If is use a FileInputStream loading the same file from a normal file path instead everything works fine.
- Code: Select all
FileInputStream fStream = new FileInputStream("C:\\test.docx");
WordprocessingMLPackage a = WordprocessingMLPackage.load(fStream);
Thus, it seems something is broken with loading from the resources. Other people such as https://stackoverflow.com/questions/16894199/docx4j-cant-open-template-file-on-mac-os-x seem to have the same problem, too.
Am I doing something wrong, is that a bug or intended?