Writing Excel file from java works only once.

G

Guy

Hello


I have a servlet which accesses a database table and should display
its content as an Excel sheet.
What I did is using "response.setContentType("application/vnd.ms-excel");"
and then just printing out a HTML table.
This works just fine and produces a nuce Excel sheet which I display
directly on screen (it asks weather I want to save or open it and I
choose open).
The problem is that EXCEL.EXE seems to remain open in the background
and the previous sheet is kept open in memory. So when I try the hwole
thing again with a different table I end up with the same Excel sheet
I had before, over and over again until I logout and back in.
I there a programmatic way to close the previous Excel sheet or flush
the cache ?


Thanks

Guy
 
D

Daniel Schneller

There is a library called "jxl" that can read and write Excel files.
Maybe it would be useful for you.

Daniel
 
B

Ben_

You may also want to ensure that it doesn't pick the sheet from IE's cache
(playing with cache-control, expires, etc directives and the like).
 
G

Guy

Ben_ said:
You may also want to ensure that it doesn't pick the sheet from IE's cache
(playing with cache-control, expires, etc directives and the like).


Is ther a way to reset IE's cache from within my program ?
 
A

Andrew Thompson

Guy said:
"Ben_" <[email protected]> wrote in message ....
Is ther a way to reset IE's cache from within my program ?

Have you considered (is it practical) to append
a timestamp to the name of the xls file?

Different name triggers a fresh load..
 
B

Bob Rivers

Hello


I have a servlet which accesses a database table and should display
its content as an Excel sheet.
What I did is using "response.setContentType("application/vnd.ms-excel");"
and then just printing out a HTML table.
This works just fine and produces a nuce Excel sheet which I display
directly on screen (it asks weather I want to save or open it and I
choose open).
The problem is that EXCEL.EXE seems to remain open in the background
and the previous sheet is kept open in memory. So when I try the hwole
thing again with a different table I end up with the same Excel sheet
I had before, over and over again until I logout and back in.
I there a programmatic way to close the previous Excel sheet or flush
the cache ?

Just another opinion: I use jakarta POI project
(http://jakarta.apache.org/poi/hssf/index.html) in order to generate
(and read) XLS files. It's very good. It's not easy as setting the
response content type, but with it you have access to almost all
funcionalities that excel provides.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top