从伪word格式的doc文件中提取文本内容
从mht文件中提取html内容
最近做的一个程序中,需要把从51job导出来的简历进行解析,51job支持doc和mht格式。开始时以为该doc文件是Word文件,于是采用Apache POI中提供的WordExtractor来进行,从word文件中提取文本内容。
?
?
?
这样之后,htmlFile指定的文件中保存的就是提取出来html内容。在实际的测试中,发现需要对代码做一下小的修改,在类Html2MHTCompiler第441行附近。
?
String strEncodng = getEncoding(bp1); if (strEncodng == null) { strEncodng = "GBK"; // 2012.04.23 } else { strEncodng = strEncodng.replace(""", ""); } String strText = getHtmlText(bp1, strEncodng);?
?
至少在我测试的doc/mht文件中能正确处理。
?
?