I'm developing a web app, so using an upload file control i want to save a
copy on the filesystem to be retrieved later on in addition to parsing that
file to upload the data to the database.
I will look into your post thanks for responding!
MSB wrote:
>
> Can I just make sure that I understand what you want to accomplish please?
> Are you asking how to create a copy of an existing Excel file? You do not
> want to process the file at all just make a copy of it?
>
> If that is correct, then you do not need to use POI at all, core Java will
> suffice. You need to open an input stream connected to the existing file
> and an output stream connected to the 'new' copy file. Next, simply write
> a loop that reads data from the input stream and writes it to the output
> stream. The loop will terminate once all data has been read from the input
> file and at that time you can flush the output stream, and close both
> input and output stream. If it were me, I would use buffered input and
> output streams to ease the burden on the IO system but that is by no means
> compulsory.
>
>
>
> AlyssaK wrote:
>>
>> Hi everyone,
>>
>> I was just wondering if i can use POI to save a copy of the Excel file
>> that i am reading on the file system? I've looked through the API only
>> found references to creating new Excel files. If you have a suggestion
>> how i would go about this please post a response. Thanks.
>>
>>
>> I am using the following method to open the Excel Spreadsheet:
>>
>> public static void parseFileSetup(){
>> try{
>> // open the Excel Spreadsheet
>> POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename));
>>
>> // check if the file was found
>> if (fs==null){
>> System.out.println("fs is null");
>> }
>> wb = new HSSFWorkbook(fs);
>> }catch ( IOException ex ) {
>> ex.printStackTrace();
>> }
>> }
>>
>>
>> Eventually users will be uploading files so I need to save it.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/How-to-save-the-Excel-file-to-file-system-tp23363786p23364527.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]