.doc 또는 .docx 파일을 입력으로 가져 와서 단어를 데이터베이스 테이블에 추출하는 응용 프로그램을 개발 중입니다.java에서 Apache POI를 사용하여 .doc 및 .docx 파일에서 오른쪽에서 왼쪽으로 텍스트를 추출하는 방법은 무엇입니까?
이 목적으로 Apache POI를 사용해 보았지만 왼쪽에서 오른쪽으로 쓰는 텍스트 형식 (예 : 영어)의 문서를 사용하여 성공적으로 관리했습니다.
// FilterDOC Method Which Tacke A Document As Input and Return A Generic
// List Withs Its Words
public static void parseDoc(File SelectedFile, FileReader in) {
try {
// Create a POI File System object
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(
SelectedFile));
// Create a document for this file
HWPFDocument doc = new HWPFDocument(fs);
// Create a WordExtractor to read the text of the word document
WordExtractor we = new WordExtractor(doc);
String ExtractedText = we.getText();
// Removing New Empty Lines
String RemoveEmptyLines = ExtractedText.replaceAll("[\n\r]", "");
// Filtering document of any symbols
String[] Wordlist = RemoveEmptyLines
.split("[:\\,\\.\\}\\?\\{\\[\\]\\‘\\_\\*\\&\\%\\#\\$\\@\\!\\~\\/\\//\\|\\?\\“\\:-\\;\\W\\s+]");
List<String> lines = new ArrayList<String>();
for (String line : Wordlist) {
if (line != null && !line.trim().isEmpty()
&& !line.equals("\\W\\s+")) {
lines.add(line.trim());
}
}
// output the document
for (String string : lines) {
System.out.println(string);}
in.close();
}
catch (IOException e){
System.out.println("IO Exception !!"+ e.getMessage()); }
}
은 어떻게 (예를 들어, 아랍어) 오른쪽에서 왼쪽으로 텍스트 형식으로 문서와 같은 라이브러리를 사용할 수 있습니다 : 여기
코드인가? 오른쪽에서하자를 들어
당신은 문제가 당신이보고있는이 무엇인지 명확히 수 있을까? 텍스트가 없습니까? 잘못된 문자입니까? 잘못된 방향? – Gagravarr