Poi-2:个人记录使用过程的问题
doc以及docx转html
public static String docToHtml(String wPath) throws Exception
String fpath=new GetFromFilePath().getNameFromPath(wPath);
File path = new File(fpath);
String imagePathStr = path.getAbsolutePath() + "\\static\\image\\";
String sourceFileName = wPath;
String targetFileName = path.getAbsolutePath() + "\\static\\"+fpath+".html";
File file = new File(imagePathStr);
if(!file.exists()) {
file.mkdirs();
}
HWPFDocument wordDocument = new HWPFDocument(new FileInputStream(sourceFileName));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
//保存图片
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try (FileOutputStream out = new FileOutputStream(imagePathStr +