一、依赖的包,部署环境
二、后台代码实现
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
*
*
【导入word文件,解析word文件转换成HTML】
*
条件:
*
备注:
*
例子:
*
日志:
*
* @author:zhu [2016年1月29日 下午2:50:28]
*/
public void importDocToHtml() {
//启动word
ActiveXComponent axc = new ActiveXComponent("Word.Application");
StringWriter stringWriter = null;
try {
// doc临时存放文件夹路径
String realpath = ServletActionContext.getServletContext().getRealPath("/UserUploadFile/WordToHTML");
File tempfile = null;
if (docFile != null) {
String tempName = String.valueOf((n