pom依赖:
<dependency>
<groupId></groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId></groupId>
<artifactId>-gae</artifactId>
<version>2.0.1</version>
</dependency>
测试代码:
@Test public void test() { FileInputStream fileInputStream = null; FileOutputStream fileOutputStream = null; try { fileInputStream = new FileInputStream("D:\\download\\"); XWPFDocument xwpfDocument = new XWPFDocument(fileInputStream); PdfOptions pdfOptions = (); fileOutputStream = new FileOutputStream("D:\\download\\"); ().convert(xwpfDocument,fileOutputStream,pdfOptions); } catch (FileNotFoundException e) { (); } catch (IOException e) { (); } finally { try { if (null != fileInputStream) { (); } if (null != fileOutputStream) { (); } } catch (IOException e) { (); } } }