为什么我会收到 "The supplied data appears to be in the Office 2007+XML" 错误?
Why am I getting "The supplied data appears to be in the Office 2007+XML" error?
import org.apache.poi.hwpf.extractor.WordExtractor;
public class Test {
public static void main(String args[]){
try {
WordExtractor extractor = new WordExtractor(new FileInputStream("/Users/testuser/myworddoc.docx"));
}
catch (IOException ioe){
ioe.printStackTrace();
}
}
}
执行此代码时出现以下错误消息:
"The supplied data appears to be in the Office 2007+XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data."
如何修改代码来解决这个问题?
看起来 WordExtractor 需要您的文档采用 Office 2007 格式,因此要么以预期格式保存您的文档,要么找到处理您文档的等效过程。
import org.apache.poi.hwpf.extractor.WordExtractor;
public class Test {
public static void main(String args[]){
try {
WordExtractor extractor = new WordExtractor(new FileInputStream("/Users/testuser/myworddoc.docx"));
}
catch (IOException ioe){
ioe.printStackTrace();
}
}
}
执行此代码时出现以下错误消息:
"The supplied data appears to be in the Office 2007+XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data."
如何修改代码来解决这个问题?
看起来 WordExtractor 需要您的文档采用 Office 2007 格式,因此要么以预期格式保存您的文档,要么找到处理您文档的等效过程。