🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```java public void write03() throws IOException, InvalidFormatException { XWPFDocument document = new XWPFDocument(); XWPFParagraph paragraph = document.createParagraph(); XWPFRun run = paragraph.createRun(); //添加图片 run.addPicture(new FileInputStream("e:/upload/image001.png"), XWPFDocument.PICTURE_TYPE_PNG, "", Units.pixelToEMU(300), Units.pixelToEMU(200)); OutputStream out = new FileOutputStream("e:/upload/003.docx"); document.write(out); out.flush(); out.close(); document.close(); } ``` ![](https://img.kancloud.cn/b4/94/b494c58f3ac07773b3077d7d7d412077_1692x730.png)