
Want to extarct equation of the form ax+by+c=0 from any word document.

Hi Friend,
Try this:
import java.io.*;
import java.util.*;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
public class FileRead{
public static void main(String[] args) {
File file = null;
WordExtractor extractor = null ;
try {
file = new File("c:\\Hello.doc");
String st="";
FileInputStream fis=new FileInputStream(file.getAbsolutePath());
HWPFDocument document=new HWPFDocument(fis);
extractor = new WordExtractor(document);
String [] fileData = extractor.getParagraphText();
for(int i=0;i<fileData.length;i++){
if(fileData[i] != null)
st+=fileData[i]+" ";
}
StringTokenizer stk=new StringTokenizer(st," ");
while(stk.hasMoreTokens()){
String str=stk.nextToken();
if(str.indexOf('=')>0){
System.out.println(str);
}
}
}
catch(Exception ex){}
}
}
For the above code, you need Apache POI Library.
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.