Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript to open Excel inside the browser

Status
Not open for further replies.

Karpov

Programmer
Oct 10, 2000
5
GB
Has anyone else encountered a similar problem or found a soln. to this?

I have a piece of Javascript to open an Excel workbook that is sitting on an Oracle application server. I want the workbook to be opened inside the browser but it opens in a separate instance of Excel. I have read a technet
article (Q162059) which guides you thro' the options that need to be set via file types in Windows Explorer. However, even when the Browse in Same Window option is checked (which is the default anyway) the workbook fails to open inside the browser.

I am running IE5, Office 2000, and my OS is Win2000. Any hints? I've pasted the javascript below in case it's at fault.

(I will however, need a method that will work on different platforms with different combinations of client s/w eg: Win 95, 98, 00, NT4*; IE4, 5; Office97, 00).

* according to the technet article you need to 'hack' the registry to get this to work on NT - I certainly hope this isn't the case altho' when I looked at the file type options on an NT machine it did not have a browse in same window option :-(

Thanks in advance
Karpy

Javascript :

CREATE OR REPLACE PACKAGE p_ebb_whatif AS

PROCEDURE call_whatif(
in_session_id IN t_ebb_session.session_id%TYPE );



END p_ebb_whatif;
/
show errors

CREATE OR REPLACE PACKAGE BODY p_ebb_whatif AS

PROCEDURE javascript
IS
BEGIN
htp.print('function fnOpenExcelThing(iSessionID) ');
htp.print('{ ');
htp.print(' var oExcel = new ActiveXObject("Excel.Application"); ');
htp.print(' var vPath = "F:\\dev\\andytemp\\WhatIf.xls"; ');
htp.print(' var oBook = oExcel.Workbooks.Open(vPath); ');
htp.print(' var oSheet = oBook.Worksheets.Add(); ');
htp.print(' // Data ');
htp.print(' oSheet.Cells(1, 1) = iSessionID; ');

htp.print(' // Call the function to monkey with the results ');
htp.print(' // oExcel.Run("subFormat"); ');

htp.print(' // Let the user see the application ');
htp.print(' oExcel.Visible = true; ');

htp.print(' // Give the user the control of the application ');
htp.print(' oExcel.UserControl = true; ');
htp.print(' } ');
END;

PROCEDURE call_whatif(
in_session_id IN t_ebb_session.session_id%TYPE )
IS
BEGIN
htp.print('<HTML> ');
htp.print(' <HEAD> ');
htp.print(' <SCRIPT LANGUAGE=&quot;JavaScript&quot;> ');
javascript;
htp.print(' </SCRIPT> ');
htp.print(' </HEAD> ');

htp.print(' <BODY onload=&quot;fnOpenExcelThing(');
htp.print(in_session_id);
htp.print(');&quot;>');
htp.print('<DIV>Loading...</DIV></BODY></HTML>');

END call_whatif;


END p_ebb_whatif;
/
show errors
 
Karpov-

I do want to open a excel document as an instance of Excel. How do you do it with Javascript? Please help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top