Hi,
Is
there a way to read a sheet direclty and merger it with another file. This is
what i am trying to do. But the handle for the work sheet doesnt get transfered.
public class
readxlssheet {
public static void main(String arv[]){
try{
FileInputStream in = new FileInputStream("PG00073-AU7189-OMPA.xls");
Filesystem fs = new Filesystem(in);
HSSFWorkbook h = new HSSFWorkbook(fs);
HSSFSheet s = h.getSheet("BOM FORM");
HSSFRow r = s.getRow(0);
HSSFCell c = r.getCell((short)0);
System.out.println(c.getStringCellValue());
HSSFWorkbook h1 = new HSSFWorkbook();
HSSFSheet s1 = h1.createSheet("new");
s1 = s;
FileOutputStream out = new FileOutputStream ("new.xls");
h1.write(out);
}catch(Exception ex){
System.out.println("Error"+ex.getMessage());
}
}
}
public static void main(String arv[]){
try{
FileInputStream in = new FileInputStream("PG00073-AU7189-OMPA.xls");
Filesystem fs = new Filesystem(in);
HSSFWorkbook h = new HSSFWorkbook(fs);
HSSFSheet s = h.getSheet("BOM FORM");
HSSFRow r = s.getRow(0);
HSSFCell c = r.getCell((short)0);
System.out.println(c.getStringCellValue());
HSSFWorkbook h1 = new HSSFWorkbook();
HSSFSheet s1 = h1.createSheet("new");
s1 = s;
FileOutputStream out = new FileOutputStream ("new.xls");
h1.write(out);
}catch(Exception ex){
System.out.println("Error"+ex.getMessage());
}
}
}
Any other way to do
it?
Thanks,
Nagraj.
"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this
communication is strictly Prohibited.
If you have received this message by error, please notify us
immediately, return the original mail to the sender and delete the
message from your system."
