Получилось только из doc в html, видимо WordToHtmlConverter поддерживает только HWPFDocument т.е doc
HWPFDocument document = new HWPFDocument(new FileInputStream(fileChooser.showOpenDialog(primaryStage)));
Document newDocument = (Document) DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter((org.w3c.dom.Document) newDocument) ;
wordToHtmlConverter.processDocument(document);
StringWriter stringWriter = new StringWriter();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
transformer.setOutputProperty(OutputKeys.METHOD, "html");
transformer.transform(new DOMSource( wordToHtmlConverter.getDocument()), new StreamResult( stringWriter ) );
String html = stringWriter.toString();
FileOutputStream fos=new FileOutputStream(new File("example.html"));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos,"UTF-8"));
out.write(html);
out.close();
Перемещено Klymedy из general