关于poi解析word 转html 最后生成的html不能再生成时进行控制吗?
public static void canExtractImage(String wordPath) throws IOException {
String name = StringUtils.substringBeforeLast(StringUtils.substringAfterLast(wordPath, "/"), ".");
File f = new File(wordPath);
Long randStr = System.currentTimeMillis(); //时间戳
// 1) Load DOCX into XWPFDocument
InputStream in = new FileInputStream(f);
XWPFDocument document = new XWPFDocument(in);
// 2) Prepare XHTML options (here we set the IURIResolver to
// load images from a "word/media" folder)
File imageFolderFile = new File("C:/Users/chency/Documents/"+name+randStr);
XHTMLOptions options = XHTMLOptions.create().URIResolver(
new FileURIResolver(imageFolderFile));
options.setExtractor(new FileImageExtractor(imageFolderFile));
// 3) Convert XWPFDocument to XHTML
OutputStream out = new FileOutputStream(new File(
"C:/Users/chency/Documents/"+name+randStr+".html"));
XHTMLConverter.getInstance().convert(document, out, options);
out.close();
}