try {
File docFile = new File(pathToFile);
fis = new FileInputStream(docFile.getAbsolutePath());
POIFSFileSystem pfs = new POIFSFileSystem(fis);
HWPFOldDocument doc = new HWPFOldDocument(pfs);
Word6Extractor docExtractor = new Word6Extractor(doc);
String fileContent = "";
String[] paragraphes = docExtractor.getParagraphText();
for (String paragraph : paragraphes) {
fileContent += " " + paragraph;
}
AddDataToIndex AddDataToIndex = new AddDataToIndex(null);
AddDataToIndex.doAddData(fileContent, pathToFile, fileName);