473,803 Members | 3,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 23 '05 #1
3 7753
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.

Jul 23 '05 #2

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

Jul 23 '05 #3
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.

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3766
by: c duden | last post by:
Excel won't allow documents to be linked to a worksheet in office 2000 when using C# to create an add-in. The following code snippets are what was used in the attempts (there are more permutations of parameters, but for brevity...): // one - based on code from Matt Reynolds' website Excel.Worksheet active = (Excel.Worksheet)excelApp.ActiveWorkbook.ActiveSheet; ((Excel.OLEObjects)active.OLEObjects(Type.Missing)).Add(
25
3511
by: jullag | last post by:
Hi, does anyone know of any javascript method that does the same job as document.write(), but not necessarily at the end of the document? For instance, insert some text inside an element that has a specific ID tag? thanks a lot JL
5
2234
by: Frances | last post by:
I need to replace iframes acc. to what option user chooses in a sel obj.. but figured have to load a blank iframe when pg loads so I can replace it.. (iframe gets put in a pre-existing div..) this is approach.. I'm having some problems and would appreciate some help.. thank you very much... var selItem; var ifrCurr; var div = document.getElementById("divPricing"); // this var not being read inside functions..
2
4746
by: Krish | last post by:
This is my first attempt, please bear. I referenced Excel 10.0 Object from VS .NET IDE, I think this creates Interop Object for Excel. I have the following code. ------code start---- using System;
1
3042
by: Bernd Muent | last post by:
Hi together, I am using the following code in Visual Basic to open Word or Excel applications: Word: Dim w As Word.Application w = CType(CreateObject("Word.application"), Word.Application) w.Application.Documents.Open("test.doc") With w.Application.Selection
4
2502
by: Lewis Edward Moten III | last post by:
I have a file that users can download through a web page protected by forms authentication: Download.aspx?ID=45 and within that file ... FileInfo fileToDownload = new FileInfo(fileName);
14
5807
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the SQL DATABASE, probably by the click of a button. Is this possible? & what is the BEST APPROACH for doing this? & also if any links are there do tell those to me too coz I have no idea how to go about doing it.
9
2987
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
0
2672
by: sandervanee | last post by:
Hello, I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well, but I've one problem. The first problem is that in Excel apostrophes ('), carets (^), quotation marks ("), or backslashes (\) appear in the formula bar but not in the cells, like it does when you import in Excel from Lotus. When I use the command...
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.