3
내 개체는 .docx 파일을 읽고 해당 텍스트를보기 (웹 페이지)에 표시하는 것입니다.apache를 사용하여 .docx 파일을 통해 한 줄씩 반복하는 방법 POI
Grails 애플리케이션에서 .odocx 파일을 읽으려면 POI POI를 사용하고 있습니다. Blankspaces 및 LineBreaks를 삭제하지 않고 출력을보기에 표시하는 방법을 제안하십시오. 읽은 후 그루비 콘솔
내 .DOCX 문서의 내용
This is a .docx document ...
this is second line
this is third line
결과 내가 인쇄 오전 :
This is a .docx document ...
this is second line
this is third line
하지만 출력을 통과 할 때 그것은
This is a .docx document ... this is second line this is third line
을하게 볼 수
.
My code is :
import org.apache.poi.xwpf.usermodel.XWPFDocument
import org.apache.poi.xwpf.extractor.XWPFWordExtractor
...
String str = "E:\\Query.docx"
File docFile = null;
docFile = new File(str);
FileInputStream fis=new FileInputStream(docFile.getAbsolutePath());
XWPFDocument doc = new XWPFDocument(fis)
XWPFWordExtractor docExtractor = new XWPFWordExtractor(doc)
println docExtractor.getText()
...
문서의 각 줄을 반복하는 방법을 제안 할 수 있다면 쉽게 결과를 얻을 수 있습니다. 제발 갇혀서 도와주세요.
인쇄 할 때 줄 바꿈 문자를 추가 할 필요가 없습니까? – Gagravarr
@Gagravarr : 파일에서 읽은대로 웹 페이지에있는대로 텍스트를 표시해야하지만 라인 브리치가 그렇게하는 동안 텍스트를 표시해야합니다. – vishu
왜 무언가를 사용해야합니까? 나는 [docx4j] (http://www.docx4java.org/trac/docx4j)가하려는 일을 수행한다고 믿는다. (여기 [https://github.com/plutext/docx4j/blob/master/]] –