### Question:
JacobUtils { public static void docToXml(String filePath, String xmlFilePath){ ActiveXComponent app = new ActiveXComponent( "Word.Application"); app.setProperty("Visible", new Variant(false)); Dispatch docs = app.getProperty("Documents").toDispatch(); Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method, new Object[] {filePath, new Variant(false), new Variant(true)} , new int[1]).toDispatch(); Dispatch.call(doc, "SaveAs", xmlFilePath, 11); Dispatch.call(doc, "Close", false); app.invoke("Quit",0); log.info("word格式转为xml格式完成"); }  static void docToXml(String filePath, String xmlFilePath);  }### Answer:
@Test public void docToXmlTest(){ String filePath = "E:\\temp\\word_template\\show\\1.doc"; String xmlFilePath = "E:\\temp\\word_template\\show\\1.xml"; JacobUtils.docToXml(filePath, xmlFilePath); }