项目用了poi解析word。但是发现本地是正常能够解析,一旦到了服务器。就不能解析了。
谷歌也看了,百度也看了,说是字体问题。添加了字体之后,问题仍然没有得到解决。
最后是spring 的Resource的问题。应该用流来接受
org.springframework.core.io.Resource resource = new ClassPathResource("tpl/templete.doc");
new HWPFDocument(new POIFSFileSystem(resource.getInputStream()));
POIFSFileSystem里面用resource的inputstream