我想知道如果有人能幫我弄清楚爲什麼當我讀取.doc文件時我的文本沒有排隊。到目前爲止,在我的代碼中,我使用了WordExtractor,但是我的格式問題與正確排列的東西沒有關係。這是我使用Java 1.7編寫的代碼。Apache POI格式問題
public class Doc {
File docFile = null;
WordExtractor docExtractor = null ;
WordExtractor exprExtractor = null ;
public void read(){
docFile = new File("blue.doc");
try{
FileInputStream fis = new FileInputStream(docFile.getAbsolutePath());
HWPFDocument doc=new HWPFDocument(fis);
docExtractor = new WordExtractor(doc);
}catch(Exception e){
System.out.println(e.getMessage());
}
System.out.println(docExtractor.getText());
}
}
程序如何顯示文檔。
A E
I'm stuck in Folsom Prison, and time keeps draggin on.
它應該被顯示成這樣
A E
I'm stuck in Folsom Prison, and time keeps draggin on.