E
Edward
I am completely in the dark about ActiveX, but I up until yesterday I
used to have a working app with ASP.NET. Now the client wants to fire
up a Word document from inside the browser and have given me an
ActiveX control to do it.
This is the code (well, the pertinent bits anyway)
PLEASE NOTE: THE LINES MARKED WITH *** ARE NEW AS A RESULT OF THIS
NEW REQUIREMENT
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.116,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Item_Leads.aspx.vb" Inherits="CCC_Sales_Lead.LeadItem" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Colt Car Company Sales Lead System</title>
<meta content="Microsoft Visual Studio.NET 7.0"
name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="../Styles.css" type="text/css" rel="stylesheet">
<SCRIPT language="javascript"
src="../jscript/formgeneric.js"></SCRIPT>
</HEAD>
<body leftMargin="4" topMargin="4" rightMargin="4"
MS_POSITIONING="GridLayout">
*** <OBJECT ID=Exporter
CLASSID=CLSID:35FC60AA-B509-11D2-80AE-00A0245361B3
CODEBASE=HTMLExport.CAB#version=1,0,0,7 VIEWASTEXT> </OBJECT>
<form id="Form1" method="post" runat="server">
…
<INPUT id="txtMergeFile" style="Z-INDEX: 101; LEFT: 71px; WIDTH: 30px;
POSITION: absolute; TOP: 583px; HEIGHT: 10px" type="hidden" size="1"
runat="server">
…
***<INPUT id="cmdWord" style="Z-INDEX: 106; LEFT: 209px; WIDTH: 75px;
POSITION: absolute; TOP: 12px; HEIGHT: 21px" type="button"
value="Button" onclick="ExportTable()">
…
function DoQueryClick()
{
var columnindex, gridrowindex, gridname
if (!(oRow = GetRow(window.event.srcElement))) return true;
columnindex = window.event.srcElement.cellIndex;
gridrowindex = oRow.rowIndex + 2
gridname = oRow.parentElement.parentElement.id;
//stop
if (columnindex == DeleteColumn ||
window.event.srcElement.parentElement.parentElement.cellIndex ==
DeleteColumn)
{
// Verify - Force delete postback - assumes ctl4 is delete
column
if (window.confirm('Delete response dated: ' +
oRow.cells(2).innerText + ' ?'))
{
__doPostBack(gridname + ':_ctl' + gridrowindex +
':_ctl2','');
}
}
else
{
// Assumes rowindex begins at 3 - select/delete columns return
undefined if image clicked on
if ((gridrowindex > 2))
{
// Force select postback - assumes ctl1 is select column
__doPostBack(gridname + ':_ctl' + gridrowindex +
':_ctl0','');
}
} //THIS IS LINE 563
}//-->
***<script language="VBScript">
*** Sub ExportTable()
*** errCode =
Exporter.ExportTable(document.getElementById(txtMergeFile).value,"WORD"))
*** End Sub
***</script>
When the page loads I get a Runtime error:
Error: Line 563 Expected end of statement
If I ignore this the page renders fine, but when I click the cmdWord
button I get another error :
Microsoft JScript runtime error: Object expected
and the function call ExportTable() is highlighted.
Anyone any ideas? Much, much appreciated.
Edward
used to have a working app with ASP.NET. Now the client wants to fire
up a Word document from inside the browser and have given me an
ActiveX control to do it.
This is the code (well, the pertinent bits anyway)
PLEASE NOTE: THE LINES MARKED WITH *** ARE NEW AS A RESULT OF THIS
NEW REQUIREMENT
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.116,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Item_Leads.aspx.vb" Inherits="CCC_Sales_Lead.LeadItem" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Colt Car Company Sales Lead System</title>
<meta content="Microsoft Visual Studio.NET 7.0"
name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="../Styles.css" type="text/css" rel="stylesheet">
<SCRIPT language="javascript"
src="../jscript/formgeneric.js"></SCRIPT>
</HEAD>
<body leftMargin="4" topMargin="4" rightMargin="4"
MS_POSITIONING="GridLayout">
*** <OBJECT ID=Exporter
CLASSID=CLSID:35FC60AA-B509-11D2-80AE-00A0245361B3
CODEBASE=HTMLExport.CAB#version=1,0,0,7 VIEWASTEXT> </OBJECT>
<form id="Form1" method="post" runat="server">
…
<INPUT id="txtMergeFile" style="Z-INDEX: 101; LEFT: 71px; WIDTH: 30px;
POSITION: absolute; TOP: 583px; HEIGHT: 10px" type="hidden" size="1"
runat="server">
…
***<INPUT id="cmdWord" style="Z-INDEX: 106; LEFT: 209px; WIDTH: 75px;
POSITION: absolute; TOP: 12px; HEIGHT: 21px" type="button"
value="Button" onclick="ExportTable()">
…
function DoQueryClick()
{
var columnindex, gridrowindex, gridname
if (!(oRow = GetRow(window.event.srcElement))) return true;
columnindex = window.event.srcElement.cellIndex;
gridrowindex = oRow.rowIndex + 2
gridname = oRow.parentElement.parentElement.id;
//stop
if (columnindex == DeleteColumn ||
window.event.srcElement.parentElement.parentElement.cellIndex ==
DeleteColumn)
{
// Verify - Force delete postback - assumes ctl4 is delete
column
if (window.confirm('Delete response dated: ' +
oRow.cells(2).innerText + ' ?'))
{
__doPostBack(gridname + ':_ctl' + gridrowindex +
':_ctl2','');
}
}
else
{
// Assumes rowindex begins at 3 - select/delete columns return
undefined if image clicked on
if ((gridrowindex > 2))
{
// Force select postback - assumes ctl1 is select column
__doPostBack(gridname + ':_ctl' + gridrowindex +
':_ctl0','');
}
} //THIS IS LINE 563
}//-->
***<script language="VBScript">
*** Sub ExportTable()
*** errCode =
Exporter.ExportTable(document.getElementById(txtMergeFile).value,"WORD"))
*** End Sub
***</script>
When the page loads I get a Runtime error:
Error: Line 563 Expected end of statement
If I ignore this the page renders fine, but when I click the cmdWord
button I get another error :
Microsoft JScript runtime error: Object expected
and the function call ExportTable() is highlighted.
Anyone any ideas? Much, much appreciated.
Edward