需要spire.doc.free依赖
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.doc.free</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>com.e-iceblue</id>
<url>https://repo.e-iceblue.cn/repository/maven-public/</url>
</repository>
</repositories>
操作方法:
Document document = new Document();
Section section = document.addSection();
Paragraph paragraph = section.addParagraph();
paragraph.appendText("嵌入视频文件:");
InputStream stream1 = new FileInputStream("C:\\Users\\xxxx\\Desktop\\aaaa.doc");
DocPicture pic1 = new DocPicture(document);
pic1.loadImage("C:\\Users\\xxxx\\Desktop\\xxxxx.png");
paragraph.appendOleObject(stream1, pic1, "doc");
document.saveToFile("C:\\Users\\xxxx\\Desktop\\bbb.doc", FileFormat.Doc);