💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
```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)