Create a word document with the data present in uploaded file from !_NEWLINE_!jsp page
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sreedevi_nandiraju
Posted On:   Friday, April 20, 2001 04:13 AM

I am uploading a word document from a jsp page ,i have to
access this data(content in the word doc) from the bean, and create
another doc(file) and write back the same data.Please help me
how do i do this? problem i am getting, all the junk chars were
being written in to the file.

Re: Create a word document with the data present in uploaded file from !_NEWLINE_!jsp page

Posted By:   Ravi_Verelly  
Posted On:   Monday, April 23, 2001 01:01 PM

When you read the data from source.doc file read byte by byte and write the same to dest.doc.

Ex:

InputStream fi = new FileInputStream(source.doc);

int c = fi.available();

byte buf[] = new byte[c];

for (int i=0; i
buf[i]=(byte) fi.read();

}

fi.close();

OutputStream fo = new FileOutputStream(dest.doc);

fo.write(buf);

fo.flush();

fo.close();
About | Sitemap | Contact