openoffice 将word文档转换成html

工具类:

package com.landz.system.common.util;

import info.monitorenter.cpdetector.io.ASCIIDetector;
import info.monitorenter.cpdetector.io.CodepageDetectorProxy;
import info.monitorenter.cpdetector.io.JChardetFacade;
import info.monitorenter.cpdetector.io.ParsingDetector;
import info.monitorenter.cpdetector.io.UnicodeDetector;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.log4j.Logger;
import org.csource.common.MyException;

import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;

/**
 * word文档转化html
 * @author zmy 2015-07-31
 *
 */
public class OfficeConvertHtmlUtil {
	public static Logger logger = Logger.getLogger(OfficeConvertHtmlUtil.class.getName());
	//定义list集合接收图片信息 key本地图片存储路径  value远程图片存储路径
	static List<Map<String,String>> list =new ArrayList<Map<String,String>>();
	//图片在fastdfs的路径
//	static String fastdfsImgpath="";

	/** 
     * 将word文档转换成html文档 
     * @param docFile   需要转换的word文档 
     * @param filepath  转换之后html的存放路径 
     * @return 转换之后的html文件 
     */  
    public static File word2html(File docFile, String filepath) {  
    	
    	//加载OpenOfficeService配置信息
        ResourceBundle rb = ResourceBundle.getBundle("com.landz.system.properties.OpenOfficeService");
		//获取OpenOfficeService安装目录
        //String OpenOffice_HOME = rb.getString("OO_HOME");
		//获取OpenOfficeService的IP
        String host_Str = rb.getString("oo_host");
        //获取OpenOfficeService的端口
		String port_Str = rb.getString("oo_port");
		
		// 拼接启动OpenOffice的服务的命令
		//String command = OpenOffice_HOME+ "\\program\\soffice.exe -headless -accept=\"socket,host="
		//					+ host_Str + ",port=" + port_Str + ";urp;\"-nofirststartwizard";
		//启动OpenOffice服务命令:
		//soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
		//logger.debug("###启动OpenOffice服务命令:\n" + command);
		
		//Process pro = null ;
		
		OpenOfficeConnection connection = null ;
		
		// 创建保存html的文件  
        //File htmlFile = new File(filepath + "/" + new Date().getTime() + ".html"); 
		long htmlfilename = new Date().getTime() ;
		
		File htmlFile = new File(filepath + "/" + htmlfilename+ ".html");
		
		try {
			//String charsetName = findFileCharset(docFile);
        	//System.err.println("charsetName="+charsetName);
			//创建线程执行命令
			//pro = Runtime.getRuntime().exec(command);
			
			
			// 连接openoffice服务
			connection = new SocketOpenOfficeConnection(host_Str, Integer.parseInt(port_Str));
			connection.connect();
			
			//转换
	        DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
	   
	        // 转换文档为html  
	        converter.convert(docFile, htmlFile);  
	        
	        //查看是否创建成功
	        //htmlFile.createNewFile();
	        //根据html文件所在路径查找下所有图片信息,遍历图片名称,如果图片名称开头与html文件名称一致,则上传fastdfs
	        findPic(filepath,htmlfilename+"");
		} catch (Exception e) {
			logger.error("word文档转换成html文档时异常,异常信息:"+e.getMessage());
			e.printStackTrace();
		}finally{
			 // 关闭openoffice连接
			if(connection!=null){
				 connection.disconnect();
			}
	        //pro.destroy();
		}
          
        return htmlFile;  
    }
    
    /**
     * 根据html文件所在路径查找下所有图片信息,遍历图片名称,如果图片名称开头与html文件名称一致,则上传fastdfs
     * @param filepath 文件所在路径
     * @param htmlfilename .html前的名称  XXX.html  
     * @throws MyException 
     * @throws IOException 
     * @throws FileNotFoundException 
     * 
     * */
    public static void findPic(String filepath,String htmlfilename) throws FileNotFoundException, IOException, MyException{
    	
    	File file =new File(filepath);
    	
    	File[] fileArr = file.listFiles();
    	
    	//加载资源文件获取fastdfs上传所在的IP
    	ResourceBundle rb = ResourceBundle.getBundle("com.landz.system.properties.FastdfsUri");
    	String clientRequestUri = rb.getString("clientRequestUri");
    	for(int i=0;i<fileArr.length;i++){
    		 File everyFile = fileArr[i];
    		 //文件名
    		 String filename = everyFile.getName();
    		 //后缀
    		 String suffix = getFileExtension(everyFile);
    		 //查找图片
    		 if(suffix!=null && (("jpg").equalsIgnoreCase(suffix)|| ("png").equalsIgnoreCase(suffix) 
    				|| ("jpeg").equalsIgnoreCase(suffix) || ("bmp").equalsIgnoreCase(suffix))){
    			 	//将文件名称以下划线拆分,取得第一部分
    				String prefixFilename = filename.split("_")[0];
    				//如果相等,执行upload fastdfs
    				if(htmlfilename.equals(prefixFilename)){
    					String fastimgpath=UpDownUtil.uploadFileWithStream(new FileInputStream(everyFile), filename, true);
    					Map<String,String> map = new HashMap<String, String>();
    					map.put(filename,clientRequestUri+fastimgpath);
    					list.add(map);
//    					fastdfsImgpath = clientRequestUri+fastimgpath.substring(0, fastimgpath.lastIndexOf("/"));
    				}
    		 }
    	}
//    	System.out.println("图片信息:"+list);
    }
	/**
	 * 获取文件扩展名
	 * @param file
	 * @return
	 */
	public static String getFileExtension(File file) {
		String fileName = file.getName();
		if (fileName.lastIndexOf(".") != -1 && fileName.lastIndexOf(".") != 0) {
			return fileName.substring(fileName.lastIndexOf(".") + 1);
		} else {
			return "";
		}
	}
    /** 
     *  
     * 将word转换成html文件,并且获取html文件代码。 
     * @param docFile  需要转换的文档 
     * @param filepath  文档中图片的保存位置 
     * @return 转换成功的html代码 
     * @throws UnsupportedEncodingException 
     */  
    public static String toHtmlString(File docFile, String filepath) throws UnsupportedEncodingException {  
        // 转换word文档  
        File htmlFile = word2html(docFile, filepath);  
        
        // 获取html文件流  
        StringBuffer htmlSb = new StringBuffer();
        try {  
        	//获取htmlFile的字符集
			//String charsetName = findFileCharset(htmlFile);
        	//System.err.println("charsetName="+charsetName);
//            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(htmlFile),charsetName/*Charset.forName("GB2312")*/));
        	BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(htmlFile),Charset.forName("GB2312")));
            while (br.ready()) {
            	htmlSb.append(br.readLine());
                //htmlSb.append(new String(br.readLine().getBytes("GB2312"),"UTF-8")); 
            }  
            br.close();
            // 删除未整理标签由插件生成的的html文件  
            htmlFile.delete();
        } catch (FileNotFoundException e) {  
            e.printStackTrace();  
        } catch (IOException e) {
            e.printStackTrace();  
        }  
        // HTML文件字符串  
        //String htmlStr = new String(htmlSb.toString().getBytes("GB2312"),"UTF-8");  
        String htmlStr = htmlSb.toString();
        
        // 返回经过清洁的html文本  
        return clearFormat(htmlStr, filepath);  
    }  
	
	/**
	 * 规范化html,清除一些不需要的html标记
	 * @param htmlStr 带有复杂html标记的html语句
	 * @param docImgPath 文件首路径
	 * @return
	 */
	protected static String clearFormat(String htmlStr, String docImgPath) {  
		  
		// 获取body内容的正则
		String bodyReg = "<BODY .*</BODY>";
		Pattern bodyPattern = Pattern.compile(bodyReg);
		Matcher bodyMatcher = bodyPattern.matcher(htmlStr);
		if (bodyMatcher.find()) {
			// 获取BODY内容,并转化BODY标签为DIV
			htmlStr = bodyMatcher.group().replaceFirst("<BODY", "<DIV")
					.replaceAll("</BODY>", "</DIV>");
		}
		//docImgPath = docImgPath.replaceAll("\\\\", "/");

		//修改html中图片地址  将本地图片地址修改为远程图片地址  遍历html 如果存在list.key 图片信息,则替换为list.value
		if(list!=null && list.size()>0){
			for(int i=0;i<list.size();i++){
				Map<String,String> map = list.get(i);
				//遍历map 获取map的key与value
				Set<Map.Entry<String,String>>  keySet = map.entrySet();//返回键的集合 
				Iterator<Entry<String, String>> it = keySet.iterator();
				while(it.hasNext()){
					 Map.Entry<String, String> entry = (Map.Entry<String, String>)it.next();
					 //获取map中的键值对 key转换前的文件路径 value转换后的文件路径
					 String localfilename =(String) entry.getKey();
					 String remotefilename = (String) entry.getValue();
					 htmlStr = htmlStr.replaceAll(localfilename, remotefilename);
				}
			}
		}
		
		
		// 调整图片地址
		/*htmlStr = htmlStr.replaceAll("<IMG SRC=\"", "<IMG SRC=\"" + docImgPath
				+ "/");*/
		// 把<P></P>转换成</div></div>保留样式
		// content = content.replaceAll("(<P)([^>]*>.*?)(<\\/P>)",
		// "<div$2</div>");
		// 把<P></P>转换成</div></div>并删除样式
		htmlStr = htmlStr.replaceAll("(<P)([^>]*)(>.*?)(<\\/P>)", "<p$3</p>");
		// 删除不需要的标签
		htmlStr = htmlStr
				.replaceAll(
						"<[/]?(font|FONT|span|SPAN|xml|XML|del|DEL|ins|INS|meta|META|[ovwxpOVWXP]:\\w+)[^>]*?>",
						"");
		// 删除不需要的属性
		htmlStr = htmlStr
				.replaceAll(
						"<([^>]*)(?:lang|LANG|class|CLASS|style|STYLE|size|SIZE|face|FACE|[ovwxpOVWXP]:\\w+)=(?:'[^']*'|\"\"[^\"\"]*\"\"|[^>]+)([^>]*)>",
						"<$1$2>");

		return htmlStr;
  
    }
	
	 /** 
     * 
     * 将获取到的html信息写入到html文件里,生成数据文件 
     * @param content 写入的字符串内容 
     * @param filePath 写入文件的路径 
     * @return 
     */  
    public static File string2File(String content, String filePath) {
        BufferedReader bufferedReader =null ;  
        BufferedWriter bufferedWriter=null ;  
        StringBuffer html = new StringBuffer("");
        File file = new File(filePath); 
        try {
        	html.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
        	html.append("<html>");
        	html.append( "<head><meta http-equiv=\"content-type\" content=\"text/html\" charset=\"GB2312\">");
        	html.append("<meta name=\"renderer\" content=\"webkit|ie-comp|ie-stand\"/>");
			html.append("</head>");
        	html.append("<body><center>");
        	html.append(content);
        	html.append("</center></body>");
        	html.append("</html>");
        	
            if (!file.exists()) {  
                file.createNewFile();  
            }  
            bufferedReader = new BufferedReader(new StringReader(html.toString()));  
            bufferedWriter = new BufferedWriter(new FileWriter(file));  
            char buffer[] = new char[1024];  
            int len;  
            while ((len = bufferedReader.read(buffer)) != -1) {  
                bufferedWriter.write(buffer, 0, len);  
            }  
            bufferedWriter.flush();  
            bufferedReader.close();  
            bufferedWriter.close();  
        } catch (IOException e) {  
            logger.error(e);  
            e.getStackTrace();
        } finally {  
            if (bufferedReader != null) {  
                try {  
                    bufferedReader.close();  
                } catch (IOException e) {  
                    logger.error(e);  
                    e.getStackTrace();
                }  
            }  
        }  
        return file;  
    }  
	
    /**
     * InputStream转换为File
     * @param ins 
     * @param file
     * @throws Exception
     */
	public static void inputstream2File(InputStream ins, File file) throws Exception {
		/*BufferedReader reader = new BufferedReader(new InputStreamReader(ins, Charset.forName("UTF-8")));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")));

		String s=reader.readLine();
		while (null != s) {
			writer.write(s);
			// 由于BufferedReader的rendLIne()是不读入换行符的,所以写入换行时须用newLine()方法
			writer.newLine();
			// read=fis.read(b);
			s = reader.readLine();
		}
		reader.close();  
        writer.close();  */
		OutputStream os = new FileOutputStream(file);
		int bytesRead = 0;
		byte[] buffer = new byte[8192];
		while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
			os.write(buffer, 0, bytesRead);
		}
		os.flush();
		os.close();
		ins.close();
	}
	
	/**
	 * 文件的字符集
	 * @param args
	 * @throws IOException 
	 * @throws MalformedURLException 
	 */
	public static String findFileCharset(File file) throws MalformedURLException, IOException{
		String charsetName = "";
		
		CodepageDetectorProxy detector = CodepageDetectorProxy.getInstance();
        detector.add(new ParsingDetector(false));
        detector.add(JChardetFacade.getInstance());
        detector.add(ASCIIDetector.getInstance());
        detector.add(UnicodeDetector.getInstance());
        java.nio.charset.Charset charset = detector.detectCodepage(file.toURI().toURL());
        if (charset != null) {
			charsetName = charset.name();
		} else {
			charsetName = "UTF-8";
		}
        return charsetName;
	}
	
	public static void main(String[] args) {
		/*String htmlfilename = "123456";
		String filename ="123456_html_asd";
		String prefixFilename = filename.split("_")[0];
		if(prefixFilename.equals(htmlfilename)){
			System.out.println("true");
		}*/
		
	 try {
		 System.out.println(UpDownUtil.uploadFileWithBtyeArray(new byte[0], new Date().getTime() + ".html", true));
			String filename2= new Date().getTime() + ".html";
			String fastdfspath = UpDownUtil.uploadFileWithBtyeArray(new byte[0], filename2, true);
			System.out.println(fastdfspath);
//			System.out.println(fastdfspath.replaceAll(filename2, ""));
			System.out.println(fastdfspath.lastIndexOf("/"));
			System.out.println(fastdfspath.substring(0, fastdfspath.lastIndexOf("/")));
//			System.out.println(fastdfspath.replaceAll(filename2.lastIndexOf("."),""));
//			System.out.println("1233333.12".substring(beginIndex, endIndex));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MyException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		
		/*String s = "D:\\software\\apache-tomcat-7.0.63\\webapps\\webapi-console\\uploadfile\\";
		
		System.out.println(s.replaceAll("\\\\", "/"));*/
	/*	SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmssSSS");
		String filename = sdf.format(new Date());//根据日期生成文件名称
		// String fileCatalog = request.getSession().getServletContext().getRealPath("/") + "uploadfile/";
		//定义存储文件的目录
		String fileCatalog = "D:/test";
		//定义文件生成的目录
		String targetPath = fileCatalog+"/"+filename+".html";
		//上传的文件 需要转换的文件( 路径+文件)
		String OriginalFilePath = "D:\\市场分析报告-6月份.docx";
		
		//转换的html主信息
		String generatehtml ="";
		
		generatehtml = toHtmlString(new File(OriginalFilePath), fileCatalog);
		
		//生成本地html
		if(string2File(generatehtml,targetPath)){
			//如果本地html生成成功
//			MultipartFile file =(MultipartFile) new File(targetPath);
			 try {
//			String fastpath=UpDownUtil.uploadFileWithBtyeArray(file.getBytes(), file.getOriginalFilename(), true);
//				System.out.println(fastpath);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		*/

		
//		System.out.println(OfficeConvertHtmlUtil.class.getClass().getResource("/"));
//		String html = toHtmlString(new File("D:\\市场分析报告-6月份.docx"), "D:/test");
		
//		System.out.println(toHtmlString(new File("D:\\市场分析报告--季度报告.pdf"), "D:/test"));;//(new File("市场分析报告--季度报告"), filepath));
	}
	
	/**
	 * 
	 * 开启openoffice服务
	 * 
	 * @return OpenOfficeConnection 
	 * 
	 * */
/*	public static OpenOfficeConnection openConnection() throws Exception{
		ResourceBundle rb = ResourceBundle.getBundle("src.main.java.com.landz.system.properties.OpenOfficeService");
		String OpenOffice_HOME = rb.getString("OO_HOME");
		String host_Str = rb.getString("oo_host");
		String port_Str = rb.getString("oo_port");
		
		// 启动OpenOffice的服务的命令
		String command = OpenOffice_HOME+ "/program/soffice.exe -headless -accept=\"socket,host="
							+ host_Str + ",port=" + port_Str + ";urp;\"";
		//启动OpenOffice服务命令:
		//soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
		logger.debug("###启动OpenOffice服务命令:\n" + command);
		Process pro = Runtime.getRuntime().exec(command);
		// 连接openoffice服务
		OpenOfficeConnection connection = new SocketOpenOfficeConnection(host_Str, Integer.parseInt(port_Str));
		connection.connect();
		return connection;
		} catch (IOException e) {
			logger.error("启动openoffice服务异常,异常信息:"+e.getMessage());
			e.printStackTrace();
		}
		return null;
	}*/
	/**执行转换操作
	 * 
	 * @param clientRequestUri 当前文件所在的绝对路径
	 * @param fileSavePath 文件保存路径
	 * @param fileName 文件名
	 * @return 返回生成html的路径
	 */
	/*public String beginConvert(String clientRequestUri,String fileSavePath,String fileName){
		return null;
	} */
}



控制类SpringMVC上传

//定义上传文档路径
		String wordPath ="";
		
		//定义存储文件的目录
		String fileCatalog =  request.getSession().getServletContext().getRealPath("/")+"uploadfile\\";
		
		//根据日期生成文件名称
		SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmssSSS");
		String filename = sdf.format(new Date());
		
		//定义文件生成的目录
		String targetPath =  fileCatalog+"/"+filename+".html";
		
		try {
			response.setCharacterEncoding("UTF-8");
			request.setCharacterEncoding("UTF-8");
			
		  if(uploadfile!=null && uploadfile.getSize()>0){
			//上传文件后缀 DOC/DOCX
			String suffix = uploadfile.getOriginalFilename().substring(uploadfile.getOriginalFilename().lastIndexOf("."));
			
			//上传的文件转换类型MultipartFile ->file
			String uploadFilepath = fileCatalog + "copyfile\\"+filename+suffix;
			File uploadFilefile =new File(uploadFilepath);
			
			//判断文件上传后缀
			if((CommonConstant.DOC).equals(suffix) || (CommonConstant.DOCX).equals(suffix)
				|| CommonConstant.XLS.equals(suffix) || CommonConstant.XLSX.equals(suffix)){
				//生成File类型文件
				//OfficeConvertHtmlUtil.inputstream2File(uploadfile.getInputStream(), uploadFilefile);
				//String uploadFilepath = UpDownUtil.uploadFileWithBtyeArray(uploadfile.getBytes(), uploadfile.getOriginalFilename(), true);
				//File uploadFilefile =new File(uploadFilepath);
				
				//生成的fastdfs文件路径
				//String filename2= new Date().getTime() + ".html";
				//String fastdfspath = UpDownUtil.uploadFileWithBtyeArray(new byte[0], filename2, true);
				
				
				//fileCatalog = configService.getClientRequestUri()+"/"+fastdfspath.substring(0, fastdfspath.lastIndexOf("/"));
				//targetPath =  configService.getClientRequestUri()+"/"+fastdfspath ; 
				//将上传的文件类型从MultipartFile类型转化为File类型
				//OfficeConvertHtmlUtil.inputstream2File(uploadfile.getInputStream(), uploadFilefile);
				uploadfile.transferTo(uploadFilefile);
				
				//将word转换成html文件,并且获取html文件代码。
				String generatehtml = OfficeConvertHtmlUtil.toHtmlString(uploadFilefile, fileCatalog);
				
				//生成html数据文件 
				File htmlfile = OfficeConvertHtmlUtil.string2File(generatehtml,targetPath);
				
				//将html文件上传到fastdfs并获取到fastdfs路径
				wordPath = UpDownUtil.uploadFileWithStream(new FileInputStream(htmlfile), filename+".html", true);
				
				//html本地生成路径
				System.err.println(targetPath);
				//html fastdfs路径
				System.err.println(wordPath);
			  }
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		


所需要jar包 本地加载 

mvn install:install-file -DgroupId=commons-cli -DartifactId=commons-cli -Dversion=1.2 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/commons-cli-1.2.jar
mvn install:install-file -DgroupId=jodconverter -DartifactId=jodconverter -Dversion=2.2.2 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/jodconverter-2.2.2.jar
mvn install:install-file -DgroupId=jodconverter-cli -DartifactId=jodconverter-cli -Dversion=2.2.2 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/jodconverter-cli-2.2.2.jar
mvn install:install-file -DgroupId=juh -DartifactId=juh -Dversion=3.0.1 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/juh-3.0.1.jar
mvn install:install-file -DgroupId=jurt -DartifactId=jurt -Dversion=3.0.1 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/jurt-3.0.1.jar
mvn install:install-file -DgroupId=ridl -DartifactId=ridl -Dversion=3.0.1 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/ridl-3.0.1.jar
mvn install:install-file -DgroupId=slf4j-api -DartifactId=slf4j-api -Dversion=1.5.6 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/slf4j-api-1.5.6.jar
mvn install:install-file -DgroupId=slf4j-jdk14 -DartifactId=slf4j-jdk14 -Dversion=1.5.6 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/slf4j-jdk14-1.5.6.jar
mvn install:install-file -DgroupId=unoil -DartifactId=unoil -Dversion=3.0.1 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/unoil-3.0.1.jar
mvn install:install-file -DgroupId=xstream -DartifactId=xstream -Dversion=1.3.1 -Dpackaging=jar -Dfile=F:/study/jars/jodconverter-2.2.2/lib/new/xstream-1.3.1.jar


<!--判断文件字符集-->
mvn install:install-file -DgroupId=cpdetector -DartifactId=cpdetector -Dversion=1.0.10 -Dpackaging=jar -Dfile=F:/study/jars/cpdetector_1.0.10_binary/cpdetector_1.0.10.jar
mvn install:install-file -DgroupId=chardet -DartifactId=chardet -Dversion=1.0 -Dpackaging=jar -Dfile=F:/study/jars/cpdetector_1.0.10_binary/ext/chardet-1.0.jar
mvn install:install-file -DgroupId=antlr -DartifactId=antlr -Dversion=2.7.4 -Dpackaging=jar -Dfile=F:/study/jars/cpdetector_1.0.10_binary/ext/antlr-2.7.4.jar

 pom.xml引用

<!-- 第三方插件判断字符集 -->
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.4</version>
</dependency>
<dependency>
<groupId>cpdetector</groupId>
<artifactId>cpdetector</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>chardet</groupId>
<artifactId>chardet</artifactId>
<version>1.0</version>
</dependency>

<!-- word转化成html所需jar --> 
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>

<dependency>
<groupId>jodconverter</groupId>
<artifactId>jodconverter</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>jodconverter-cli</groupId>
<artifactId>jodconverter-cli</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>juh</groupId>
<artifactId>juh</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>jurt</groupId>
<artifactId>jurt</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>ridl</groupId>
<artifactId>ridl</artifactId>
<version>3.0.1</version>
</dependency>
<!-- <dependency>
<groupId>slf4j-api</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency> -->
<!-- <dependency>
<groupId>slf4j-jdk14</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.5.6</version>
</dependency> -->
<dependency>
<groupId>unoil</groupId>
<artifactId>unoil</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值