- 环境准备
- wins10环境测试:首先下载最新版的openoffice工具
,安装完成之后安装服务,, win+r打开命令提示符 输入cmd,cd C:\Program Files (x86)\OpenOffice 4\program,在该目录下执行语句 soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard;服务安装完成了,查看端口号 netstat -ano|findstr "8100" 查看服务名称: tasklist|findstr "8100" (参考连接)
- Linux环境下把openoffice百度安装启动就好。
- Ubuntu安装(Ubuntu 安装OpenOffice操作_不忘初心的博客-CSDN博客)
- Linux启动OpenOfice命令(CentOS 安装openoffice)
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
- 其他
- openoffice-V4.1.7
- wins10环境测试:首先下载最新版的openoffice工具
- 依赖jar包
- pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.test</groupId> <artifactId>office2pdf</artifactId> <version>0.0.1-SNAPSHOT</version> <name>office2pdf</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>com.artofsolving</groupId> <artifactId>jodconverter</artifactId> <version>2.2.2</version><!--2.2.2是红色的,因为Maven官方只有2.2.1版本,这里是手动导入的--> </dependency> <dependency> <groupId>org.openoffice</groupId> <artifactId>juh</artifactId> <version>3.2.1</version> </dependency> <dependency> <groupId>org.openoffice</groupId> <artifactId>ridl</artifactId> <version>3.2.1</version> </dependency> <dependency> <groupId>org.openoffice</groupId> <artifactId>unoil</artifactId> <version>3.2.1</version> </dependency> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.1</version> <optional>true</optional> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>com.thoughtworks.xstream</groupId> <artifactId>xstream</artifactId> <version>1.3.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
-
jodconverter使用的是2.2.2版本,需要手动导入。Maven官方目前只有2.2.1
- pom.xml
- demo下载地址(直接运行main方法即可)
- 支持.pptx,.docx格式转换