llhdf 发表于 2013-2-7 19:48:23

JAVA 通过使用 Openoffice3 将 MS word 解析成 html

我使用 jodconverter-core-3.0-beta-3.jar 将 MS word 解析成 Html,发现解析之后的html并不理想,如果word中zhong全是文字和图片,解析没有问题,如果word中有表格,解析之后将会出现问题。
 
java程序调用 jodconverter-core-3.0-beta-3.jar  程序如下:
 
package jod;import java.io.File;import org.artofsolving.jodconverter.OfficeDocumentConverter;import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;import org.artofsolving.jodconverter.office.OfficeManager;public class Test {public static void main(String[] args) {    OfficeManager officeManager = new DefaultOfficeManagerConfiguration().buildOfficeManager();   officeManager.start();   OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);   try{    converter.convert(new File("c:/test.doc"), new File("c:/test.html"));         }catch(Exception e){    e.printStackTrace();    }    officeManager.stop();}} 
      我解析之后页面html页面,我发现有以下问题,如果word全是文字内容,解析基本没有问题,但是如果解析前word文件中有表格,表格将会解析成图片。有可能解析成若干个小图片,也可能解析成一张大图片。我使用MS word 的另存为html之后,发现没有解析成图片。
 
 
页: [1]
查看完整版本: JAVA 通过使用 Openoffice3 将 MS word 解析成 html