ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Opening Microsoft File Formats to Java
Subject:   how to use poi package in my project
Date:   2005-09-23 03:15:46
From:   janaki1
Hai all,
This IS Chaitanya
I down load the "poi-bin-2.5.1-final-20040804.ZIP
And I wrote the program like this


import com.sun.rsasign.s;
import java.io.*;
import java.util.*;


public class Rdata {

/** Creates a new instance of Rdata */
public Rdata() {
}
public static void main(String a[])throws Exception
{
FileReader fr=new FileReader("c:\\java\\abc.doc");
FileWriter fw=new FileWriter("C:\\java\\a.txt");
FileWriter fw1=new FileWriter("C:\\java\\b.doc");
int i;
char ch;
String str="",f="";
while((i=fr.read())!=-1)


{
ch=(char)i;
if(ch!='\n')
{
str=str+ch;
}
else
{
StringTokenizer st = new StringTokenizer(str);
while (st.hasMoreTokens())
{
f=st.nextToken();
f.trim();
f.toLowerCase();
{
while((i=fr.read())!=-1)
{
ch=(char)i;
fw.write(ch);
fw.write("\r\n");

}
}
{
fw1.write(ch);
fw1.write("\r\n");
}
}
str="";
}

}


fw.close();
fw1.close();
}

}
BUT WHEN I AM OEN THE .DOC FILRS Unexpected garbage values.How to use this poi package in my program.I want Immediate solution to this can Any body help me plz.
thanks in advance.


1 to 1 of 1
  1. how to use poi
    2006-01-02 01:57:35  kalaisai [View]

1 to 1 of 1