dynamic IFRAMES and Excel documents

C

Chris

Hi. I'm writing an web app where during the course of events I want to
dynamically create an iframe and set its src property to an Excel
spreadsheet. I know my users will be using IE6 and they will all have
Excel installed, and this process appears to work nicely to show a
simple embedded xls document.

Now comes the part I'm having trouble with... Many times it will be
appropriate to subsequently destroy that xls-containing iframe and
display something else. I believe I'm destroying the iframe correctly,
but the EXCEL.EXE process on the client never goes away. It has no
visual representation after the iframe is removed, so the only recourse
is to kill it from the Windows process list. So, I think I'm probably
doing something wrong.

My question is this: How can I destroy this iframe and truly kill off
excel in the process?


Here's sort of what I'm currently working with:

// to create the iframe
var div = document.getElementById("theIframeParentDiv");
var ifr = document.createElement("iframe");
ifr.id = "iframe1";
ifr.src = "mydoc.xls";
// also set some positioning attributes...
div.appendChild(ifr);


// to destroy the iframe
var ifr = document.getElementById("iframe1");
var div = document.getElementById("theIframeParentDiv");
div.removeChild(ifr);


thanks,
Chris
 
C

Chris

Thanks for the reply, but I'm not sure what this really accomplishes.
Can you please clarify a few things?

1. If I use WMI-related classes to kill the excel.exe process, how can
I know exactly WHICH excel.exe to kill? The user may also have other
legitimate excels up and running, and I don't want to kill them.

2. Even though I know my users will be on IE, I doubt the security
settings will be such that I can reliably create and use these on the
client.

3. How would I be able to create and use an Excel object through COM
in the IE client? How could I control where and when to display the
excel document in this way?


thanks,
Chris
 
M

michael elias

1. I'm not that familiar with the WMI api. you'll have to do some
research on this yourself ...

2. You're right about that, you can use a HTA file to show your
webpage. A HTA is a more trusted version of IE and will allow you to
create ActiveXObjects without the security restrictions of IE. If you
have AntiVirus software installed it may alert the user if you try to
access the filesystem or any other potential harmfull behaviour.

3. I've automated Excel from Jscript and it works fine. I'm not sure if
you can open an excel file inside an iframe with COM. It may be
possible, you'll have to check the reference at MSDN :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl10/html/xlwhatsnew.asp

Another way is to create the excel file with COM or define it in XML
and then open it in the iframe.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top