https://bz.apache.org/bugzilla/show_bug.cgi?id=69742

--- Comment #2 from aniu007 <969675...@qq.com> ---
Related code

try{
 File wordFile = new File("D:\\website\\temp\\myWordFile.docx");
File htmlFile = new File("D:\\website\\temp\\myWordFile.html");
            String imageName = "D:\\website\\temp\\"+ "notComPressImage" ;
            if (!wordFile.exists()) {
                return null ;
            } else {
                // 1) 加载word文档生成 XWPFDocument对象

                InputStream in = new FileInputStream(wordFile);
                XWPFDocument document = new XWPFDocument(in);
                // 2) 解析 XHTML配置 (这里设置IURIResolver来设置图片存放的目录)
                File imageFolderFile = new File(imageName);
                XHTMLOptions options = XHTMLOptions.create().URIResolver(new
FileURIResolver(imageFolderFile));
                options.setExtractor(new FileImageExtractor(imageFolderFile));
                options.setIgnoreStylesIfUnused(false);
                options.setFragment(false);

                // 3) 将 XWPFDocument转换成XHTML
                OutputStream out = new FileOutputStream(htmlFile);
                XHTMLConverter.getInstance().convert(document, out, options);
            }
            return htmlFile ;
        }catch (Exception e){
            return null ;
        }

When the code runs to XWPFDocument document = new XWPFDocument(in), an error
message of java.io.IOException: Failed to read zip entry source will be
reported.



My word file has been uploaded to attachment. Please download it for
verification. Thank you.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to