File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Opening the excel file multiple times Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Opening the excel file multiple times" Watch "Opening the excel file multiple times" New topic

Opening the excel file multiple times

sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415

In my system , i have excel reports in my server disk . And i am opening the excel files through an action class like / .....and thus from the action class i open my excel file .

After opening one excel file , i try to open another excel by clicking that link , then my system often hangs else excel shows an error saying "a report with name is already open " even though both of these files are different on the server

How can i avoid this ??

The reason why i am opening the excel file through an action class is , i need to perform some operations before opening that excel report

Can any one let me know how to go abt this ??
Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
This is typical restriction with Excel application. Forget about opening it from the web, you cannot open two excel files with same name (may be different path) at the same time. Don't know why this stupid restriction. I think there is some constant to specify while streaming the Excel data into the OutputStream, to specify a file name. With this, I guess you can void this issue.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Try putting this statement in your action before outputting the stream that contains your excel file:

response.setHeader("Content-disposition","attachment; filename=myWorksheet.xls");

Make the file name different for each spreadsheet. I haven't tried this, but it seems logical that it might work.

Consultant, Sima Solutions
Harinath Kuntamukkala
Ranch Hand

Joined: May 17, 2005
Posts: 37
The same problem with popup windows. we cant open two popup windows even they are two different paths in same page.
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi Merill

Even setting that header is of no use .i tried that ....actually i am opening that excel in a frame using and in the temporary interntfiles folder in windows its saving the file with the same URL and thus opening the other file (takes the same url) is causing the problem

can any let me know if u have any ideas
I agree. Here's the link:
subject: Opening the excel file multiple times
It's not a secret anymore!