问题:
1.windows下office转换ok,但是txt乱码
将txt后缀修改为odt再转
2.linux下转换完后文件内容乱码(中文变成小方块):
将C:\Windows\Fonts下的字体拷贝到/usr/share/fonts/win,也可根据自己需要拷贝,我是全部拷贝。
cd /usr/share/fonts/win
mkfontscale
mkfontdir
fc-cache
执行以上命令安装完字体再重启一下LibreOffice:
先kill进程再执行以下命令(根据自己安装路径修改下面路径):
/opt/libreoffice5.0/program/soffice --headless --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard &
3.linux下2操作完后txt乱码:
一般windows下文件编码是gbk,linux下是utf-8,参照:http://wenku.baidu.com/link?url=cgPoZ_-ojngMIxfti6_JXrfY_6sYG14awan26mArK4xwo7SgulsPKs3DOZpiVq5jGR5eng4ulhVcVfiPGnPYstffHLqT3Fu_1iPC6O6Wrj_将文件转码再用LibreOffice转换即可
4.maven项目jar包:
<dependency> <groupId>com.artofsolving</groupId> <artifactId>jodconverter-maven-plugin</artifactId> <version>2.2.1</version> <exclusions> <exclusion> <groupId>com.artofsolving</groupId> <artifactId>jodconverter</artifactId> </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> <version>1.7.13</version> </dependency> <dependency> <groupId>org.openoffice</groupId> <artifactId>ridl</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>org.openoffice</groupId> <artifactId>bootstrap-connector</artifactId> <version>0.1.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.4</version> </dependency>