import java.io.*;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor를 사용합니다.
public class LireDoc
{
public static void main(String[] args)
{
try
{
파일 파일 = new File("nouveaudoc.doc");
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
HWPFDocument document = new HWPFDocument(fis);
WordExtractor 추출기 = new WordExtractor (문서);
문자열[] text = extractor.getParagraphText();
for (int i = 0; i < texte.length; i++)
{
if (texte[i] != null)
System.out.println(texte[i]);
}
}
catch (예외 e)
{
e.printStackTrace();
}
}
}
import java.io.*;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
public class ReadDocx
{
public static void main(String[] args)
{
try
{
파일 파일 = 새 파일("nouveaudoc.docx");
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
XWPFDocument document = new XWPFDocument(fis);
XWPFWordExtractor 추출기 = new XWPFWordExtractor(document);
문자열 text = extractor.getText();
System.out.println(텍스트);
}
catch (예외 e)
{
e.printStackTrace();
}
}
}
Please disable your ad blocker and refresh the window to use this website.