需要spire.doc.free依赖

    1. <dependencies>
    2. <dependency>
    3. <groupId>e-iceblue</groupId>
    4. <artifactId>spire.doc.free</artifactId>
    5. <version>5.2.0</version>
    6. </dependency>
    7. </dependencies>
    8. <repositories>
    9. <repository>
    10. <id>com.e-iceblue</id>
    11. <url>https://repo.e-iceblue.cn/repository/maven-public/</url>
    12. </repository>
    13. </repositories>

    操作方法:

    1. Document document = new Document();
    2. Section section = document.addSection();
    3. Paragraph paragraph = section.addParagraph();
    4. paragraph.appendText("嵌入视频文件:");
    5. InputStream stream1 = new FileInputStream("C:\\Users\\xxxx\\Desktop\\aaaa.doc");
    6. DocPicture pic1 = new DocPicture(document);
    7. pic1.loadImage("C:\\Users\\xxxx\\Desktop\\xxxxx.png");
    8. paragraph.appendOleObject(stream1, pic1, "doc");
    9. document.saveToFile("C:\\Users\\xxxx\\Desktop\\bbb.doc", FileFormat.Doc);