dynamic IFRAMES and Excel documents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris

    #1

    dynamic IFRAMES and Excel documents


    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.getEle mentById("theIf rameParentDiv") ;
    var ifr = document.create Element("iframe ");
    ifr.id = "iframe1";
    ifr.src = "mydoc.xls" ;
    // also set some positioning attributes...
    div.appendChild (ifr);


    // to destroy the iframe
    var ifr = document.getEle mentById("ifram e1");
    var div = document.getEle mentById("theIf rameParentDiv") ;
    div.removeChild (ifr);


    thanks,
    Chris

  • michael elias

    #2
    Re: dynamic IFRAMES and Excel documents

    You can try using WMI (Windows Management Instrumentation ) to kill the
    EXCEL.EXE process.

    http://msdn.microsoft.com/library/de...wbemobject.asp

    Also you can instantiate an Excel ActiveXObject and call the Close
    function to close the excel file.
    The iframe is automatically destroyed by the garbage collector, as long
    as you don't have a it referenced elsewhere.

    Comment

    • Chris

      #3
      Re: dynamic IFRAMES and Excel documents


      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

      Comment

      • michael elias

        #4
        Re: dynamic IFRAMES and Excel documents

        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/de...xlwhatsnew.asp

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

        Comment

        Working...