Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

WORKAROUND: "A document with the name 'vnd.ms-excel' is already open"

Brian CamireDec 31 2007 — edited Oct 21 2010
I'm posting this in the hope that it might help someone else (or that someone else might suggest a better solution)...

I'm using the technique described in the Integrating Oracle Reports in Oracle Forms Services Applications white paper. Basically, this means using RUN_REPORT_OBJECT to generate a report, and then navigating to a URL of the form...
http://<host>/reports/rwservlet/getjobid<n>?server=<name>
...to show it.

I had the requirement that some reports (with DESFORMAT=DELIMITEDDATA) needed to open in Excel, so for these reports I added the MIMETYPE command to the URL, so that it was of the form:
http://<host>/reports/rwservlet/getjobid<n>?server=<name>&mimetype=application/vnd.ms-excel
This appeared to work, but only for one report at a time. I could generate one report this way, and when I navigated to its URL, the report would be displayed by Microsoft Excel within a new browser window as expected. However, if I left the browser window open, then generated a second report and navigated to its URL, a new, empty browser window was displayed, but a "Microsoft Excel" message box appeared with the following message:

A document with the name 'vnd.ms-excel' is already open. You cannot open two documents with the same name, even if the documents are in different folders.

To open the second document, either close the document that's currently open, or rename one of the documents.


When I chose OK (the only button), the message box closed, but the new browser window remained empty.

If Excel was already running to begin with, the message box was obscured behind other windows, and the new browser window remained empty and appeared to never finish loading (because it was waiting for a response from the message box). The message box only appeared if I explicitly navigated to Excel (for example, using the taskbar). When I chose OK, a "File Download" dialog appeared, followed by a message box that reported the following:

Microsoft Excel for Windows has encountered a problem and needs to close. We are sorry for the inconvenience.

When I closed this message box, Excel shut down.

I could not find this documented anywhere, but it appears as if Excel interprets the text after the last "/" in the URL as the file name. In my case, this was the same text every time (specifically "vnd.ms-excel"), which caused problems because Excel does not allow you to open two files with the same name.

My workaround was simply to add the "JOBNAME=/<n>" command (where <n> is the job ID) to make the text after the last "/" unique (at least in my case). In other words, by using a URL of the form...
http://<host>/reports/rwservlet/getjobid<n>?server=<name>&mimetype=application/vnd.ms-excel&jobname=/<n>
...I was able to avoid the problem. For example, for job ID 123, the URL would be...
http://<host>/reports/rwservlet/getjobid123?server=<name>&mimetype=application/vnd.ms-excel&jobname=/123
...and Excel would interpret the file name as "123".

Hope this helps.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2010
Added on Dec 31 2007
1 comment
1,266 views