> I'm using POI to write Excel files from a java program. Everything works 
> well. 
> I was just wondering if it is possible to dynamically append data to a file 
> wile
> the file is opened with Excel. I'd like to do that to let the user visualize 
> the
> new data as the data is appended to the file. 

This is not exactly easy. Think of it this way both Excel and a JVM with your 
POI Application will both try to have the same file open at the same time and 
you want to write with one process.

The only way you might be able to do this is as follows. This is theoretical 
though it may not work and error checking will be needed.

(1) You have a special VBA Macro or Visual Studio Add-in that re-opens your 
file over and over. Or the user could do this manually.

(2) Your Java / POI application will need to perform the following every time 
you want to dynamically add data.

- Open a copy of the workbook.
- Append the data.
- Write the whole workbook.
- Close the copy the workbook.
- Move the copy over the original. This could fail if Excel still has a handle 
on the file.

Not very efficient but there is some hope that this might work.

Regards,
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to