参考:https://blog.csdn.net/liumiaocn/article/details/73480915
openoffice有window和linux版本,通过安装openoffice软件,在java里头进行调用它来实现各种格式的转换,
核心代码如下
/**
* 将Office文档转换为PDF. 运行该函数需要用到OpenOffice, OpenOffice下载地址为
* http://www.openoffice.org
* <pre>
* 方法示例:
* window系统下
* String sourcePath = "F:\\office\\source.doc";
* String destFile = "F:\\pdf\\dest.pdf";
* Office2PDF.office2PDF(sourcePath, destFile);
* linux系统下
* String sourcePath = "/office/source.doc";
* String destFile = "/pdf/dest.pdf";
* Office2PDF.office2PDF(sourcePath, destFile);
* </pre>
* @param sourceFile
* 源文件, 绝对路径. 可以是Office2003-2007全部格式的文档
* 包括.doc,.docx, .xls, .xlsx, .ppt, .pptx等
* @param destFi